OC(1)
π
OC(1) β the oc create glow-up guide β¨
okay so real talk, bestie: this is a page from the Openshift CLI User Manuals and it's literally all about oc create, dated June 2016, and honestly it still slays. let's get into it π
πΈ NAME πΈ
oc create β create a resource from a file or from stdin. that's it. that's the whole vibe. π
β¨ SYNOPSIS β¨
oc create [OPTIONS]
π¦ DESCRIPTION π¦
Create a resource from a file or from stdin.
JSON and YAML formats are accepted. both. either. iconic of them fr fr π
π OPTIONS π
--allow-missing-template-keys=trueβ iftrue, it just ignores any errors in templates when a field or map key is missing in the template. ngl this only applies togolangandjsonpathoutput formats, so don't come for it elsewhere π--dry-run="none"β must be"none","server", or"client". if it's the client strategy, it only prints the object that would be sent, without actually sending it β practice mode, no commitment β¨. if it's the server strategy, it submits a server-side request without persisting the resource. look but don't touch energy π--edit=falseβ edit the API resource before creating it. main character editing arc π¬--field-manager="kubectl-create"β name of the manager used to track field ownership. yes the default is literallykubectl-create, don't ask, it's giving crossover episode π«Ά-f,--filename=[]β filename, directory, or URL to files to use to create the resource. yes you read that right, URL is allowed, we're flexible π-k,--kustomize=""β process the kustomization directory. warning though: this flag can't be used together with-for-R. pick a lane bestie π-o,--output=""β output format. one of: (json,yaml,kyaml,name,go-template,go-template-file,template,templatefile,jsonpath,jsonpath-as-json,jsonpath-file). so many options and every single one is valid, we love a versatile queen π--raw=""β raw URI to POST to the server. uses the transport specified by the kubeconfig file. straight to the point, no filter π₯-R,--recursive=falseβ process the directory used in-f,--filenamerecursively. useful when you want to manage related manifests organized within the same directory. it's giving organized folders, it's giving clean desk πΈ--save-config=falseβ iftrue, 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 β future-proofing yourself, we stan a planner π-l,--selector=""β selector (label query) to filter on, supports=,==,!=,in,notin. (e.g.-l key1=value1,key2=value2,key3 in (value3)β there's a literal space inkey3 in (value3), yes really, copy it exactly, do not "fix" it π« ). matching objects must satisfy all of the specified label constraints. all of them. every single one. no half-credit π--show-managed-fields=falseβ iftrue, keep themanagedFieldswhen printing objects in JSON or YAML format. otherwise they get hidden away like a secret π΅οΈ--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]. go read the docs, I believe in you π§--validate="ignore"β must be one of:strict(ortrue),warn,ignore(orfalse). let me break it down because this one's a whole saga:"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. silent. dropping. gone. π«₯
--windows-line-endings=falseβ only relevant if--edit=true. defaults to the line ending native to your platform. yes it's about\r\nvs\n, no we're not getting into it π
π OPTIONS INHERITED FROM PARENT COMMANDS π
these came from the parent command, they're the nepo babies of the flag world and honestly? they earned it π
--as=""β username to impersonate for the operation. user could be a regular user or a service account in a namespace. cosplay, but productive π--as-group=[]β group to impersonate for the operation. this flag can be repeated to specify multiple groups. collect them all β¨--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. repetition is allowed and encouraged π«Ά--cache-dir="/homeless-shelter/.kube/cache"β default cache directory. yes the path really is/homeless-shelter/.kube/cache, that's not a typo and I'm as shook as you are π--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. uncompressed and unbothered π--insecure-skip-tls-verify=falseβ iftrue, the server's certificate will not be checked for validity. major warning bestie: this will make your HTTPS connections insecure. like, actually insecure. do not do this casually π--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. two whole ways to turn it off, choose your fighter π--match-server-version=falseβ require server version to match client version. β¨ standards β¨-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). pick your pokΓ©mon π₯--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 β zero means forever, and forever is a long time, just so you know π«-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. harsh but fair π
π EXAMPLE π
lowkey the examples are the best part, look at these:
# Create a pod using the data in pod.json
oc create -f ./pod.json
# Create a pod based on the JSON passed into stdin
cat pod.json | oc create -f -
# Edit the data in registry.yaml in JSON then create the resource using the edited data
oc create -f registry.yaml --edit -o json
see how the second one pipes into -f -? that's the stdin slay. and the third one? edit then create. glow-up in real time π
π§ SEE ALSO π§
go read these next, they're all in the same friend group:
oc(1), oc-create-build(1), oc-create-clusterresourcequota(1), oc-create-clusterrole(1), oc-create-clusterrolebinding(1), oc-create-configmap(1), oc-create-cronjob(1), oc-create-deployment(1), oc-create-deploymentconfig(1), oc-create-identity(1), oc-create-imagestream(1), oc-create-imagestreamtag(1), oc-create-ingress(1), oc-create-job(1), oc-create-namespace(1), oc-create-poddisruptionbudget(1), oc-create-priorityclass(1), oc-create-quota(1), oc-create-role(1), oc-create-rolebinding(1), oc-create-route(1), oc-create-secret(1), oc-create-service(1), oc-create-serviceaccount(1), oc-create-token(1), oc-create-user(1), oc-create-useridentitymapping(1)
π HISTORY π
June 2016, ported from the Kubernetes man-doc generator. a classic, an original, a starter pack icon π
and that's the whole page bestie, every flag accounted for, nothing skipped, nothing invented π β¨
kisses from the Openshift fam β Openshift CLI User Manuals, dated June 2016. drink water, verify your TLS, and don't use --insecure-skip-tls-verify for no reason π«ΆπΈ
π¦ 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