What is a Service in Kubernetes, and what are the main types?
What they are really testing: Whether you understand why pods need a stable abstraction in front of them and can distinguish ClusterIP, NodePort, and LoadBalancer.
A real interview question
What is a Service in Kubernetes, and what are the main types?
What most people say
drag me
“A Service is how you expose your pods so other things can reach them.”
Directionally right but vague. It never explains why (ephemeral pod IPs), how (label selection), or the type distinctions (ClusterIP vs NodePort vs LoadBalancer), which is what the question asks.
The follow-ups they ask next
What is the difference between a Service and an Ingress?
A Service gives a stable IP and L4 load-balancing for one set of pods. An Ingress is L7 HTTP routing (by host/path, with TLS) that sits above Services, letting many services share a single external entry point.
How does a pod find another service inside the cluster?
Cluster DNS (CoreDNS): a Service gets a DNS name like my-svc.my-namespace.svc.cluster.local, so pods resolve services by name rather than IP.
What the interviewer is listening for
- Explains the ephemeral-IP problem
- Knows label selection + readiness-based balancing
- Distinguishes ClusterIP/NodePort/LoadBalancer and Ingress
What sinks the answer
- Cannot say why Services exist
- Confuses the types
- No notion of Ingress for L7
If you genuinely do not know
Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.
“Pods are [ephemeral with changing IPs], so a Service [gives a stable virtual IP and DNS in front of pods selected by labels, load-balancing the ready ones]. Types: [ClusterIP (internal), NodePort (a port on every node), LoadBalancer (a cloud LB)]. For HTTP routing across services, [an Ingress + controller is the L7 layer above Services].”
Keep going with kubernetes
Foundation
What problem does Kubernetes solve, and what does it actually do for you?
Foundation
What are the main components of a Kubernetes cluster (control plane and nodes)?
Foundation
What is a Pod, and why do you use a Deployment instead of creating Pods directly?
Junior
When would you use a Deployment versus a StatefulSet versus a DaemonSet?
Junior
How do you inject configuration and secrets into a pod, and what is the catch with Kubernetes Secrets?
Junior
What is the difference between liveness, readiness, and startup probes?
Knowing the answer is not the same as recalling it under pressure
Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.
Start free