O'Reilly logo

Kubernetes Cookbook, 2nd Edition by Ke-Jou Carol Hsu, Hui-Chuan Chloe Lee, Hideto Saito

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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/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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required