Kubernetes 异地组网

正常情况下节点会在同一专有网络内,而当使用公网建立的 k8s 集群中跨主机 pod 可能无法互通,此时需要检查几个方面进行调整: 使用 Flannel VXLAN 需要确保每个节点之间 8472/udp 可以互通 设置 --node-ip <ip> 值对应该节点的异地组网 IP 和 VPC 内网 IP 设置 --node-external-ip <ip> 值对应节点公网 IP Debian11 默认使用 nftables 而不是 iptables ,K3S 网络功能需要使用 iptables,而不能使用 nftables sudo iptables -F sudo update-alternatives --set iptables /usr/sbin/iptables-legacy sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy sudo reboot 为节点增加注解 flannel.alpha.coreos.com/public-ip-overwrite: <ip> 值对应该节点的异地组网 IP,如果节点都具备公网 IP 设置公网 IP 确保 coredns 能被每个节点正常访问

四月 12, 2022

解决 Terminating 状态的 Pod

问题描述 在节点处于“不可用”状态时,CCE 会迁移节点上的容器实例,并将节点上运行的 pod 置为“Terminating”状态。 待节点恢复后,处于“Terminating”状态的 pod 会自动删除。 偶现部分 pod(实例)一直处于“Terminating ”状态: 通过 kubectl delete pods -n 命令始终无法将其删除: kubectl delete pods aos-apiserver-5f8f5b5585-s9l92 -n aos 解决方法 无论各种方式生成的 pod,均可以使用如下命令强制删除: kubectl delete pods <pod> --grace-period=0 --force 因此对于上面的 pod,我们只要执行如下命令即可删除: kubectl delete pods aos-apiserver-5f8f5b5585-s9l92 --grace-period=0 --force

十一月 11, 2021