'Making sense of all the CIDR ranges Kubernetes needs

I'm currently following the Kubernetes The Hard Way guide, but since I couldn't get a Google Cloud account, I'm running everything on my own servers (Also I'm using flannel).

I'm getting pretty confused at the CIDR ranges Kubernetes needs for a typical installation, especially given how the tutorial takes these from the Google Cloud API (which I can't). These are the three main CIDR ranges you have to configure (to my understanding):

  • The service-cluster-ip-range as required by controller-manager (I have this set to 10.32.0.0)

To my understanding, this is the virtual private network used for ClusterIPs, I don't seem to have to do anything about it and gets picked up just fine by Kubernetes

  • The cluster-cidr for controller-manager and kube-proxy
  • The pod-cidr for kubelet

These two seem very confusing to me because of the following reasons:

  • Both seem to be the range of IPs that pods take in some private network?
  • However, in the aformentioned tutorial, the pod-cidr is received from the Google Cloud API while the cluster-cidr is hardcoded, so
  • I've seen around that there was some effort to deprecate pod-cidr (in this issue) and that cluster-cidr should be enough for pods to get their IPs from controller-manager?

In any case, my cluster still won't work since flannel complains there's no pod CIDR for nodes. This might come from my fundamental lack of understanding of what these configurations do, though I came across this issue and the only solution I've found is to just patch the nodes with the "default pod CIDR" (10.244.0.0/16). Note that neither setting that range as a pod-cidr or a cluster-cidr in my configs works, just patching it at runtime.

I know my question might be too generic and open (since it's just a matter of me not understanding CNI), so as a minimum, since I know that a pod CIDR of 10.244.0.0/16 works as patched... could someone tell me where do I configure it so it works from the get-go without manually patching?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source