Ping other pod in the same & different pod

9/20/2019

I would like to ping B pod (node 1) from A pod (node 0) but it's unreachable. However, pinging pod in the same node can not be reachable too. I am setting up new cluster for trying Kubernetes from Kelsey.

I have tried to use this link as my reference Kubernetes: Can't ping pods across nodes

Node - IP Private - IP Pod
worker-0 - 10.240.0.20 - 10.200.0.0/24
worker-1 - 10.240.0.21 - 10.200.1.0/24
worker-2 - 10.240.0.22 - 10.200.2.0/24

route -n

worker-0

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.240.0.1      0.0.0.0         UG    100    0        0 ens4
10.200.0.0      0.0.0.0         255.255.255.0   U     0      0        0 cnio0
10.240.0.1      0.0.0.0         255.255.255.255 UH    100    0        0 ens4
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0

worker-1

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.240.0.1      0.0.0.0         UG    100    0        0 ens4
10.200.1.0      0.0.0.0         255.255.255.0   U     0      0        0 cnio0
10.240.0.1      0.0.0.0         255.255.255.255 UH    100    0        0 ens4
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0

worker-2

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.240.0.1      0.0.0.0         UG    100    0        0 ens4
10.200.2.0      0.0.0.0         255.255.255.0   U     0      0        0 cnio0
10.240.0.1      0.0.0.0         255.255.255.255 UH    100    0        0 ens4
172.17.0.0      0.0.0.0         255.255.0.0     U     0      0        0 docker0

I have done setting up VPC Netowrk Routes like this link.

After that i followed this reference Kubernetes: Can't ping pods across nodes

route add -net 10.200.1.0 netmask 255.255.255.0 gw 10.240.0.21 in worker-0

The result is

SIOCADDRT: Network is unreachable

I tried it in worker-0, worker-1, worker-2 and got same result. Eventhough worker-0 can ping to worker-1 (10.240.0.21), reachable.

My expectation when i am in Pod A (worker-0) with IP Pod 10.200.0.3, i can ping to Pod B (worker-1) with IP Pod 10.200.1.3. And also, i can ping to Pod C (worker-0) same with Pod A.

Does this step should be using Calico or Flannel ? or Should we can ping other pod from different node without Calico or Flannel (only CNI setting) ?

Additional Information

I am using Docker not runc & containderd. So, i installed Docker manually from this link.

In kubelet.service, --container-runtime=remote become --container-runtime=docker

-- Nicky Puff
google-cloud-platform
kubernetes
kubernetes-pod
vpc

1 Answer

9/20/2019

Try adding the routes like this:

Worker-0:
$ sudo route add -net 10.200.1.0 netmask 255.255.255.0 gw 10.240.0.21
$ sudo route add -net 10.200.2.0 netmask 255.255.255.0 gw 10.240.0.22

Worker-1:
$ sudo route add -net 10.200.0.0 netmask 255.255.255.0 gw 10.240.0.20
$ sudo route add -net 10.200.2.0 netmask 255.255.255.0 gw 10.240.0.22

Worker-2:
$ sudo route add -net 10.200.0.0 netmask 255.255.255.0 gw 10.240.0.20
$ sudo route add -net 10.200.1.0 netmask 255.255.255.0 gw 10.240.0.21
-- Junaid
Source: StackOverflow