Welcome to the Linux Foundation Forum!

Pod Networking

Hi !

I am starting to make sense of the Pod Networking model used with K8s and Calico.
I only have one outstanding question I am finding difficult to find the answer.
From everything I have read, I understand that each POD has its own network namespace and a single IP address that is provided by calico.
When deploying the nginx deployment and exposing it with ClusterIP, if I login to one of the pods that make the deployment and try to find out the internal IP, I can't.
The only part where the internal IP of the pod is found is on /etc/hosts.

vxr@ubuntu-k8s-master:~$ kubectl exec nginx-7848d4b86f-7bq85 -- ip link list
OCI runtime exec failed: exec failed: container_linux.go:380: starting container process caused: exec: "ip": executable file not found in $PATH: unknown
command terminated with exit code 126
vxr@ubuntu-k8s-master:~$
vxr@ubuntu-k8s-master:~$ kubectl get ep
NAME         ENDPOINTS                                               AGE
kubernetes   172.19.187.10:6443                                      2d21h
nginx        192.168.171.69:80,192.168.171.70:80,192.168.171.72:80   16h

So my question is:

1 - How can I find the internal eth0 interface from inside the pod ?
2 - How can I find the mapped IP address from inside the pod ?

Thank you very much !!!

Best Answer

  • serewicz
    serewicz Posts: 1,000
    Answer ✓

    Hello,

    First you would need to deploy a pod that has the necessary commands. Probably the easiest way to find the interfaces and IP addresses is to use the ip command inside a shell of a container in the pod. Other IP information can be seen via environmental, using the env command, as is seen in Exercise 3.5, step 2.

    Regards,

Answers

  • Thank you ! So I guess that the issue here is more about the Pod not having the right commands, in that case the "ip" command. I was able to find IP information looking at the /etc/hosts file but will also look at the env.
    Really appreciate your help @serewicz !

Categories

Upcoming Training