Interview Prep/Kubernetes/Cluster operations: certs, drains, rollouts and quotas

`kubectl rollout undo deploy/api` says `error: no rollout history found for deployment "api"` or rolls back to the wrong version.

IntermediateTroubleshootingCluster operations: certs, drains, rollouts and quotas
Answer

Likely causes → revisionHistoryLimit: 0 (or very low) deleted old ReplicaSets, so there is nothing to roll back to. Wrong version: undo goes to the previous revision, which may itself be a bad one, or revisions created by a config-only change.

Diagnose →

kubectl rollout history deploy/api
kubectl rollout history deploy/api --revision=7
kubectl get deploy api -o jsonpath='{.spec.revisionHistoryLimit}{"\n"}'

Fix → Roll back to a specific revision (kubectl rollout undo deploy/api --to-revision=7), or redeploy the known-good image tag from Git, which is the real source of truth.

Prevent → Keep revisionHistoryLimit at the default 10; in GitOps roll back by reverting the commit.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Cluster operations: certs, drains, rollouts and quotas