Kubernetes
Inspect Kubernetes rollout revisions
Use kubectl rollout history to see the revisions retained for a Deployment, DaemonSet, or StatefulSet. Select a revision when you need its change-cause metadata before deciding whether to roll back.
Documentation reviewed · 2 methods with sources
Ways to do it
CLI
kubectl rollout history
List retained revisions for a workload, or inspect one revision with --revision.
Read source: kubectl rollout history reference- Requirements
- kubectl configured for the target cluster and permission to read the workload and its rollout history.
- Limitations
- History is bounded by the workload's revision history limit. A revision number can disappear after older ReplicaSets are garbage-collected.
Example shell
kubectl rollout history "deployment/$DEPLOYMENT" -n "$NAMESPACE" --revision=3CLI
kubectl get ReplicaSets
List ReplicaSets and compare their controller owner and revision annotation to the Deployment.
Read source: Kubernetes rollout revision annotations- Requirements
- kubectl configured for the cluster and permission to list ReplicaSets in the namespace.
- Limitations
- Several workloads can share the same app label. Match controller owner UID to the Deployment UID before using the revision.
Example shell
kubectl get replicasets -n "$NAMESPACE" -l app="$APP_LABEL" -o 'custom-columns=NAME:.metadata.name,OWNER:.metadata.ownerReferences[?(@.controller==true)].uid,REVISION:.metadata.annotations.deployment\.kubernetes\.io/revision'