<p>After long playing with it and consulting on slack DevOps chat, I was able to figure it out. Here is a workable curl: </p>

<pre><code>curl -sSk -H \"Authorization: Bearer ${KUBE_TOKEN}\" -H 'Content-Type: application/merge-patch+json' -X 'PATCH' $URL_NAME/api/v1/namespaces/kube-system/replicationcontrollers/kube-registry-v0 -d '{"spec": {"replicas":  1}}'
</code></pre>

<p>One of the important components here is "<code>Content-Type: application/merge-patch+json</code>" Without it specification, Kubernetes will not recognize data in API request correctly. </p>

CC BY-SA 3.0
2018-01-25T10:53:19.527Z
2018-01-25T10:53:19.527Z
user54
<p>Is there a way to scale replication controller via API in kubernetes. </p>

<p>By using kubeclt command, it may be done by running: </p>

<pre><code>kubectl scale --replicas=1 --namespace=kube-system rc my_replication_controller
</code></pre>

<p>But how to achieve it using API? </p>

<p>Moving through docs, I found only "replace scale of the specified Scale" and "partially update scale of the specified Scale" among write operations. But I think this is not what I need.  </p>

CC BY-SA 3.0
2018-01-30T07:43:20.940Z
In general, you can use the `--v=9` flag of `kubectl` to see which API call it uses.
jofel
<kubernetes>
Scaling replication controllers via API in Kubernetes
user54
# Scaling replication controllers via API in Kubernetes

(Asked by: username_0 on 2018-01-24)

Is there a way to scale replication controller via API in kubernetes. 
By using kubeclt command, it may be done by running: 
kubectl scale --replicas=1 --namespace=kube-system rc my_replication_controller

But how to achieve it using API? 
Moving through docs, I found only "replace scale of the specified Scale" and "partially update scale of the specified Scale" among write operations. But I think this is not what I need.

**Tags:** kubernetes

> **Comments:**
> **username_1**: In general, you can use the `--v=9` flag of `kubectl` to see which API call it uses.  

---

## 1 answers

### Answer by username_0 on 2018-01-25. Score: 3 | Accepted answer

After long playing with it and consulting on slack DevOps chat, I was able to figure it out. Here is a workable curl: 
curl -sSk -H \"Authorization: Bearer ${KUBE_TOKEN}\" -H 'Content-Type: application/merge-patch+json' -X 'PATCH' $URL_NAME/api/v1/namespaces/kube-system/replicationcontrollers/kube-registry-v0 -d '{"spec": {"replicas":  1}}'

One of the important components here is "Content-Type: application/merge-patch+json" Without it specification, Kubernetes will not recognize data in API request correctly.


---

