VXLan模式简介
开启 VXLan 模式
官方文档
By default, the Calico manifests enable IP-in-IP encapsulation. If you are on a network that blocks IP-in-IP, such as Azure, you may wish to switch to Calico’s VXLAN encapsulation mode. To do this at install time (so that Calico creates the default IP pool with VXLAN and no IP-in-IP configuration has to be undone):
- Start with one of the Calico for policy and networking manifests.
- Replace environment variable name
CALICO_IPV4POOL_IPIP
withCALICO_IPV4POOL_VXLAN
. Leave the value of the new variable as “Always”. - Optionally, (to save some resources if you’re running a VXLAN-only cluster) completely disable Calico’s BGP-based networking:
- Replace
calico_backend: "bird"
withcalico_backend: "vxlan"
. This disables BIRD. - Comment out the line
- -bird-ready
and- -bird-live
from the calico/node readiness/liveness check (otherwise disabling BIRD will cause the readiness/liveness check to fail on every node):
livenessProbe:
exec:
command:
- /bin/calico-node
- -felix-live
# - -bird-live
readinessProbe:
exec:
command:
- /bin/calico-node
# - -bird-ready
- -felix-ready
For more information on calico/node’s configuration variables, including additional VXLAN settings, see Configuring calico/node.
Note: The
CALICO_IPV4POOL_VXLAN
environment variable only takes effect when the first calico/node to start creates the default IP pool. It has no effect after the pool has already been created. To switch to VXLAN mode after installation time, use calicoctl to modify the IPPool resource.
操作步骤
VXLAN模式:
开启内核模块
DaemonSet
的calico-node
中环境变量字段CALICO_IPV4POOL_IPIP
DaemonSet
的calico-node
中探针字段,注释-bird-live
字段
livenessProbe:
exec:
command:
- /bin/calico-node
- -felix-live
# - -bird-live
readinessProbe:
exec:
command:
- /bin/calico-node
# - -bird-ready
- -felix-ready
- 保证
ConfigMap
的calico-config
中的calico_backend: "vxlan"
通过手动修改calico-node
的DaemonSet
,修改字段IP_AUTODETECTION_METHOD
VXLan 隧道模式,不能与 ipipMode 同时使用
有三个值,跟 ipipMode 的一样。
- Always: 始终使用 VXLAN 隧道
- CrossSubnet: 只有在跨子网的时候才使用 VXLAN 隧道
- Never: 不使用 VXLAN
以下内容添加到 /etc/NetworkManager/conf.d/calico.conf
中,可以阻止 NetworkManager 管理 calico.vxlan
NetworkManager 会操作路由表,干扰到 calico 正常的路由下发
问题排查
查看对端 vxlan 网卡:
在主机网卡上抓包看看封装后的请求是否已到达: