How to create a directory in PVC

I need to create a directory in PVC.

Need to verify whether created directory exist or not ?

Please note, we don’t have access to worker nodes and PVC is binded.

Thanks & Regards,

Hi @nagavenkatasudhakar

Not quite sure what you are asking for. If a PVC is mounted to a container in a pod in read-write mode, then the container can create any directory it wishes. If it failed to create, then the container would receive an error, the same error for the same conditions on a physical disk.

Since you mention worker nodes, then I assume your PVC is bound to a hostPath persistent volume. If you want pre-existing directories when you mount the PVC in the container, then the admin of the worker node will have to create those for you first.

Or, if the container you are running your application in expects a certain directory structure and/or files to be present when it runs, you can also set it up using an init container as in Kubernetes Challenge 1