Kubernetes, how do I let kubernetes use the internal network for node to node communication?
Solution 1:
There is one idea why it can happen this way. Based on the flannel configuration doc, there is an option:
--iface="": interface to use (IP or name) for inter-host communication. Defaults to the interface for the default route on the machine. This can be specified multiple times to check each option in order. Returns the first match found.
In order to pass this option, you'll need to download the flannel manifest in yaml and add this part to args
in daemonSet
- containers
- kube-flannel
one, so it should look like:
containers:
- name: kube-flannel
image: quay.io/coreos/flannel:v0.14.0
command:
- /opt/bin/flanneld
args:
- --ip-masq
- --kube-subnet-mgr
- --iface=interface_name
And then kubectl apply -f kube-flannel.yaml
It may require to delete flannel and apply from scratch.
Upd:
You can check which interface is used in kube-flannel pod logs:
kubectl logs -n kube-system kube-flannel-ds-xxxxx -c kube-flannel | grep interface
In my case it was one and only network interface:
I0611 12:21:47.303175 1 main.go:520] Determining IP address of default interface
I0611 12:21:47.303636 1 main.go:533] Using interface with name ens4 and address 10.186.0.2
I0611 12:21:47.303668 1 main.go:550] Defaulting external address to interface address (10.186.0.2)