CKA scenarios: note on persistent-volumes
Hey there,
Just a minor comment regarding this scenario [1]: as it is using dynamic provisioning via the rancher.io/local-path storage class [2], it is not necessary to explicitly create the persistent volume pv-volume, actually our files will never be mounted in the mnt/data folder at the node 😅
If you have created the pvc-claim, once you spin up a pod that uses it, a pv will be created for you:
$ kubectl describe pv
Name: pvc-ba04c55e-c3ed-435e-b4b6-5ea7a2f728be
Labels: <none>
Annotations: local.path.provisioner/selected-node: controlplane
pv.kubernetes.io/provisioned-by: rancher.io/local-path
Finalizers: [kubernetes.io/pv-protection]
StorageClass: local-path
Status: Bound
Claim: default/pv-claim
Reclaim Policy: Delete
Access Modes: RWO
VolumeMode: Filesystem
Capacity: 1Gi
Node Affinity:
Required Terms:
Term 0: <none>
Message:
Source:
Type: HostPath (bare host directory volume)
Path: /opt/local-path-provisioner/pvc-ba04c55e-c3ed-435e-b4b6-5ea7a2f728be_default_pv-claim
HostPathType: DirectoryOrCreate
Events: <none>As you can see your files will be stored in /opt/local-path-provisioner/pvc-ba04c55e-c3ed-435e-b4b6-5ea7a2f728be_default_pv-claim at your node:
$ ls -l /opt/local-path-provisioner/pvc-ba04c55e-c3ed-435e-b4b6-5ea7a2f728be_default_pv-claim
total 4
-rw-r--r-- 1 root root 28 Sep 10 10:30 index.htmlHope it helps 👍
Cheers,
Luis
BTW: thank you @Chad Crowell for the scenarios, very helpful!
[1] https://killercoda.com/chadmcrowell/course/cka/persistent-volumes /