-1

I am trying to deploy a pod in kubernetes using helm which use a persistent volume that it is going to disconnect its pvc each time that I redeploy.

When I do that the persistent volume it goes to state "released" and my pod cannot attach it and stay in "pending" without apply the pvc.

Here my pv:

NAME                         CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS     CLAIM
backend-pv                2Gi        RWO            Delete           Released   backend/***

How I can release automatically the pv to stay in state available each time that I redeploy with helm?

I already know that I can delete the claimRef manually and it goes available again but i would like to do it automatically. Any help?

Thank you

I expect to redeploy with helm my component and keep attach to the persistent volume without deleting anything manually.

Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102

1 Answers1

0

Your POD is getting in pending because there is already one POD running, and as your PV is RWO ReadWriteOnce only one POD can attach to it.

Read More about the RWO & RWM : https://stackoverflow.com/a/57798369/5525824

When you perform the Helm redeploy it might be occurring to Rollingupdate for the deployment you are deploying that is causing the issues.

If you are planning to do rolling update for multiple POD and you are deploying with Helm you have to use the RWM - ReadWriteMany

Else you might have to change Rolling update to Recreate strategy.

In deployment .spec.strategy.type - of Recreate

This will create Downtime if a single replica running.

Harsh Manvar
  • 27,020
  • 6
  • 48
  • 102
  • Thank you for answering so quickly, unfortunately I used the policy ReadWriteMany instead in my persistent volume and I have included in my deploy the "strategy.type" and its still not working. If I describe the pvc it tells me: Events: Warning FailedBinding 2m23s (x42 over 12m) persistentvolume-controller volume "backend-pv" already bound to a different claim. – Jesus Montilla Mar 06 '23 at 11:25
  • it is not just about changing the policy if you might need to create new PV with policy of RWM. Just try with changing strategy once recreate one and no changes to PVC and PV keep it as you were using and give it try. Just changing the ReadwriteMany wont edit existing PV for you as depends on provider backed disk should be also supported. – Harsh Manvar Mar 06 '23 at 12:21