⎈ k8s knowledge compiler

kubectl diff [page]deterministic

Diff the live version against a would-be applied version

reference

##

Diff configurations specified by file name or stdin between the current online configuration, and the configuration as it would be if applied.

The output is always YAML.

KUBECTL_EXTERNAL_DIFF environment variable can be used to select your own diff command. Users can use external commands with params too, example: KUBECTL_EXTERNAL_DIFF="colordiff -N -u"

By default, the "diff" command available in your path will be run with the "-u" (unified diff) and "-N" (treat absent files as empty) options.

Exit status: 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.

``` kubectl diff -f FILENAME ```

##

``` # Diff resources included in pod.json kubectl diff -f pod.json # Diff file read from stdin cat service.yaml | kubectl diff -f - ```

##

<table style="width: 100%; table-layout: fixed;"> <colgroup> <col span="1" style="width: 10px;" /> <col span="1" /> </colgroup> <tbody>

<tr> <td colspan="2">--concurrency int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: 1</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Number of objects to process in parallel when diffing against the live version. Larger number = faster, but more memory, I/O and CPU over that shorter period of time.</p></td> </tr>

<tr> <td colspan="2">--field-manager string&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Default: "kubectl-client-side-apply"</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Name of the manager used to track field ownership.</p></td> </tr>

<tr> <td colspan="2">-f, --filename strings</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Filename, directory, or URL to files contains the configuration to diff</p></td> </tr>

<tr> <td colspan="2">--force-conflicts</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>If true, server-side apply will force the changes against conflicts.</p></td> </tr>

<tr> <td colspan="2">-h, --help</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>help for diff</p></td> </tr>

<tr> <td colspan="2">-k, --kustomize string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Process the kustomization directory. This flag can't be used together with -f or -R.</p></td> </tr>

<tr> <td colspan="2">--prune</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Include resources that would be deleted by pruning. Can be used with -l and default shows all resources would be pruned</p></td> </tr>

<tr> <td colspan="2">--prune-allowlist strings</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Overwrite the default allowlist with &lt;group/version/kind&gt; for --prune</p></td> </tr>

<tr> <td colspan="2">-R, --recursive</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Process the directory used in -f, --filename recursively. Useful when you want to manage related manifests organized within the same directory.</p></td> </tr>

<tr> <td colspan="2">-l, --selector string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Selector (label query) to filter on, supports '=', '==', '!=', 'in', 'notin'.(e.g. -l key1=value1,key2=value2,key3 in (value3)). Matching objects must satisfy all of the specified label constraints.</p></td> </tr>

<tr> <td colspan="2">--server-side</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>If true, apply runs in the server instead of the client.</p></td> </tr>

<tr> <td colspan="2">--show-managed-fields</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>If true, include managed fields in the diff.</p></td> </tr>

<tr> <td colspan="2">--show-secrets</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: b …(trimmed)

Sources

reference/kubectl/generated/kubectl_diff/_index.md · dockubectl diff

Related (5)

part_of {{% heading "synopsis" %}}describes conf=1
part_of {{% heading "examples" %}}describes conf=1
part_of {{% heading "options" %}}describes conf=1
part_of {{% heading "parentoptions" %}}describes conf=1
part_of {{% heading "seealso" %}}describes conf=1

← all Docs