我正在使用kubernetes v1.18并使用calico作为我的CNI插件,这是calico pod状态(删除不相关的pod):
[root@localhost ~]# kubectl get pods --all-namespaces -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
calico-kube-controllers-75d555c48-lt4jr 1/1 Running 0 2d12h 10.11.102.134 localhost.localdomain <none> <none>
calico-node-6rj58 1/1 Running 0 37h 192.168.31.30 k8sslave1 <none> <none>
calico-node-czhww 1/1 Running 0 2d12h 192.168.31.29 localhost.localdomain <none> <none>
calico-node-vwr5w 1/1 Running 0 2d12h 192.168.31.31 k8sslave2 <none> <none>
calicoctl 1/1 Running 0 93m 192.168.31.31 k8sslave2 <none> <none>
然后在我的主主机节点中安装calicoctl:curl -O -L https://github.com/projectcalico/calicoctl/releases/download/v3.15.1/calicoctl
chmod +x calicoctl
mv calicoctl /usr/local
并获取印花布节点状态。[root@localhost ~]# calicoctl node status
Calico process is running.
IPv4 BGP status
+---------------+-------------------+-------+----------+-------------+
| PEER ADDRESS | PEER TYPE | STATE | SINCE | INFO |
+---------------+-------------------+-------+----------+-------------+
| 192.168.31.31 | node-to-node mesh | up | 02:56:08 | Established |
| 192.168.31.30 | node-to-node mesh | up | 02:56:09 | Established |
+---------------+-------------------+-------+----------+-------------+
IPv6 BGP status
No IPv6 peers found.
问题是:为什么找不到主192.168.31.29
印花布节点?所有 pod 运行正常,我不知道如何找到原因。
最佳答案
The question is: why the master 192.168.31.29 calico nodes are not found?
听起来Calico无法为主服务器检索
NODENAME
。我看到它在您的命令输出中定义为localhost.localdomain
。如果看到docs,则Calico需要能够确定
NODENAME
以添加calico / node资源并将其视为“网格”的一部分。The calico/node must know the name of the node on which it is running. The node name is used to retrieve the Node resource configured for this node if it exists, or to create a new node resource representing the node if it does not. It is also used to associate the node with per-node BGP configuration, felix configuration, and endpoints.
另一个问题是,您是否打算在Kubernetes主服务器上运行工作负载?如果您不这样做,那么现在设置就可以了。如果这样做,那么是的,您必须确保Calico(覆盖图)可以正常工作,以便您的工作负载具有网络连接性。
关于kubernetes - 为什么calico在Kubernetes中缺少某些节点对等地址?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62857235/