kubernetesuploadpersistent-volumespersistent-volume-claimsvultr

Kubernetes PVs and PVCs - access from multiple pods


I have a persistent volume created locally in my Kubernetes cluster running in VULTR managed K8S.

When I then deploy multiple pods (for example a Webservice where one can upload images - deployed with multiple replicas) that use this persistent volume via a persistent volume claim, (mounted to a specific path in the pod via volumeMounts) ->

How is it possible, when an image gets uploaded via that described Webservice, that runs in the described replicated pods, to make these uploads (uploaded on a specific pod of that service, that runs on a specific node), available to the other pods/nodes?

What happens is, that an image uploaded via the Webservice on pod-x gets saved in the volumeMounts path ONLY and that pod-x, and is not available on the others pods volumeMounts path.

As using Kubernetes in most cases assumed running an application in more then 1 pod/node, what am I missing out here?

PS I am not using a cloud providers storage, I applied the PV via mode „local“.

I also guess that this is not the issue. The issue must be on the PVC end of side as this is where the pods access that bound PV..

Maybe someone has experience with this topic.

Franz


Solution

  • Kubernetes does not replicate data across local volumes. You need to use shared storage like NFS or SMB.