0

I have a PVC which is used by numerous pods and should be bound to a PV using ram disk

When I try to describe the PVC I get the following message:

waiting for first consumer to be created before binding

I don't understand that, because it sure looks bound to me. If I do a describe on the PV I'm pretty sure the PVC is bound to it says there is a claim for default/PVC_name

If I log into the shell of the containers that are using that PVC I can ls the mounted directory, see files are being saved and read etc.

By all indication I can tell that PVC sure looks bound, so why does the describe message say otherwise?

dsollen
  • 6,046
  • 6
  • 43
  • 84

1 Answers1

0

Possible workaround 1 : Persistent volumes not auto provisioned on k8s 1.24

Before k8s 1.24, the default StorageClass was standard, which uses volumeBindingMode Immediate. However, since k8s 1.24, the default StorageClass is standard-rwo, which uses volumeBindingMode WaitForFirstConsumer.

This behavior is intended and actually preferred. Please create a workload that consumes the PVC, then a PV will be created.

update your StorageClass to immediate:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: Immediate  # <-- bind as soon as PVC is created

WaitForFirstConsumer will only bind when a Pod uses your PVC.

Please check Persistent volumes and dynamic provisioning for more information.

Possible workaround 2 : Check you might have created your PV on the master node. By default the master node is marked unschedulable by ordinary pods using so called taint. To be able to run some service on master node you have two options:

  1. Add toleration to some service to allow it to run on master node:
  2. You can remove taint from the master node, so any pod can run on it. You should know that this is dangerous because it can make your cluster very unstable.

Please go through the similar SO for more information.

Veera Nagireddy
  • 1,656
  • 1
  • 3
  • 12
  • But the pod appears to be running and bound to the PVC, I still get the error when I describe the PVC – dsollen Jan 24 '23 at 16:03
  • Can you please post your exact error message or else screen sheet of the error? – Veera Nagireddy Jan 24 '23 at 16:05
  • Also please share your configuration details. – Veera Nagireddy Jan 24 '23 at 16:30
  • Hello @dsollen, Describe message says as mentioned in the answer that **behavior is intended and actually preferred**. Feel free to update the status of the question. Let me know the answer below helps to resolve your issue? I am happy to help you if you have any further queries. – Veera Nagireddy Mar 08 '23 at 11:11