🚀 Time-travel through your workload revision history 🕰️
kubectl-revisions
is a kubectl plugin and can be invoked as kubectl revisions
, or for short k revisions
.
The revisions
plugin allows you to go back in time in the history of revisions and answers common questions like "Why was my Deployment rolled?"
It gives more output than kubectl rollout history
and is easier to use than kubectl get replicaset
or kubectl get controllerrevision
.
Using krew (recommended):
kubectl krew install revisions
Using go:
go install github.com/timebertt/kubectl-revisions@latest
Set up shell completion (docs):
kubectl revisions completion -h
Also see the reference docs.
Get the revision history of a workload resource (Deployment
, StatefulSet
, or DaemonSet
).
The history is based on the ReplicaSets
/ControllerRevisions
still in the system. I.e., the history is limited by the
configured revisionHistoryLimit
.
By default, all revisions are printed as a list. If the --revision
flag is given, the selected revision is printed
instead.
This is similar to using k get replicaset
or k get controllerrevision
, but allows easy selection of the relevant objects and returns a sorted list.
This is also similar to k rollout history
, but doesn't only print revision numbers.
Compare multiple revisions of a workload resource (Deployment
, StatefulSet
, or DaemonSet
).
A.k.a., "Why was my Deployment rolled?"
The history is based on the ReplicaSets
/ControllerRevisions
still in the system. I.e., the history is limited by the
configured revisionHistoryLimit
.
By default, the latest two revisions are compared. The --revision
flag allows selecting the revisions to compare.
The k revisions diff
command uses diff -u -N
to compare revisions by default.
It also respects the KUBECTL_EXTERNAL_DIFF
environment variable like the kubectl diff
command.
To get a nicer diff output, you can use one of these:
# Use a colored external diff program
export KUBECTL_EXTERNAL_DIFF="colordiff -u"
# Use dyff as a rich diff program
export KUBECTL_EXTERNAL_DIFF="dyff between --omit-header"
# Show diff in VS Code
export KUBECTL_EXTERNAL_DIFF="code --diff --wait"
For example: