OC(1)

πŸ“¦
version 4.22.0 Β· 2 versions
, in nixpkgs unstable

πŸ’… 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 β€” if true, it just ignores any errors in templates when a field or map key is missing in the template. ngl this only applies to golang and jsonpath output 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 literally kubectl-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 -f or -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, --filename recursively. 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 β€” 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 perform kubectl apply on 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 in key3 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 β€” if true, keep the managedFields when 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 (or true), warn, ignore (or false). 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 if ServerSideFieldValidation is 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\n vs \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 β€” if true, opt-out of response compression for all requests to the server. uncompressed and unbothered πŸ’€
  • --insecure-skip-tls-verify=false β€” if true, 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 exporting KUBECTL_KUBERC=false feature gate or turning off the feature KUBERC=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