- Remove the current CNI configuration with :
microk8s kubectl delete -f /var/snap/microk8s/current/args/cni-network/cni.yaml
- Edit
/var/snap/microk8s/current/args/kube-proxyand update the--cluster-cidr=10.1.0.0/16argument with the new CIDR. - Restart MicroK8s with:
microk8s stop
microk8s start
- Edit
/var/snap/microk8s/current/args/cni-network/cni.yamland replace the new IP range in. For example to switch to10.2.0.0/16update theCALICO_IPV4POOL_CIDRwith:
- name: CALICO_IPV4POOL_CIDR
value: "10.2.0.0/16"
- Apply the new CNI manifest:
microk8s kubectl apply -f /var/snap/microk8s/current/args/cni-network/cni.yamlVerify the new configuration
microk8s kubectl run nginx --image=nginx
…then check the allocated IP addresses:
microk8s kubectl get po -A -o widedefault nginx 1/1 Running 0 4s 10.2.110.8 source https://microk8s.io/docs/change-cidr
