Rate This Document
Findability
Accuracy
Completeness
Readability

Exposing the IP Address of the MySQL Pod to a Node Outside the Cluster

The purpose of exposing the pod IP address is to add a static route on the host that initiates the access or on the router. This section uses the physical host with the IP address 192.168.200.112 outside of the K8s cluster as an example to describe how to access the MySQL pod. It is assumed that the primary node in the cluster is centos-10 and its IP address is 192.168.200.10. You need to add a static route on the physical host with the IP address 192.168.200.112 so that all access requests to the MySQL pod (10.99.0.0/16) on the local host are directed to the primary node with the IP address 192.168.200.10 where the K8s cluster is located.

1
2
route add -net 10.99.0.0/16 gw 192.168.200.10
ping 10.99.0.15
PING 10.99.0.15 (10.99.0.15) 56(84) bytes of data.
64 bytes from 10.99.0.15: icmp_seq=1 ttl=62 time=2.38 ms
64 bytes from 10.99.0.15: icmp_seq=2 ttl=62 time=1.16 ms

If "SIOCADDRT: Network is unreachable" is displayed when you add a static route but the destination IP address can be pinged, the destination IP address (192.168.201.150) and the host IP address (192.168.200.112) may be not in the same LAN.

For example, a K8s cluster whose pod IP address is in the 10.67.0.0/16 network segment is deployed on the node with the IP address 192.168.201.150.

1
route add -net 10.67.0.0/16 gw 192.168.201.150
SIOCADDRT: Network is unreachable
1
ping 192.168.201.150
PING 192.168.201.150 (192.168.201.150) 56(84) bytes of data.
64 bytes from 192.168.201.150: icmp_seq=1 ttl=63 time=0.189 ms
64 bytes from 192.168.201.150: icmp_seq=2 ttl=63 time=0.147 ms

For details, see IP Addresses of Pods Exposed to the External Network in the Kube-OVN User Guide.