[root@k8s-master01 ~]# kubectl get node NAME STATUS ROLES AGE VERSION k8s-master01 Ready master 10d v1.15.1 k8s-node01 Ready <none> 9d v1.15.1 k8s-node02 Ready <none> 9d v1.15.1
Chain KUBE-FIREWALL (2 references) target prot opt source destination DROP all -- 0.0.0.0/0 0.0.0.0/0 /* kubernetes firewall for dropping marked packets */ mark match 0x8000/0x8000
Chain KUBE-FORWARD (1 references) target prot opt source destination ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 /* kubernetes forwarding rules */ mark match 0x4000/0x4000 ACCEPT all -- 10.244.0.0/16 0.0.0.0/0 /* kubernetes forwarding conntrack pod source rule */ ctstate RELATED,ESTABLISHED ACCEPT all -- 0.0.0.0/0 10.244.0.0/16 /* kubernetes forwarding conntrack pod destination rule */ ctstate RELATED,ESTABLISHED [root@k8s-node01 ~]# service iptables save iptables: Saving firewall rules to /etc/sysconfig/iptables:[ 确定 ]
#第二步,在node节点清理flannel网络留下的文件 ifconfig cni0 down ip link delete cni0 ifconfig flannel.1 down ip link delete flannel.1 rm -rf /var/lib/cni/ rm -f /etc/cni/net.d/*
重新部署Flannel网络
1 2 3 4 5 6 7 8 9 10 11
[root@k8s-master01 flannel]# kubectl create -f kube-flannel.yml podsecuritypolicy.policy/psp.flannel.unprivileged created clusterrole.rbac.authorization.k8s.io/flannel created clusterrolebinding.rbac.authorization.k8s.io/flannel created serviceaccount/flannel created configmap/kube-flannel-cfg created daemonset.apps/kube-flannel-ds-amd64 created daemonset.apps/kube-flannel-ds-arm64 created daemonset.apps/kube-flannel-ds-arm created daemonset.apps/kube-flannel-ds-ppc64le created daemonset.apps/kube-flannel-ds-s390x created
[root@k8s-master01 flannel]# ping 10.244.1.2 PING 10.244.1.2 (10.244.1.2) 56(84) bytes of data. 64 bytes from 10.244.1.2: icmp_seq=1 ttl=63 time=1.04 ms 64 bytes from 10.244.1.2: icmp_seq=2 ttl=63 time=0.498 ms 64 bytes from 10.244.1.2: icmp_seq=3 ttl=63 time=0.575 ms 64 bytes from 10.244.1.2: icmp_seq=4 ttl=63 time=0.578 ms
1 2 3 4 5 6 7
[root@k8s-node01 ~]# ping 10.244.1.2 PING 10.244.1.2 (10.244.1.2) 56(84) bytes of data. 64 bytes from 10.244.1.2: icmp_seq=1 ttl=64 time=0.065 ms 64 bytes from 10.244.1.2: icmp_seq=2 ttl=64 time=0.038 ms 64 bytes from 10.244.1.2: icmp_seq=3 ttl=64 time=0.135 ms 64 bytes from 10.244.1.2: icmp_seq=4 ttl=64 time=0.058 ms ^C
1 2 3 4 5 6 7
[root@k8s-node02 ~]# ping 10.244.1.2 PING 10.244.1.2 (10.244.1.2) 56(84) bytes of data. 64 bytes from 10.244.1.2: icmp_seq=1 ttl=63 time=0.760 ms 64 bytes from 10.244.1.2: icmp_seq=2 ttl=63 time=0.510 ms 64 bytes from 10.244.1.2: icmp_seq=3 ttl=63 time=0.442 ms 64 bytes from 10.244.1.2: icmp_seq=4 ttl=63 time=0.525 ms ^C