Persistent Volume Claims

Is it possible to create a PVC and pod without a PV?
My understanding is, you need a PV to bound to a PVC then create a POD and assign the PVC.
I’ve seen some questions whereby, you’re asked to create a PVC and Pod. How do you tackle this without a PV? Please someone help clarify

Hi @cambell79
Yes it is entirely possible to create a PVC, however without a PV to bind to, the PVC will remain in a pending state, as will the pod that is using it.

PV’s must be either created manually, or via a StorageClass provider that can auto-provision PVs when that storage class is referred in the PVC manifest.

StorageClass providers exist for all the major cloud providers, and also for some SAN providers.

Thanks @Alistair_KodeKloud Yes I realized the pod stayed in a pending state when I was practicing. This question seems to be a CKA question. In such a case what happens? How do you validate the solution or would be ok if the pod is pending?

Is this concerning a particular lab or challenge? If so, could you provide the link.

This is the question I was refering to:
Create a new PVC:
o Name: pv-volume
o Class: csi-hostpath-sc
o Capacity: 10Mi Create a new Pod which mounts the PVC as a volume:
o Name: web-server
o Image: nginx
o Mount path: /usr/share/nginx/html Configure the new Pod to have ReadWriteOnce access on the volume. Finally, using kubectl edit or kubectl path expand the PVC to a capacity 70Mi and record that change.

Hey @cambell79 ,
Doesn’t help me to find the particular lab you’re talking about - we have many.
Assuming this is a KodeKloud lab, the hyperlink to it would help a lot.

If it is not a KK lab, then it is likely that there is a previous question that asks you to configure the storage class csi-hostpath-sc (which, given its name is likely to just allocate a directory on the host node), and that is not correctly configured.

That’s what throws me off. It’s not a KK lab question, like I said, it’s a CKA exam sample question

From where? Do you have a link to that?

There is no link, just a word doc with dumps i’m practicing with
There is no previous question asking to create PV or csi-hostpath-sc.

Ah, that makes it harder.
The assumption therefore is that you’re running a cluster with the storage class installed.

If you’re using minikube, it looks like it can be enabled as an add-on.

Ok thanks for your help.