How to set different (from defaults) mask in cluster-cidr in Kubernetes?

6/19/2018

I've deployed a Kubernetes 1.10.4 Cluster ( 3 Masters, 2 Workers ) using Kubespray deployment tool ( with kubeadm experimental feature flag enabled ).

By the way I'm using Canal as 'kube_network_plugin'.

My costumer have some networking constraints. They provided the following network spaces:

  • 192.168.150.0/25
  • 192.168.150.128/25
  • 192.168.151.0/25

Regarding kubespray 'k8s-cluster.yml', i've changed the parameters from the defaults, where the defaults are:

  • kube_service_addresses: 10.233.0.0/18
  • kube_pods_subnet: 10.233.64.0/18
  • kube_network_node_prefix: 24

We tried to change these parameters to match the network spaces our costumer gave us but unfortunately this modification didn't worked as expected. We soon realized that it would not work as expected by using /25 mask, so we tried to use from /25 to /20 but nothing worked.

I tried using 192.168.150.0/18 or 172.18.0.0/18 and all gone well (as long we use /18 mask), as demonstrated below.

kube_service_addresses: 192.168.150.0/18
kube_pods_subnet: 192.168.151.0/18
kube_network_node_prefix: 24

The behaviour presented by the cluster when using masks different than /18 is a bit weird, since, for example, kube-dns pod, kube-proxy pod, kube-autoscaler, etc, simply doesn't get up or canal-pods are deployed in one node but in the other cluster nodes it does not.

Is there any limitation/constraint of Kubernetes for not supporting any networks different that /18 or am i doing anything wrong?

I've searched this on web but in none of the stuff i read was clear regarding this. Some say (https://docs.projectcalico.org/v3.1/reference/calicoctl/resources/ippool) that is possible to set a different mask from the one that is on defaults (/16) but the fact is if we change it, it does not work.

Can you help me with this?

Best regards,

Pedro Cravo Lopes.

-- Pedro Lopes
calico
flannel
flanneld
kubernetes
project-calico

0 Answers