OC-SET-RESOURCES(1)
π 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 togolangandjsonpathoutput 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-for-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,--filenamerecursively. 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 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 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
- 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