De-clutter your kubectl diff
output using kubectl-neat (looking at you, managedFields
):
You can try go get
:
$ GO111MODULE=on go get github.com/sh0rez/kubectl-neat-diff
If that doesn't work, clone and build manually:
$ git clone https://github.com/sh0rez/kubectl-neat-diff
$ cd kubectl-neat-diff
$ make install
Arch Linux users can also use the AUR package.
To use, set it as your KUBECTL_EXTERNAL_DIFF
tool:
# append to ~/.bashrc or similar:
export KUBECTL_EXTERNAL_DIFF=kubectl-neat-diff
Newer Kubernetes versions (1.18+) add a jungle of keys to any YAML / JSON output that roughly looks like this:
managedFields:
- apiVersion: apps/v1
fieldsType: FieldsV1
fieldsV1:
f:metadata:
f:annotations:
.: {}
f:kubectl.kubernetes.io/last-applied-configuration: {}
f:labels:
.: {}
f:app: {}
f:spec:
f:progressDeadlineSeconds: {}
f:replicas: {}
f:revisionHistoryLimit: {}
f:selector: {}
f:strategy:
f:rollingUpdate:
.: {}
f:maxSurge: {}
f:maxUnavailable: {}
f:type: {}
f:template:
f:metadata:
f:labels:
.: {}
f:app: {}
f:spec:
f:containers:
k:{"name":"nginx"}:
.: {}
f:image: {}
f:imagePullPolicy: {}
f:name: {}
f:ports:
.: {}
k:{"containerPort":8888,"protocol":"TCP"}:
.: {}
f:containerPort: {}
f:protocol: {}
f:resources: {}
f:terminationMessagePath: {}
f:terminationMessagePolicy: {}
f:dnsPolicy: {}
f:restartPolicy: {}
f:schedulerName: {}
f:securityContext: {}
f:terminationGracePeriodSeconds: {}
This all has reasons and is probably a nice thing, but frankly spoken, most of us don't care and don't want to see it all the time:
- Upstream issue: kubernetes/kubernetes#90066
- PR to remove it from
kubectl get
: kubernetes/kubernetes#96878 (review) - People ranting on Twitter:
kubectl-neat is nice tool that cleans up the kubectl get
output, but unfortunately does not support doing the same for diff. This small project enables it to do so.
All the hard work is done by kubectl-neat. Go, give them a star!
Licensed under the Apache-v2 license