Diffing Local and Remote Resources
Diffing Local and Remote Resources
TL;DR
- View diff of changes before they are Applied to the cluster
Diffing Local and Cluster State
Motivation
The ability to view what changes will be made before applying them to a cluster can be useful.
Generating a Diff
Use the 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
The 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/
Exit status
The following exit values shall be returned:
0
No differences were found. 1
Differences were found. >1
Kubectl or diff failed with an error.
Note: KUBECTL_EXTERNAL_DIFF
, if used, is expected to follow that convention.
当前内容版权归 kubernetes官网 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 kubernetes官网 .