There's more...

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/PacktPublishing/Getting-Started-with-Containerization/master/Chapter14/14-4/datanode-pv.yaml...  volumeClaimTemplates:  - metadata:      name: hdfs-data    spec:      accessModes: [ "ReadWriteOnce" ]      resources:        requests:          storage: 10Gi

This tells Kubernetes to ...

Get Getting Started with Containerization now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.