<p>I have created a <a href="http://kubernetes.io/v1.1/docs/user-guide/horizontal-pod-autoscaler.html" rel="noreferrer">Kubernetes autoscaler</a>, but I need to change its parameters. How do I update it?</p>

<p>I've tried the following, but it fails:</p>

<pre><code>✗ kubectl autoscale -f docker/production/web-controller.yaml --min=2 --max=6
Error from server: horizontalpodautoscalers.extensions "web" already exists
</code></pre>

<p>You can always interactively edit the resources in your cluster. For your autoscale controller called <code>web</code>, you can edit it via:</p>

<pre><code>kubectl edit hpa web
</code></pre>

<p>If you're looking for a more programmatic way to update your horizontal pod autoscaler, you would have better luck describing your autoscaler entity in a yaml file, as well. For example, here's a simple Replication Controller, paired with a Horizontal Pod Autoscale entity:</p>

<pre><code> apiVersion: v1
 kind: ReplicationController
 metadata:
   name: nginx
 spec:
   replicas: 2
   template:
     metadata:
       labels:
         run: nginx
     spec:
       containers:
       - name: nginx
         image: nginx
         ports:
         - containerPort: 80
 ---
 apiVersion: autoscaling/v1
 kind: HorizontalPodAutoscaler
 metadata:
   name: nginx
   namespace: default
 spec:
   maxReplicas: 3
   minReplicas: 2
   scaleTargetRef:
     apiVersion: v1
     kind: ReplicationController
     name: nginx
</code></pre>

<p>With those contents in a file called <code>nginx.yaml</code>, updating the autoscaler could be done via <code>kubectl apply -f nginx.yaml</code>.</p>
