OC(1)
π
OC(1) β the oc girlies' manual, bestie edition π
okay so this is the manual page for oc, from the Openshift CLI User Manuals, dated June 2016. We're gonna talk about the edit subcommand specifically, and I promise it's gonna slay.
β¨ NAME β¨
oc edit β edit a resource on the server, bestie. That's it. That's the whole vibe.
πΈ SYNOPSIS πΈ
oc edit [OPTIONS]
π¦ DESCRIPTION π¦
So like, oc edit lets you edit a resource straight from your default editor. Iconic behavior honestly.
The edit command is literally the easiest way to directly edit any API resource you can retrieve via the command-line tools. It opens the editor defined by your KUBE_EDITOR or EDITOR environment variables, or falls back to vi on Linux or notepad on Windows. And when it's trying to open that editor, it first attempts to use the shell defined in your SHELL environment variable. If SHELL isn't set, it uses the default shell β '/bin/bash' for Linux or 'cmd' for Windows. no cap.
You can edit multiple objects, but heads up: changes are applied one at a time. The command accepts file names as well as command-line arguments, but the files you point to must be previously saved versions of resources. k? π
Editing is done with the API version used to fetch the resource. If you wanna edit using a specific API version, fully-qualify the resource, version, and group. periodt.
The default format is YAML. To edit in JSON, specify "-o json".
The flag --windows-line-endings can be used to force Windows line endings β otherwise the default for your operating system will be used. π
π«Ά Real talk: in the event an error occurs while updating, a temporary file will be created on disk that contains your unapplied changes. The most common error when updating a resource is another editor changing the resource on the server. When that happens, you'll have to apply your changes to the newer version of the resource, or update your temporary saved copy to include the latest resource version. Not me crying over merge conflicts π
π OPTIONS π
--allow-missing-template-keys=trueβ if true, ignore any errors in templates when a field or map key is missing in the template. Only applies togolangandjsonpathoutput formats.--field-manager="kubectl-edit"β name of the manager used to track field ownership.-f,--filename=[]β filename, directory, or URL to files to use to edit the resource.-k,--kustomize=""β process the kustomization directory. This flag can't be used together with-for-R. π«-o,--output=""β output format. One of: (json,yaml,kyaml,name,go-template,go-template-file,template,templatefile,jsonpath,jsonpath-as-json,jsonpath-file).--output-patch=falseβ output the patch if the resource is edited.-R,--recursive=falseβ process the directory used in-f,--filenamerecursively. Useful when you want to manage related manifests organized within the same directory. β¨--save-config=falseβ if true, the configuration of current object will be saved in its annotation. Otherwise, the annotation will be unchanged. This flag is useful when you want to performkubectl applyon this object in the future.--show-managed-fields=falseβ if true, keep themanagedFieldswhen printing objects in JSON or YAML format.--subresource=""β if specified, edit will operate on the subresource of the requested object.--template=""β template string or path to template file to use when-o=go-template,-o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].--validate="ignore"β must be one of:strict(ortrue),warn,ignore(orfalse)."true"or"strict"will use a schema to validate the input and fail the request if invalid. It will perform server side validation ifServerSideFieldValidationis enabled on the api-server, but will fall back to less reliable client-side validation if not."warn"will warn about unknown or duplicate fields without blocking the request if server-side field validation is enabled on the API server, and behave as"ignore"otherwise."false"or"ignore"will not perform any schema validation, silently dropping any unknown or duplicate fields. β οΈ--windows-line-endings=falseβ defaults to the line ending native to your platform.
π OPTIONS INHERITED FROM PARENT COMMANDS π
like, these come from the parent command, so they're not even edit's own, but they're here and they're valid π
--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β if true, opt-out of response compression for all requests to the server.--insecure-skip-tls-verify=falseβ if true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure. π¨ like, actually be careful with this one 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 exportingKUBECTL_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.
π« EXAMPLE π«
okay these are the vibes, run them exactly like this:
# Edit the service named 'registry'
oc edit svc/registry
# Use an alternative editor
KUBE_EDITOR="nano" oc edit svc/registry
# Edit the job 'myjob' in JSON using the v1 API format
oc edit job.v1.batch/myjob -o json
# Edit the deployment 'mydeployment' in YAML and save the modified config in its annotation
oc edit deployment/mydeployment -o yaml --save-config
# Edit the 'status' subresource for the 'mydeployment' deployment
oc edit deployment mydeployment --subresource='status'
ate. no crumbs. π₯
π§ SEE ALSO π§
oc(1) β go read the big one too, iykyk π
β HISTORY β
June 2016, ported from the Kubernetes man-doc generator. vintage, honestly.
and that's the whole page, bestie π«Άπβ¨ this cutie came to you from Openshift β the Openshift CLI User Manuals β as OC(1), dated June 2016. stan. ππ
π¦ 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