Why calico missing some nodes peer address in Kubernetes?

7/12/2020

I am using kubernetes v1.18 and use calico as my CNI plugin, this is the calico pod status(remove unrelate pods):

[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>

and I install calicoctl in my master host node:

curl -O -L  https://github.com/projectcalico/calicoctl/releases/download/v3.15.1/calicoctl
chmod +x calicoctl
mv calicoctl /usr/local

and get calico node status.

[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.

The question is: why the master 192.168.31.29 calico nodes is not found? all pods running fine, and I do not know how to find the reason.

-- Dolphin
kubernetes

1 Answer

7/12/2020

The question is: why the master 192.168.31.29 calico nodes are not found?

Sounds like Calico wasn't able to retrieve your NODENAME for the master. I see that it's defined as localhost.localdomain in the output of your command.

If you see the docs, Calico needs to be able to determine your NODENAME to add the calico/node resource and consider it to be part of the 'mesh'.

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.

Another question would be, are you planning to run workloads on your Kubernetes master? If you don't then your setup is fine now. If you do, then yes, you will have to make sure that Calico (the overlay) works so that your workloads have network connectivity.

-- Rico
Source: StackOverflow