OC(1)
π OC(1) β the oc diff glow-up
okay bestie, pull up a chair because we're talking about oc diff from the OpenShift CLI user manual, and honestly? it's giving "let me show you the future before you commit to it" energy π
β¨ NAME β¨
oc diff β diff the live version against a would-be applied version π¦
πΈ SYNOPSIS πΈ
oc diff [OPTIONS]
π DESCRIPTION π
So here's the vibe: oc diff diffs the configurations you point it at β either by file name or from stdin β between the current online configuration and the configuration as it would be if applied β¨. Like a sneak peek. A preview. A little trailer before the movie drops π¬
The output is always YAML. no cap. π«Ά
You can also bring your own diff tool with the KUBECTL_EXTERNAL_DIFF environment variable. And yes, you can absolutely pass params to external commands too β for example:
KUBECTL_EXTERNAL_DIFF="colordiff -N -u"
By default, whatever diff command is chillin' in your path gets run with the -u (unified diff) and -N (treat absent files as empty) options β¨
Exit status tea β: 0 = no differences were found. 1 = differences were found. >1 = kubectl or diff failed with an error π
Note bestie: if you use KUBECTL_EXTERNAL_DIFF, it's expected to follow that convention. iykyk π
π OPTIONS π
--concurrency=1β number of objects to process in parallel when diffing against the live version. bigger number = faster, but more memory, I/O and CPU crammed into that shorter window of time π₯--field-manager="kubectl-client-side-apply"β the name of the manager used to track field ownership π-f,--filename=[]β filename, directory, or URL to files containing the configuration to diff π--force-conflicts=falseβ iftrue, server-side apply will force the changes against conflicts π₯-k,--kustomize=""β process the kustomization directory. heads up: this flag can't be used together with-for-Rπ--prune=falseβ include resources that would be deleted by pruning. can be used with-l, and by default shows all resources that would be pruned π--prune-allowlist=[]β overwrite the default allowlist with<group/version/kind>for--pruneβ-R,--recursive=falseβ process the directory used in-f,--filenamerecursively. so useful when you want to manage related manifests organized within the same directory π§-l,--selector=""β 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 β¨--server-side=falseβ iftrue, apply runs in the server instead of the client π--show-managed-fields=falseβ iftrue, include managed fields in the diff π
π OPTIONS INHERITED FROM PARENT COMMANDS π
these are the family heirlooms, passed down from the parent command, we love a legacy π
--as=""β username to impersonate for the operation. user could be a regular user or a service account in a namespace π«Ά--as-group=[]β group to impersonate for the operation; this flag can be repeated to specify multiple groups π―--as-uid=""β UID to impersonate for the operation β--as-user-extra=[]β user extras to impersonate for the operation; this flag can be repeated to specify multiple values for the same key π--cache-dir="/homeless-shelter/.kube/cache"β default cache directory π--certificate-authority=""β path to a cert file for the certificate authority π--client-certificate=""β path to a client certificate file for TLS π--client-key=""β path to a client key file for TLS π--cluster=""β the name of the kubeconfig cluster to use βοΈ--context=""β the name of the kubeconfig context to use πΈ--disable-compression=falseβ iftrue, opt-out of response compression for all requests to the server π¦--insecure-skip-tls-verify=falseβ iftrue, the server's certificate will not be checked for validity. this will make your HTTPS connections insecure β yes, actually insecure, take that seriously bestie π--kubeconfig=""β path to the kubeconfig file to use for CLI requests ποΈ--kuberc=""β path to the kuberc file to use for preferences. this can be disabled by exporting theKUBECTL_KUBERC=falsefeature gate or turning off the featureKUBERC=offπ§--match-server-version=falseβ require server version to match client version πͺ-n,--namespace=""β if present, the namespace scope for this CLI request π--profile="none"β name of profile to capture. one of(none|cpu|heap|goroutine|threadcreate|block|mutex)π--profile-output="profile.pprof"β name of the file to write the profile to πΎ--request-timeout="0"β the length of time to wait before giving up on a single server request. non-zero values should contain a corresponding time unit (e.g.1s,2m,3h). a value of zero means don't timeout requests β³-s,--server=""β the address and port of the Kubernetes API server π°οΈ--tls-server-name=""β server name to use for server certificate validation. if it is not provided, the hostname used to contact the server is used π·οΈ--token=""β bearer token for authentication to the API server ποΈ--user=""β the name of the kubeconfig user to use π€--warnings-as-errors=falseβ treat warnings received from the server as errors and exit with a non-zero exit code β dramatic but valid π
π EXAMPLE π
# Diff resources included in pod.json
oc diff -f pod.json
# Diff file read from stdin
cat service.yaml | oc diff -f -
π SEE ALSO π
π HISTORY π
June 2016, ported from the Kubernetes man-doc generator π
and that's the whole page, bestie β iconic, honestly. this gem lives in the Openshift CLI User Manuals, brought to you by Openshift, dated June 2016 β¨ periodt π π¦
π¦ where this page comes from
- nixpkgs unstable: openshift 4.22.0-202605222050
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms