Hi folks. For the practice exercise for Storage classes, questions 8/9/10 I cre . . .

Oleksandr Volynets:
Hi folks. For the practice exercise for Storage classes, questions 8/9/10 I created a pvc as instructed:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: local-pvc
spec:
  storageClassName: local-storage
  volumeName: local-pv
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 500Mi

However, its status was set to Bound immediately (as opposed to Pending, which was expected as the answer to the question). There was no Pod created yet, but the PVC was bound to PV already. What could be the reason for this? Thanks

Tanuja SM:

apiVersion: <http://storage.k8s.io/v1|storage.k8s.io/v1>
kind: StorageClass
metadata:
  name: local-storage
provisioner: <http://kubernetes.io/no-provisioner|kubernetes.io/no-provisioner>
volumeBindingMode: WaitForFirstConsumer

Tanuja SM:
you need to define volume binding mode as waitforfirstconsumer

Tanuja SM:
when you will create the pod, then the PVC will get bound, until then it will be in pending state

Oleksandr Volynets:
it was exactly set to WaitForFirstCustomer already, therefore I got surprized

Oleksandr Volynets:
I can try running the lab again if I get the same problem

Oleksandr Volynets:
weird, this time I created a pvc instead of sc (or maybe I misread the instructions the first time) and it works as expected