Explain how a Deployment, a Service and an Ingress work together to expose a web app in Kubernetes.
What the interviewer wants to hear
- Deployment manages ReplicaSets and Pods and rolling updates
- Service gives a stable IP and DNS and selects Pods by labels
- Ingress or Gateway API routes external HTTP traffic by host and path
- Ingress controller or load balancer implements the rules
- Readiness probes control which Pods get traffic
Model answer
The Deployment describes the desired state of the app: which image to run, how many replicas, and how to roll out updates. It creates a ReplicaSet, which keeps the right number of Pods running. Pods come and go and their IPs change, so a Service sits in front of them. It selects Pods by labels and gives them one stable cluster IP and DNS name, load balancing across Pods that pass their readiness probe. To reach the app from outside, an Ingress (or the newer Gateway API HTTPRoute) defines rules such as host shop.example.com and path /api go to this Service. An Ingress or Gateway controller, like NGINX, Envoy or a cloud load balancer, reads these rules, terminates TLS and forwards traffic to the Service.
Can you answer it under time pressure?
Take a timed easy round and get scored on every answer.
More easy DevOps Engineer questions
- What does DevOps mean to you, and how is it different from a traditional operations team?
- Walk me through the stages of a typical CI/CD pipeline you would build for a web service.
- How is a container different from a virtual machine? When would you choose one over the other?
- What is Infrastructure as Code and why is it better than creating resources by clicking in the cloud console?
- Compare trunk-based development with GitFlow. Which would you choose for a team that deploys several times a day, and why?
- Walk me through what happens when you run docker run -p 8080:80 nginx:1.27 on a fresh machine.
- What is the difference between monitoring and observability, and what are the main signals you would collect for a web service?
- How does a load balancer use health checks, and what makes a good health check endpoint?
- Terraform and Ansible are both called infrastructure as code. How do they differ, and when would you use each?