在十一或者五一的时候,公司大楼装修断电,关闭服务器,启动之后发现flannel网卡不好使了,在部署K8S 1.28.2出现flannel.1和cni网段不一致的情况。尝试了删除cni0网卡 但是删除后cni0网卡不会重新创建:
ifconfig cni0 down
ifconfig flannel.1 down
ip link delete cni0
ip link delete flannel.1
手动删除在创建cni0方式不能解决:
ip link delete cni0
ip link add cni0 type bridge
ip addr add 10.100.0.1/24 dev cni0
ifconfig cni0 up
之后就尝试了使用calico网卡最后成功创建
还可以说下边内容:
部署版本的时候部署错误后来修改过来成功解决问题
你的K8S版本是1.23.17版本,calico支持的最新版本是"3.25"。
https://docs.tigera.io/calico/3.25/getting-started/kubernetes/requirements
创建calico过程
1.安装tigera-operator组件
[root@k8s66 calico]# wget https://raw.githubusercontent.com/projectcalico/calico/v3.26.3/manifests/tigera-operator.yaml
[root@k8s66 calico]# kubectl create -f tigera-operator.yaml
2.修改自定义Pod IP地址池
[root@k8s66 calico]# wget https://raw.githubusercontent.com/projectcalico/calico/v3.26.3/manifests/custom-resources.yaml
3.创建calico(修改网段,以后改成公司的)
[root@k8s66 calico]# grep cidr custom-resources.yaml
cidr: 10.100.0.0/16
[root@k8s66 calico]#
[root@k8s66 calico]# kubectl create -f custom-resources.yaml
4.创建资源清单并验证测试
[root@k8s66 ~]# kubectl get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
deploy-nginx-7948b47f4f-2z5t5 1/1 Running 0 5s 10.100.59.4 k8s66
deploy-nginx-7948b47f4f-nmgcq 1/1 Running 0 5s 10.100.16.4 k8s88
deploy-nginx-7948b47f4f-pchjq 1/1 Running 0 5s 10.100.112.196 k8s77
[root@k8s66 ~]#
[root@k8s66 ~]# curl -I 10.100.112.196
HTTP/1.1 200 OK
Server: nginx/1.20.1
Date: Thu, 09 Nov 2023 07:26:14 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Tue, 25 May 2021 13:41:16 GMT
Connection: keep-alive
ETag: "60acfe7c-264"
Accept-Ranges: bytes
[root@k8s66 ~]#
[root@k8s66 ~]# curl -I 10.100.16.4
HTTP/1.1 200 OK
Server: nginx/1.20.1
Date: Thu, 09 Nov 2023 07:26:18 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Tue, 25 May 2021 13:41:16 GMT
Connection: keep-alive
ETag: "60acfe7c-264"
Accept-Ranges: bytes
[root@k8s66 ~]#
[root@k8s66 ~]# curl -I 10.100.59.4
HTTP/1.1 200 OK
Server: nginx/1.20.1
Date: Thu, 09 Nov 2023 07:26:24 GMT
Content-Type: text/html
Content-Length: 612
Last-Modified: Tue, 25 May 2021 13:41:16 GMT
Connection: keep-alive
ETag: "60acfe7c-264"
Accept-Ranges: bytes
[root@k8s66 ~]#
标签:cni0,插件,k8s66,10.100,网络,root,calico,GMT From: https://www.cnblogs.com/donglitong/p/18002242