Ip Address Management Weave
- How are the virtual bridges in the nodes assigned an IP subnet?
- How are the Pod assigned an IP?
- Where is the information stored?
- How are duplicate IP not assigned?
- CNI Plugin Responsibilities:
- Must support arguments ADD/DEL/CHECK.
- Must support parameters container id, network ns.
- Must manage IP Address assignment to PODs.
- Must return results in a specific format.
- How assign IP Address?
- How do we not assign duplicate IPs during the
ip -n <namespace> addr addandip -n <namespace> route addcommands?- An easy way is to store all required IPs in a file.
- The file would look like this:
IP STATUS POD 10.244.1.2 ASSIGNED BLUE - The above file is placed on each host and the IPs of each pod per host are assigned appropriately.
- In the network assignment script, you’d add
ip = get_free_ip_from_file()before running theip -nnames. - You can outsource the above actually and use two built-in plugins with CNI –>
DHCPandhost-local- You’d call that in the network assignment script with
ip = get_free_ip_from_host_local()
- You’d call that in the network assignment script with
- The CNI has a configuration file under
/etc/cni/net.d/net-script.conf. It looks like this: ``` { “cniVersion”: “0.2.0”, “name”: “mynet”, “type”: “net-script”, “bridge”: “cni0”, “isGateway”: true, “ipMasq”: true, “ipam”: { “type”: “host-local”, “subnet”: “10.244.0.0/16”, “routes”: { { “dst”: “0.0.0.0/0” } }
} ```
- The above
ipamsection is the one of interest with CNI.- The
ipamconfig settings are read from the network assignment script.
- The
- WEAVEWORKS by default allocates the IP range of
10.32.0.0/12for the entire network.- Provides an IP range of
10.32.0.1to10.47.255.254. 1,048,574 IPs are available.- This is now split between each node. Node A is assigned
10.32.0.1, Node B is assigned10.38.0.0and Node C is assigned10.44.0.0. This is for the pods, not the actual node IPs themselves.
- This is now split between each node. Node A is assigned
- Provides an IP range of