My Profile Photo

Sheogorath's Blog

StatefulSet Revisions

Today I learned that the revisions from StatefulSets and DaemonSets in Kubernetes are stored in ControllerRevision objects. These revisions allow to rollback StatefulSets using the kubectl rollout undo subcommand. This is drastically different from Deployments, which store their revisions in ReplicaSets. This is not necessarily obvious since Pods of a StatefulSet are directly owned by the StatefulSet, while Pods from a Deployment are owned by the ReplicaSet.

kubectl get controllerrevisions --all-namespaces

I came across this due to a question in the Kubernetes Matrix room, which first lead to a wrong/outdated StackOverflow answer followed by some investigation and the finding the actual answer by exploring the Kubernetes API resources.