<p>I have Kubernetes cluster hosted in Google Cloud. I created a deployment and defined a hpa rule for it:</p>

<pre><code>kubectl autoscale deployment my_deployment --min 6 --max 30 --cpu-percent 80
</code></pre>

<p>I want to run a command that editing the <code>--min</code> value, <strong>without remove and re-create a new hpa rule</strong>. Something like: </p>

<pre><code>$ kubectl autoscale deployment my_deployment --min 1 --max 30
Error from server (AlreadyExists): horizontalpodautoscalers.autoscaling "my_deployment" already exists
</code></pre>

<p>Is this possible to edit hpa (min, max, cpu-percent, ...) on command line?</p>

No1Lives4Ever
<blockquote>
  <p>Is this possible to edit hpa (min, max, cpu-percent, ...) on command line?</p>
</blockquote>

<p>They are editable just as any other resource is, though either <code>kubectl edit hpa $the_hpa_name</code> for an interactive edit, or <code>kubectl patch hpa $the_hpa_name -p '{"spec":{"minReplicas": 1}}'</code> for doing so in a "batch" setting.</p>

<p>If you don't know the <code>$the_hpa_name</code>, you can get a list of them like any other resource: <code>kubectl get hpa</code>, and similarly you can view the current settings and status with <code>kubectl get -o yaml hpa $the_hpa_name</code> (or even omit <code>$the_hpa_name</code> to see them all, but that might be a lot of text, depending on your cluster setup).</p>
