Search code examples
kuberneteskubernetes-podpatroni

How to cancel a broken StatefulSets rolling update?


I have a PostgreSQL Kubernetes Service based on Patroni/Spilo. This Kubernetes service deploys a cluster of three PostgreSQL pods + three Etcd pods. During maintenance, I had a failure and I wasn't able to restore the old configuration that worked fine before the rolling update.

I searched for documentation and it seems StatefulSets doesn't support rollbacks as deployment. I found this thread that references this doc.

To be honest, however, I didn't understand how to proceed.

My cluster has the following pods:

postgres-0
postgres-1
postgres-2
etcd-0
etcd-1
etcd-2

my rolling update simply needed to upgrade the etcd image from 3.3.20 to 3.5.1. The upgrade started to update etcd-2 and the pod crashed for several reasons. So my intention was to stop the update and revert the etcd-2 to 3.3.20.

How I should proceed in a situation like this? How liveness and probing can help me here? At the moment, the solution proposed in that thread is a bit confusing to me.


Solution

  • To undo changes that have been made, first checkout the rollout history kubectl rollout history sts <name> -n <namespace if not default>.

    Get more details about a revision kubectl rollout history sts <name> --revision <number> -n <namespace if not default>.

    Undo the changes kubectl rollout undo sts <name> --to-revision <number> -n <namespace if not default>