Is it possible to change service-cluster-ip-range?

6/17/2019

I'm running out of free IP for services in a test cluster and I want to change service-cluster-ip-range to a new CIDR. I want to know if it's supported and how to do this.

Running K8s 1.12.3, CoreDNS and Calico

During my investigation of this issue I found no official documentation that could provide any help.

I modified --service-cluster-ip-range for kube-apiserver and kube-controller-manager to match a new range.

I then restarted kube-apiserver kube-controller-manager kube-scheduler on all masters and added a new service

It seems the new service was created with the new range and all old services, including cluster IP was kept. Both old and new services works, even after att full cluster restart (just to try).

-- Johan Ryberg
kubernetes

2 Answers

7/2/2019

Based on this github issue and other resources I was able to find. Another from Calico documentation. Here is a detailed instruction for Docker EE but I think it can be helpful.

So yeah it is possible, the real issue is what will stop working (for how long?) and how much downtime you can afford. A lot of answers around in the Internet advice on recreating the cluster and if it is possible I would probably listen to that advice. It seems like adding the new CIDR and then deactivating the old one is the way to go.

If that is not possible, you can try to create another test cluster and try this changes in there to see what can possibly go wrong. Also remember to recreate the nodes that are present in the cluster (scale down to 0 so the machines will be recreated).

-- aurelius
Source: StackOverflow

6/17/2019

yes, it is possible to have custom IP range for service CIDR. the steps you have done are correct. i know few people tried those options and are using custom IP range.

-- P Ekambaram
Source: StackOverflow