Day 30/#30daysofK8s

When defining PV, we can use cloud storage instead of local host path. But any cloud storage mentioned must be manually created, it would be nice if it could be dynamically created instead, which is where dynamic provisioning comes in. For dynamic provisioning, we can create storage class object.

apiVersion: v1
kind: StorageClass
metadata:
name: smg
provisioner: kubernetes.io/gce-pd

Once we have storage class, we no longer need PV. We can directly pass the storage class name in pvc definition file.

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: smpvc
spec:
resources:
requests:
storage: 4Gi
storageClassName: smg
accessModes:
- ReadWriteOnce

The storage class would still create PV but we won’t need to manually create it(that doesn’t make sense).

Here ends the tale of #30daysofK8s. I’ll admit not all days were satisfactory, like today, it was alright, but I’m glad I stuck to it and spend at least a few minutes every day, if not more, learning K8s. Better done than perfect!

--

--