Choosing a specific NIC when there are multiple NICs with calico and kube-vip #590
-
DetailsThis is advanced configuration but I figured it would be worth opening an issue to inform people how to deal with situations where your nodes have multiple active NICs and you want to choose which one Kubernetes uses. If you nodes have different network interface names, it's advised to make the names consistent across devices. Review this question on AskUbuntu on how to make that happen. These changes should be made prior to running CalicoBy default, attaches to the first available internet interface (https://projectcalico.docs.tigera.io/networking/ip-autodetection). The way around this could be achieved by setting a interface name regex in the Calico # ./provision/ansible/playbooks/templates/calico-installation.yaml.j2
---
apiVersion: operator.tigera.io/v1
kind: Installation
metadata:
name: default
spec:
calicoNetwork:
nodeAddressAutodetectionV4:
interface: "eno.*"
... kube-vipBy default kube-vip choose the NIC with the default gateway. To assign a specific NIC update the configuration below. # ./provision/ansible/playbooks/templates/kube-vip-daemonset.yaml.j2
...
env:
...
- name: vip_interface
value: "eno1"
... # ./tmpl/cluster/kube-vip-daemonset.yaml
...
env:
...
- name: vip_interface
value: "eno1"
... |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
Perhaps we could automate this with Ansible using the CIDR for IP detection? https://projectcalico.docs.tigera.io/networking/ip-autodetection spec:
calicoNetwork:
nodeAddressAutodetectionV4:
cidrs:
- "{{ (ansible_default_ipv4.network + '/' + ansible_default_ipv4.netmask) | ipaddr('network/prefix') }}" # 192.168.200.0/24 |
Beta Was this translation helpful? Give feedback.
-
@brettinternet how would that help when a node has multiple active NICs, and for example each nic is part of a different network? |
Beta Was this translation helpful? Give feedback.
-
Oh, I just mean as a default for hardware with multiple NICs but where only one is used. Otherwise I believe they'll find these Calico errors on those nodes:
|
Beta Was this translation helpful? Give feedback.
-
@brettinternet this should help certain people so if you want to open a PR to add that, please do otherwise I'll get to it later. Edit: Done in effd4dd |
Beta Was this translation helpful? Give feedback.
-
@onedr0p Have you this or a similar configuration for cilium as well? My usecase: |
Beta Was this translation helpful? Give feedback.
Perhaps we could automate this with Ansible using the CIDR for IP detection? https://projectcalico.docs.tigera.io/networking/ip-autodetection