Skip to content

How to change pods CIDR in a Microk8s cluster

Last updated on April 25, 2023

  • 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-proxy and update the --cluster-cidr= argument with the new CIDR.
  • Restart MicroK8s with:
microk8s stop
microk8s start
  • Edit /var/snap/microk8s/current/args/cni-network/cni.yaml and replace the new IP range in. For example to switch to update the CALICO_IPV4POOL_CIDR with:
   value: ""
  • Apply the new CNI manifest:
microk8s kubectl apply -f /var/snap/microk8s/current/args/cni-network/cni.yaml

Verify the new configuration

microk8s kubectl run nginx --image=nginx

…then check the allocated IP addresses:

microk8s kubectl get po -A -o wide
default    nginx  1/1   Running   0    4s  


Published inKubernetesLinux