0

I have created a statefulset with 3 replicas with dynamic persistent volume claim with access mode as "Readwriteonce". Once kubectl apply/create is performed, noticed that three persistent volumes are created dynamically. and data from the image is copied to only one PVC where are rest two pods doesnt have any data.

Is there any way to create a common PVC with STS. (My application only support ReadWriteOnce)

Ruli
  • 2,592
  • 12
  • 30
  • 40
sam520
  • 1
  • If your application only supports `ReadWriteOnce`, how would you expect to share a common PVC between three instances? I believe you can get the configuration you want by specifying an explicit volume in your statefuleset manifest, rather than using a volumeClaimTemplate. See e.g. https://stackoverflow.com/questions/49729461/add-persistent-volume-in-kubernetes-statefulset-on-minikube. – larsks Jan 13 '22 at 19:58
  • @larsks, I dont think ReadWriteOnce is the reason as this is a STS and each pod gets its own private PV. – Rakesh Gupta Jan 13 '22 at 20:31
  • It sounds like they were asking for a *common PVC* to be used by all STS instances ("is there anyway to create a common PVC with STS. ") which is exactly the opposite of the default behavior (and is addressed by the question to which I linked). – larsks Jan 13 '22 at 20:35
  • 1
    can you post your spec to your question for clarity? – gohm'c Jan 14 '22 at 02:53

0 Answers0