This isn’t well found in the Kubernetes docs. If you want to scale up a replication controller, you can run the following.
size = 2
master_ip = '10.100.0.2'
rc_name = 'blog'
headers = {'Content-Type': 'application/strategic-merge-patch+json'}
payload = '{"spec":{"replicas":%s}}' % size
r = requests.patch("http://{ip}:8080/api/v1/namespaces/default/replicationcontrollers/{n}".format(ip=master_ip, n=rc_name), headers=headers, data=payload)
The example is using python requests module but its pretty similair using something like curl.
You just want to replace the top three lines. The PATCH
command won’t work if you send in the wrong headers.