OC-SET-RESOURCES(1)

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

πŸ’… OC SET(1) β€” oc set resources

okay bestie, welcome to the oc set resources page from the Openshift CLI User Manuals ✨ pull up a chair, grab a boba, we're doing Kubernetes resource math together πŸ§‹


✨ NAME ✨

oc set resources β€” update those resource requests/limits on objects that have pod templates 🫢


✨ SYNOPSIS ✨

oc set resources [OPTIONS]

🌸 DESCRIPTION 🌸

So the whole point: you're specifying compute resource requirements (cpu, memory) for literally any resource that defines a pod template. And it's giving "reserved seating" energy β€” if a pod actually gets scheduled, it is guaranteed the amount of resource it requested, but it may burst up to its specified limits πŸ”₯

And here's a cute little default for you: for each compute resource, if a limit is specified and a request is omitted, the request will just default to the limit. no extra work required, she's self-sufficient πŸ’…

Possible resources include (and yes, case insensitive bestie, we don't gatekeep):

  • "ReplicationController"
  • "Deployment"
  • "DaemonSet"
  • "Job"
  • "ReplicaSet"
  • "DeploymentConfigs"

✨ OPTIONS ✨

  • --all=false β€” select all the resources, in the namespace of the specified resource types. go big or go home πŸ’–
  • --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 to golang and jsonpath output formats πŸŽ€
  • -c, --containers="*" β€” the names of containers in the selected pod templates to change. all containers are selected by default β€” and yes you may use wildcards, she's flexible like that 🌈
  • --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 πŸ‘€ lowkey a vibe check before you commit
  • --field-manager="kubectl-set" β€” name of the manager used to track field ownership 🏷️
  • -f, --filename=[] β€” filename, directory, or URL to files identifying the resource to get from a server πŸ“
  • -k, --kustomize="" β€” process the kustomization directory. this flag can't be used together with -f or -R 🚫
  • --limits="" β€” the resource requirement requests for this container. for example, 'cpu=100m,memory=256Mi'. note that server side components may assign requests depending on the server configuration, such as limit ranges πŸ“
  • --local=false β€” if true, set resources will NOT contact api-server but run locally 🏠 main character energy, staying home
  • -o, --output="" β€” output format. one of: (json, yaml, kyaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file) 🌸
  • -R, --recursive=false β€” process the directory used in -f, --filename recursively. useful when you want to manage related manifests organized within the same directory πŸ¦‹
  • --requests="" β€” the resource requirement requests for this container. for example, 'cpu=100m,memory=256Mi'. note that server side components may assign requests depending on the server configuration, such as limit ranges πŸ’œ
  • -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 β€” no partial credit, she's strict ✨
  • --show-managed-fields=false β€” if true, keep the managedFields when printing objects in JSON or YAML format πŸ™ˆ
  • --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] 🧚

πŸŽ€ OPTIONS INHERITED FROM PARENT COMMANDS πŸŽ€

like, these aren't hers, she inherited them, but they're still iconic πŸ‘‘

  • --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 ⚠️ bestie. please.
  • --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 🌟

okay these are literally the moves, copy them exactly, no freestyling ✨

# Set a deployments nginx container CPU limits to "200m and memory to 512Mi"
oc set resources deployment nginx -c=nginx --limits=cpu=200m,memory=512Mi

# Set the resource request and limits for all containers in nginx
oc set resources deployment nginx --limits=cpu=200m,memory=512Mi --requests=cpu=100m,memory=256Mi

# Remove the resource requests for resources on containers in nginx
oc set resources deployment nginx --limits=cpu=0,memory=0 --requests=cpu=0,memory=0

# Print the result (in YAML format) of updating nginx container limits locally, without hitting the server
oc set resources -f path/to/file.yaml --limits=cpu=200m,memory=512Mi --local -o yaml

πŸ¦‹ SEE ALSO πŸ¦‹


πŸ’œ HISTORY πŸ’œ

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


ngl that's the whole page, bestie β€” go forth and set those limits 🌸

okay that's a wrap on this one, brought to you by Openshift and the Openshift CLI User Manuals, dated June 2016 β€” slay, periodt πŸ’…βœ¨

πŸ“¦ where this page comes from