Howard (2) [Avatar] Offline
#1
In MEAP 10 Section 10.3.2 "Deploying the app through a StatefulSet" I've created the peristent volumes on GCE with 1 node
kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM
pv-a 2Gi RWO Recycle Available 38s
pv-b 2Gi RWO Recycle Available 38s
pv-c 2Gi RWO Recycle Available

However after creating the stateful set the pods are allocated a pv that is dynamically created with a name similar to:
pvc-53ecea3a-cecb-11e7-ab43-42010a8401e9

I can't see from the VolumeClaimTemplates: section in (p 283) in the statefulset yaml file how this references to the manually created persistent volumes, and in my case it's not using them.

Are there working yaml file examples as the ones referenced point to Chapter9 directories ?
Marko Lukša (67) [Avatar] Offline
#2
Ah yes, I forgot to update the pvc template. If you want it to not use the dynamically provisioned PV, you need to add the following property to the PVC template:

storageClassName: ""

I believe this is mentioned in the chapter on volumes. Or maybe I added it after MEAPv10 was released.
Howard (2) [Avatar] Offline
#3
Thanks you have mentioned this and now that you've reminded me it's looking good.

volumeClaimTemplates:
- metadata:
name: zoodisk
spec:
resources:
requests:
storage: 1Mi
accessModes:
- ReadWriteOnce
storageClassName: ""

kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pv-a 2Gi RWO Recycle Available 1m
pv-b 2Gi RWO Recycle Bound default/zoodisk-zoo-0 1m
pv-c 2Gi RWO Recycle Bound default/zoodisk-zoo-1