💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
[TOC] 当添加节点时,默认要求所有节点的网卡名称一致。网卡名称不一致时,启动calico-node失败。 ## 操作影响 操作会逐个节点重启calico-node,一般每个节点的calico-node 2分钟内可以重启成功,可能对业务造成影响,至少需预留 2 * n 分钟(n为集群节点数),请根据环境等条件预留充足时间以防出现其它问题。 ## 操作步骤 1. 登录到其中一个台master节点操作集群 2. 查看calico-node的配置 ```shell $ kubectl get ds calico-node -n kube-system -oyaml|grep -A1 "name: IP_AUTODETECTION_METHOD" - name: IP_AUTODETECTION_METHOD value: interface=eth.*|ens.* $ ip a | grep ens33 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 inet 192.168.31.103/24 brd 192.168.31.255 scope global noprefixroute ens33 ``` 3. 修改calico-node的环境变量 ```shell $ kubectl set env daemonset/calico-node -n kube-system IP_AUTODETECTION_METHOD=can-reach={IP} ``` > 将{IP}替换成节点已在集群的IP地址即可。 4. 验证 ```shell $ kubectl get ds calico-node -n kube-system -oyaml|grep -A1 "name: IP_AUTODETECTION_METHOD" - name: IP_AUTODETECTION_METHOD value: can-reach=192.168.31.103 $ kubectl -n kube-system get pod NAME READY STATUS RESTARTS AGE calico-kube-controllers-548f7fb658-pl4bv 1/1 Running 0 17h calico-node-5hjjp 1/1 Running 0 115s calico-node-7g9x7 1/1 Running 0 79s calico-node-cvlm5 1/1 Running 0 2m8s calico-node-xf2jl 1/1 Running 0 2m26s calico-node-xqfrx 1/1 Running 0 93s coredns-5b599956d9-8v9nt 1/1 Running 0 17h coredns-5b599956d9-v6pcb 1/1 Running 0 17h coredns-5b599956d9-wzcd6 1/1 Running 0 17h kube-state-metrics-6544d5656d-l8kr6 1/1 Running 0 17h metrics-server-b785c9df9-zrwpg 1/1 Running 0 16h nfs-provisioner-6486668bcc-76pk8 1/1 Running 0 17h $ kubectl get pod -owide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES app-v1-68db595855-7g9bx 1/1 Running 0 52s 20.188.135.129 k8s-node03 <none> <none> app-v1-68db595855-l2r6f 1/1 Running 0 52s 20.188.122.131 k8s-master02 <none> <none> app-v1-68db595855-xnrfq 1/1 Running 0 52s 20.188.58.195 k8s-node02 <none> <none> app-v2-595cf6b7f-2qghg 1/1 Running 0 51s 20.188.135.130 k8s-node03 <none> <none> app-v2-595cf6b7f-hffwq 1/1 Running 0 51s 20.188.58.193 k8s-node02 <none> <none> app-v2-595cf6b7f-zv7m8 1/1 Running 0 51s 20.188.32.129 k8s-master01 <none> <none> busybox-79b94f5dd8-sjx7m 1/1 Running 0 51s 20.188.122.132 k8s-master02 <none> <none> # 宿主机到pod $ ping -c4 20.188.135.129 PING 20.188.135.129 (20.188.135.129) 56(84) bytes of data. 64 bytes from 20.188.135.129: icmp_seq=1 ttl=63 time=0.483 ms 64 bytes from 20.188.135.129: icmp_seq=2 ttl=63 time=0.375 ms 64 bytes from 20.188.135.129: icmp_seq=3 ttl=63 time=0.390 ms 64 bytes from 20.188.135.129: icmp_seq=4 ttl=63 time=0.470 ms --- 20.188.135.129 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3002ms rtt min/avg/max/mdev = 0.375/0.429/0.483/0.051 ms # pod到pod $ kubectl exec -it busybox-79b94f5dd8-sjx7m -- ping -c4 20.188.135.129 PING 20.188.135.129 (20.188.135.129): 56 data bytes 64 bytes from 20.188.135.129: seq=0 ttl=62 time=0.915 ms 64 bytes from 20.188.135.129: seq=1 ttl=62 time=0.492 ms 64 bytes from 20.188.135.129: seq=2 ttl=62 time=0.515 ms 64 bytes from 20.188.135.129: seq=3 ttl=62 time=0.394 ms --- 20.188.135.129 ping statistics --- 4 packets transmitted, 4 packets received, 0% packet loss round-trip min/avg/max = 0.394/0.579/0.915 ms ```