StatefulSet with persistent volume; it requires a StorageClass that provisions a volume dynamically. Because each Pod is created by StatefulSets, it will create a persistent volume claim (PVC) with a different identifier. If your StatefulSets specify a static name of PVC, there will be trouble if multiple Pods try to attach the same PVC.
If you have StorageClass on your cluster, update datanode.yaml to add spec.volumeClaimTemplates as follows:
$ curl https://raw.githubusercontent.com/kubernetes-cookbook/second-edition/master/chapter3/3-4/datanode-pv.yaml... volumeClaimTemplates: - metadata: name: hdfs-data spec: accessModes: [ "ReadWriteOnce" ] resources: requests: storage: 10Gi
This tells Kubernetes to create a PVC and PV ...