How does a load balancer use health checks, and what makes a good health check endpoint?
What the interviewer wants to hear
- Load balancer probes targets and removes unhealthy ones from rotation
- Thresholds and intervals avoid flapping
- Endpoint should be cheap and reflect ability to serve traffic
- Avoid deep dependency checks that cause cascading removal
- Difference between liveness and readiness style checks
Model answer
A load balancer sends periodic requests, for example HTTP GET /healthz every 10 seconds, to each target. After a set number of failures it stops sending user traffic there, and after a number of successes it adds the target back. These thresholds prevent flapping on a single slow response. A good endpoint is fast and cheap, needs no authentication, and answers whether this instance can serve requests right now, such as having finished startup and loaded config. I avoid making it check every downstream dependency: if a shared database blips and every instance fails its check, the load balancer removes all of them and a partial outage becomes a full one. In Kubernetes I separate readiness, which controls traffic, from liveness, which restarts the container, and keep liveness very simple so it only catches a truly stuck process.
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?
- Explain how a Deployment, a Service and an Ingress work together to expose a web app in Kubernetes.
- 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?
- Terraform and Ansible are both called infrastructure as code. How do they differ, and when would you use each?