A CLI tool to compare different revisions of Kubernetes resources.
Have you ever updated a Kubernetes deployment and wondered what changed between the previous and current version? kubecompare
is a command-line utility that helps users compare different revisions of Kubernetes deployments, daemonsets, or statefulsets to understand what changed between versions.
If you have Homebrew installed, you can install kubecompare
from our custom tap:
brew tap wozniakpl/kubecompare
brew install kubecompare
Clone the repository and build the application using Go:
git clone https://github.com/wozniakpl/kubecompare.git
cd kubecompare
go build -o kubecompare
kubecompare [ <resource-type> <resource-name> | <resource-type>/<resource-name> ] [ <previous-revision> <next-revision> ]
First, let's create some resource. Let's say it's a deployment:
$ kubectl create deployment nginx --image=nginx
Now, let's change the image in the deployment:
$ kubectl patch deployment nginx -p '{"spec":{"template":{"spec":{"containers":[{"name":"nginx","image":"busybox"}]}}}}'
Once it's done, we can see that we have two revisions available:
$ kubecompare deployment nginx
deployment.apps/nginx
REVISION CHANGE-CAUSE
1 <none>
2 <none>
And now we can see the diff:
$ kubecompare deployment nginx 1 2
--- /var/folders/ck/1k1429w513v98xw2r27pqmzw0000gn/T/revision3918300321 2023-10-02 21:04:46
+++ /var/folders/ck/1k1429w513v98xw2r27pqmzw0000gn/T/revision167025667 2023-10-02 21:04:46
@@ -1,10 +1,10 @@
-deployment.apps/nginx with revision #1
+deployment.apps/nginx with revision #2
Pod Template:
Labels: app=nginx
- pod-template-hash=748c667d99
+ pod-template-hash=5f6f57cd9
Containers:
nginx:
- Image: nginx
+ Image: busybox
Port: <none>
Host Port: <none>
Environment: <none>
This project is licensed under the MIT License - see the LICENSE file for details.