OC(1)

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

🌸 OC(1) β€” the openshift CLI manual, but make it make sense πŸ’…

okay bestie, so this is page one of the Openshift CLI User Manuals β€” the OC(1) one, from way back in June 2016 ✨ β€” and honestly? it's giving "main character energy" for anyone who wants to run an image on the cluster. let's get into it 🫢


✨ NAME ✨

oc run β€” run a particular image on the cluster πŸš€

✨ SYNOPSIS ✨

oc run [OPTIONS]

✨ DESCRIPTION ✨

Create and run a particular image in a pod. that's it. that's the whole vibe. πŸŽ€


✨ OPTIONS ✨

  • --allow-missing-template-keys=true β€” if true, ignore 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 me if you're using something else πŸ’€
  • --annotations=[] β€” annotations to apply to the pod. little sticky notes for your pod, love that 🌸
  • --attach=false β€” if true, wait for the Pod to start running, and then attach to the Pod as if 'kubectl attach ...' were called. default false, unless -i/--stdin is set, in which case the default is true. and with '--restart=Never' the exit code of the container process is returned 🫢
  • --cascade="background" β€” must be "background", "orphan", or "foreground". selects the deletion cascading strategy for the dependents (e.g. Pods created by a ReplicationController). defaults to background πŸ‘‘
  • --command=false β€” if true and extra arguments are present, use them as the 'command' field in the container, rather than the 'args' field which is the default. iykyk 😌
  • --dry-run="none" β€” must be "none", "server", or "client". if client strategy, only print the object that would be sent, without sending it. if server strategy, submit server-side request without persisting the resource. manifesting your pod without actually creating it ✨
  • --env=[] β€” environment variables to set in the container 🌈
  • --expose=false β€” if true, create a ClusterIP service associated with the pod. requires --port ⚠️ (yes, it really does, don't skip it)
  • --field-manager="kubectl-run" β€” name of the manager used to track field ownership 🏷️
  • -f, --filename=[] β€” to use to replace the resource.
  • --force=false β€” if true, immediately remove resources from API and bypass graceful deletion. > heads up bestie: immediate deletion of some resources may result in inconsistency or data loss and requires confirmation 😭 this one's lowkey scary fr fr
  • --grace-period=-1 β€” period of time in seconds given to the resource to terminate gracefully. ignored if negative. set to 1 for immediate shutdown. can only be set to 0 when --force is true (force deletion). give your pod a lil goodbye window πŸ•―οΈ
  • --image="" β€” the image for the container to run. arguably the whole point πŸ–ΌοΈ
  • --image-pull-policy="" β€” the image pull policy for the container. if left empty, this value will not be specified by the client and defaulted by the server πŸ€·β€β™€οΈ
  • -k, --kustomize="" β€” process a kustomization directory. this flag can't be used together with -f or -R. pick a lane πŸ’…
  • -l, --labels="" β€” comma separated labels to apply to the pod. will override previous values. no cap, it replaces them πŸ‘€
  • --leave-stdin-open=false β€” if the pod is started in interactive mode or with stdin, leave stdin open after the first attach completes. by default, stdin will be closed after the first attach completes πŸšͺ
  • -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, all iconic ⭐
  • --override-type="merge" β€” the method used to override the generated object: json, merge, or strategic 🧠
  • --overrides="" β€” an inline JSON override for the generated object. if this is non-empty, it is used to override the generated object. requires that the object supply a valid apiVersion field 🫑
  • --pod-running-timeout=0 β€” the length of time (like 5s, 2m, or 3h, higher than zero) to wait until at least one pod is running ⏳
  • --port="" β€” the port that this container exposes πŸ”Œ
  • --privileged=false β€” if true, run the container in privileged mode. use responsibly, bestie πŸ‘‘
  • -q, --quiet=false β€” if true, suppress prompt messages. shhh 🀫
  • -R, --recursive=false β€” process the directory used in -f, --filename recursively. useful when you want to manage related manifests organized within the same directory πŸ—‚οΈ
  • --restart="Always" β€” the restart policy for this Pod. legal values [Always, OnFailure, Never] πŸ”
  • --rm=false β€” if true, delete the pod after it exits. only valid when attaching to the container, e.g. with '--attach' or with -i/--stdin' 🧹
  • --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 πŸ“Œ
  • --show-managed-fields=false β€” if true, keep the managedFields when printing objects in JSON or YAML format πŸ‘€
  • -i, --stdin=false β€” keep stdin open on the container in the pod, even if nothing is attached 🫢
  • --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] 🧚
  • --timeout=0 β€” the length of time to wait before giving up on a delete, zero means determine a timeout from the size of the object ⏰
  • -t, --tty=false β€” allocate a TTY for the container in the pod πŸ’»
  • --wait=false β€” if true, wait for resources to be gone before returning. this waits for finalizers πŸ•°οΈ

✨ OPTIONS INHERITED FROM PARENT COMMANDS ✨

these are the ones you get handed down from the parent command, like a cute lil inheritance πŸ’œ

  • --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 insecure, bestie, be careful
  • --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 πŸŽ›οΈ
  • --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 ✨

like, just look at these, they ate πŸ”₯

# Start a nginx pod
oc run nginx --image=nginx

# Start a hazelcast pod and let the container expose port 5701
oc run hazelcast --image=hazelcast/hazelcast --port=5701

# Start a hazelcast pod and set environment variables "DNS_DOMAIN=cluster" and "POD_NAMESPACE=default" in the container
oc run hazelcast --image=hazelcast/hazelcast --env="DNS_DOMAIN=cluster" --env="POD_NAMESPACE=default"

# Start a hazelcast pod and set labels "app=hazelcast" and "env=prod" in the container
oc run hazelcast --image=hazelcast/hazelcast --labels="app=hazelcast,env=prod"

# Dry run; print the corresponding API objects without creating them
oc run nginx --image=nginx --dry-run=client

# Start a nginx pod, but overload the spec with a partial set of values parsed from JSON
oc run nginx --image=nginx --overrides='{ "apiVersion": "v1", "spec": { ... } }'

# Start a busybox pod and keep it in the foreground, don't restart it if it exits
oc run -i -t busybox --image=busybox --restart=Never

# Start the nginx pod using the default command, but use custom arguments (arg1 .. argN) for that command
oc run nginx --image=nginx -- <arg1> <arg2> ... <argN>

# Start the nginx pod using a different command and custom arguments
oc run nginx --image=nginx --command -- <cmd> <arg1> ... <argN>

✨ SEE ALSO ✨


✨ HISTORY ✨

June 2016, Ported from the Kubernetes man-doc generator 🌈


that's the whole page, bestie β€” go run some pods and slay πŸ’–βœ¨πŸ‘‘

signed off with love: Openshift β€” Openshift CLI User Manuals, page OC(1), dated June 2016 πŸ’œπŸŽ€πŸ¦‹

πŸ“¦ where this page comes from