kubernetes set service cidr and pod cidr the same

xren picture xren · Aug 27, 2017 · Viewed 13.7k times · Source

When we use kubeadm to set up a k8s cluster, there are two options to config:

--pod-network-cidr

--service-cidr (default ‘10.96.0.0/12’)

Question is:

  1. If I use 10.244.0.0./12 for pod-network-cidr, do I need to save that IP range for Kubernetes? What happens if we already start to use 10.244.0.0/12 for other machines.

  2. Can I set service-cidr and the pod-network-cidr the same range? I don't understand how service-cidr works.

Answer

Janos Lenart picture Janos Lenart · Aug 28, 2017

To reply briefly:

    1. You do have to reserve both the pod-network range and the service network range. You can't use those on your LAN (and you can't have routes to it). Both ranges are configurable so you can pick something that is not used. Use ipcalc if you are unsure.
    1. You have to use separate ranges.

Check out these slides for explanation about the different networks in play.