kubectl autoscale [page]deterministic
Auto-scale a deployment, replica set, stateful set, or replication controller
##
Creates an autoscaler that automatically chooses and sets the number of pods that run in a Kubernetes cluster. The command will attempt to use the autoscaling/v2 API first, in case of an error, it will fall back to autoscaling/v1 API.
Looks up a deployment, replica set, stateful set, or replication controller by name and creates an autoscaler that uses the given resource as a reference. An autoscaler can automatically increase or decrease number of pods deployed within the system as needed.
``` kubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu=CPU] [--memory=MEMORY] ```
##
``` # Auto scale a deployment "foo", with the number of pods between 2 and 10, no target CPU utilization specified so a default autoscaling policy will be used kubectl autoscale deployment foo --min=2 --max=10 # Auto scale a replication controller "foo", with the number of pods between 1 and 5, target CPU utilization at 80% kubectl autoscale rc foo --max=5 --cpu=80% # Auto scale a deployment "bar", with the number of pods between 3 and 6, target average CPU of 500m and memory of 200Mi kubectl autoscale deployment bar --min=3 --max=6 --cpu=500m --memory=200Mi # Auto scale a deployment "bar", with the number of pods between 2 and 8, target CPU utilization 60% and memory utilization 70% kubectl autoscale deployment bar --min=3 --max=6 --cpu=60% --memory=70% ```
##
<table style="width: 100%; table-layout: fixed;"> <colgroup> <col span="1" style="width: 10px;" /> <col span="1" /> </colgroup> <tbody>
<tr> <td colspan="2">--allow-missing-template-keys Default: true</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>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.</p></td> </tr>
<tr> <td colspan="2">--cpu string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Target CPU utilization over all the pods. When specified as a percentage (e.g."70%" for 70% of requested CPU) it will target average utilization. When specified as quantity (e.g."500m" for 500 milliCPU) it will target average value. Value without units is treated as a quantity with miliCPU being the unit (e.g."500" is "500m").</p></td> </tr>
<tr> <td colspan="2">--dry-run string[="unchanged"] Default: "none"</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>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.</p></td> </tr>
<tr> <td colspan="2">--field-manager string Default: "kubectl-autoscale"</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Name of the manager used to track field ownership.</p></td> </tr>
<tr> <td colspan="2">-f, --filename strings</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Filename, directory, or URL to files identifying the resource to autoscale.</p></td> </tr>
<tr> <td colspan="2">-h, --help</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>help for autoscale</p></td> </tr>
<tr> <td colspan="2">-k, --kustomize string</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>Process the kustomization directory. This flag can't be used together with -f or -R.</p></td> </tr>
<tr> <td colspan="2">--max int32 Default: -1</td> </tr> <tr> <td></td><td style="line-height: 130%; word-wrap: break-word;"><p>The upper limit for the number of pods that can be set by the autoscaler. Required.</p></td> </tr>
<tr> <td colspan="2">--memory string</td> </tr> <tr> <td>< …(trimmed)