Persistent Volume Claims after Helm reinstall?

103 Views Asked by At

I have a Helm chart with a stateful set that creates a PVC and PV.

The statefulset pod is a name like this, mycompany-statefulpod-instance-0 mycompany-statefulpod-instance-1 mycompany-statefulpod-instance-2

When I do a Helm uninstall, the PVC and PV are left behind. I would think that this makes sense since you will want to hook up to these when re-installing the Helm chart.

My question is, whether it really works this way or not? So when the stateful set pod is created again (with the same name since its a stateful set), will it just automatically connect to the existing PVC with the same name as before? Or will it complain that it exists but is not empty, etc.?

1

There are 1 best solutions below

0
DanF On

Depends on your storage class

kubectl get storageclass

will list your current storage class and what the behavior for deleted PVCs, it could be either Retain or Delete. Since they are sticking around I would presume its Retain. To answer your question, with such a storage class, yes it will bind the PVC to a new pod, assuming it gets scheduled on the same region as disks are generally bound to the region so be careful when redeploying the pod as it could get scheduled on zone-A but the disk was created on zone-B, this usually happens when the affinity and anti affinity rules on a deployment are not correctly set.