IP Address Management
- How the virtual bridge network on the nodes assigned an IP subnet?
- How are the pods assigned an IP?
- Where is the information stored and who is responsible for ensuring there are no duplicate IP is assigned?
CNI Plugin Responsibilities
- Must support arguments ADD/DEL/CHECK
- Must support parameters container id, network ns, etc.
- Must manage IP Address assignment to Pods
- Must return results in a specific format.
How do we manage the APIs Kubernetes does not care how we do it. We just to do it by making sure we do not assign any duplicate APIs and manage it properly. The easiest way to do it is to store the list of APIs in a file and make sure we have the necessary code in our script to manage the file properly.
IP | Status | Pod |
10.244.1.2 | Assigned | Nginx |
10.244.1.3 | Assigned | Python App |
10.244.1.4 | Free |
The file would be placed on each host and manages the APIs of pods on the nodes.
IP | Status | Pod |
10.244.2.2 | Assigned | Nginx |
10.244.2.3 | Assigned | Node App |
10.244.2.4 | Free |
Instead of coding that ourselves in our script, CNI comes with two built-in plugins to which you can outsource the task to.
cat /etc/cni/net.d/net-script.conf
The CNI configuration file has a section called ipam in which we can specify the type of plug in to be used the subnet and route to be used. The details can be read from our script to invoke the appropriate plugin instead of hard coding it to use hosted local every time.
weaveworks manages IP addresses. weave by allocates the appearance 10.32.0.0/12 for the entire network.
10.32.0.1 ~ 10.47.255.254 That is about a milion APIs that you can use for pod on the network.