Change serviceSubnet in Kubernetes

If you will ever need to change serviceSubnet CIDR range (e.g. Kubernetes pod-network-cidr and service-cidr can’t overlap with intranet network ranges) here is how to proceed:

1. Adjust kubeadm-config ConfigMap

kubectl -n kube-system edit cm kubeadm-config

the ClusterConfiguration > serviceSubnet CIDR.

2. Adjust kube-apiserver.yaml

After you update ConfigMap adjust on all master nodes you have in your cluster the kube-apiserver.yaml file:

/etc/kubernetes/manifests/kube-apiserver.yaml

3. Reboot master nodes

Verify your services uses new IP ranges.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.