Home > other >  How to set timeout for rolling update to statefulset?
How to set timeout for rolling update to statefulset?

Time:03-06

I use helm and I have a problem, when a pod (statefulset) is entring to CrashLoopBackOff, it never exit this state.

Even when there is a new rolling update, the statefulset still in the same state CrashLoopBackOff from the old rolling update.

Question

What can I do to force the statefulset to start the new rolling update (or even better, gracefully)?

  • An answer for k8s-deployment will also be great!

CodePudding user response:

You can force helm to recreate resources by adding --force to the switches, for example

helm upgrade --install -n mynamespace --force myrelease ./mychart

This will delete and recreate the resources, including the statefulset pods. This may (YMMV) fix your problem, it may not. It depends on that cause of the crashloop, so you should ideally fix that before even considering forcing a new rolling update. Or at least patch the statefulset so it's running correctly, before doing the update.

CodePudding user response:

Assumed the installation was succeeded before. You need to fix the CrashLoopBackOff first by running helm rollback <release> --namespace <if not default> --timeout 5m0s <revision #>, then only you do helm upgrade with the new image. You can get the list of revision # by helm history <release> --namespace <if not default>.

  • Related