Kubernetes

Describe what happens when a container tries to connect with its corresponding Service for the first time. Explain who added each of the components you include in your description

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

  • The container looks at the nameserver defined in /etc/resolv.conf
    • The container queries the nameserver so the address is resolved to the Service IP
    • Requests sent to the Service IP are forwarded with iptables rules (or other chosen software) to the endpoint(s).

Explanation as to who added them:

  • The nameserver in the container is added by kubelet during the scheduling of the Pod, by using kube-dns
  • The DNS record of the service is added by kube-dns during the Service creation
  • iptables rules are added by kube-proxy during Endpoint and Service creation