OC(1)
π
OC(1) β the oc scale glow-up, bestie β¨
okay so real talk, this is the OpenShift CLI User Manuals page for oc scale, and it's genuinely one of the most useful little commands in the whole oc universe. Sit down, grab a strawberry drink π, we're learning how to resize stuff.
πΈ NAME πΈ
oc scale β the way you set a brand-new size for a deployment, replica set, or replication controller. literally that's the whole assignment π
β¨ SYNOPSIS β¨
oc scale [OPTIONS]
π¦ DESCRIPTION π¦
So what this does is: set a new size for a deployment, replica set, replication controller, or stateful set. one number in, vibes out. no cap.
And here's the cute part β scale also lets you specify one or more preconditions for the scale action π like, "only do this if the current situation is exactly what I think it is."
If you pass --current-replicas or --resource-version, that gets validated before the scale is attempted, and it is guaranteed that the precondition holds true when the scale is sent to the server. so it's not just vibes, it's verified vibes. π₯
π OPTIONS π
--all=falseβ select all resources in the namespace of the specified resource types. everything. the whole group chat π--allow-missing-template-keys=trueβ iftrue, ignore any errors in templates when a field or map key is missing in the template. only applies togolangandjsonpathoutput formats. so forgiving, we love her π«Ά--current-replicas=-1β precondition for current size. requires that the current size of the resource match this value in order to scale.-1(the default) means no condition at all. default = unbothered, moisturized, in her lane β¨--dry-run="none"β must be"none","server", or"client". if it's the client strategy, only print the object that would be sent, without sending it. if it's the server strategy, submit the server-side request without persisting the resource. it's giving "let me rehearse the text before I send it" π-f,--filename=[]β filename, directory, or URL to files identifying the resource to set a new size. yes bestie, a URL counts, we're flexible π¦-k,--kustomize=""β process the kustomization directory. this flag can't be used together with-for-R. it's an exclusive little icon, pick one π-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 flavors, pick your favorite π-R,--recursive=falseβ process the directory used in-f,--filenamerecursively. useful when you want to manage related manifests organized within the same directory. she goes deep π--replicas=0β the new desired number of replicas. required. like, this is the whole point, don't forget her π--resource-version=""β precondition for resource version. requires that the current resource version match this value in order to scale. another safety rail, we stan a cautious queen π«Ά-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 β every single one, no skipping π₯--show-managed-fields=falseβ iftrue, keep themanagedFieldswhen printing objects inJSONorYAMLformat. for the girlies who need every detail π--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β© ]. fancy β¨--timeout=0β the length of time to wait before giving up on a scale operation. zero means don't wait. any other values should contain a corresponding time unit (e.g.1s,2m,3h). patience is a unit, and honestly0has none π
π§ OPTIONS INHERITED FROM PARENT COMMANDS π§
these aren't oc scale's own flags β they're handed down from the parent command like a family heirloom π
--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. stack 'em π--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. repeat icon π--cache-dir="/homeless-shelter/.kube/cache"β default cache directory. yes, that path is exactly as written, don't @ me π--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. this will make your HTTPS connections insecure. β οΈ redirecting your attention to this one, bestie, it's literally in the name.--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. iykyk π¦--match-server-version=falseβ require server version to match client version. matching outfits, but for software π-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. strict queen behavior π
π EXAMPLE π
okay here's where it gets good, these are literally copy-paste ready:
# Scale a replica set named 'foo' to 3
oc scale --replicas=3 rs/foo
# Scale a resource identified by type and name specified in "foo.yaml" to 3
oc scale --replicas=3 -f foo.yaml
# If the deployment named mysql's current size is 2, scale mysql to 3
oc scale --current-replicas=2 --replicas=3 deployment/mysql
# Scale multiple replication controllers
oc scale --replicas=5 rc/example1 rc/example2 rc/example3
# Scale stateful set named 'web' to 3
oc scale --replicas=3 statefulset/web
the third one is my personal main character β it only scales mysql if she's currently at 2. conditional slay π₯
π SEE ALSO π
oc(1)β the mothership. go say hi π
π HISTORY π
June 2016, ported from the Kubernetes man-doc generator. vintage. a classic. she's been iconic since 2016 π
ngl bestie, the only thing you really have to remember is --replicas is required. everything else is seasoning π§β¨
and that's the page!! brought to you by Openshift β Openshift CLI User Manuals β dated June 2016 π«Ά go scale something, you got this π
π¦ 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