Kubernetes

Describe in detail what happens when you create a service

Difficulty: unrated

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

Answer

  1. Kubectl sends a request to the API server to create a Service
  2. The controller detects there is a new Service
  3. Endpoint objects created with the same name as the service, by the controller
  4. The controller is using the Service selector to identify the endpoints
  5. kube-proxy detects there is a new endpoint object + new service and adds iptables rules to capture traffic to the Service port and redirect it to endpoints
  6. kube-dns detects there is a new Service and adds the container record to the dns server