Diffing Local and Remote Resources
- View diff of changes before they are Applied to the cluster
Diffing Local and Cluster State
The ability to view what changes will be made before applying them to a cluster can be useful.
Generating a Diff
diff program in a user’s path to display a diff of the changes that will be
made by Apply.
kubectl diff -k ./dir/
Setting the Diff Program
KUBECTL_EXTERNAL_DIFF environment variable can be used to select your own diff command.
By default, the “diff” command available in your path will be run with “-u” (unified) and “-N”
(treat new files as empty) options.
export KUBECTL_EXTERNAL_DIFF=meld; kubectl diff -k ./dir/
The following exit values shall be returned:
No differences were found.
Differences were found.
Kubectl or diff failed with an error.
KUBECTL_EXTERNAL_DIFF, if used, is expected to follow that convention.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.