Multi-Homed Pod with Static IP
Check Connectivity
CAUTION: macvlan sub-interfaces cannot access parent directly where the connecivity between pod and its hosting host will fail
# create another pod for test kubectl run check --image alpine -- sleep infinity # check IP address of the pods and their nodes kubectl get po -o custom-columns=NAME:metadata.name,IP:status.podIP,HOST:status.hostIP # here is the output for example NAME IP HOST check 10.244.187.36 10.67.109.148 macvlan-static 10.244.187.34 10.67.109.148 # the IP of the extra network infterface STATIC_IP=$(kubectl exec macvlan-static -- ip a s dev net1 | grep inet | awk '{print $2}' | sed s#/.*##) # check pod to pod connectivity # should be OK via primary network interface kubectl exec macvlan-static -- ping -c3 10.244.187.34 kubectl exec check -- ping -c3 10.244.187.36 # it will be failed cause there is no route kubectl exec check -- ping -c3 $STATIC_IP # current host IP HOST_IP=$(ip r get 1 | awk '{print $7}') echo $HOST_IP # pod to node and reversely kubectl exec macvlan-static -- ping -c3 -I eth0 $HOST_IP kubectl exec macvlan-static -- ping -c3 -I net1 $HOST_IP ping -c3 10.244.187.34 ping -c3 $STATIC_IP # you can find a host out side of the cluster, and check again