美文网首页
Calico 网络问题小记

Calico 网络问题小记

作者: Jeff | 来源:发表于2017-11-28 17:44 被阅读388次

    在公司的 K8s 平台上,碰到一个 node 访问不了 其他 node 上的 service,无论是通过 ip 还是服务名,这里小记解决方案。

    背景

    K8s + Calico (ip-in-ip enabled,可以跨子网),一个 node (主机名为 worker2) 因为挂了在K8s cluster 上标记为 inactive,新建了一个 node (主机名也为 worker2),在新建的这个 node上通讯不成功。

    调试

    在新 node 上查看 route,通过运行:ip route 和 route -n, 发现 tunl0 的路由没有,在 master 上,安装 calicoctl 运行 calicoctl node status 发现异常(connection established 失败),dead node 的 connection 没有建立,通过查询 calico 文档:https://docs.projectcalico.org/v2.1/usage/troubleshooting/,发现了线索:

    Your hosts’ names must be different. Calico uses hostname as a key in the etcd data, and the etcd data is used to autogenerate the correct BIRD config - so a duplicate hostname will prevent correct BIRD setup.

    解决方法

    • kubectl get nodes:node 列表
    • kubectl delete node xxx.xx.xxx-ip:删除 inactive 的 dead node (通过 ip)
    • calicoctl get nodes:calico node 列表
    • calicoctl delete node xxx: 删除 dead node (通过 hostname)
    • calicoctl node run: 在新节点上跑 calico node ,让新的 node 生效 (bgp peer)
    • calicoctl node status: 查看状态,确认没有问题
    • route -n: 确认路由没有问题

    相关文章

      网友评论

          本文标题:Calico 网络问题小记

          本文链接:https://www.haomeiwen.com/subject/ihuebxtx.html