Kubernetes interview question · Most asked
What happens, step by step, when you run kubectl apply for a Deployment?
Summary
kubectl sends the manifest to the API server, which authenticates and authorises the request, runs admission controllers (mutating, then validating), validates the object and stores it in etcd. The Deployment controller creates a ReplicaSet, the ReplicaSet controller creates Pods, the scheduler assigns each Pod to a node, and that node's kubelet pulls images and starts the containers through the runtime, then reports status back.
Longer Answer
Then: the kubelet runs probes; when readiness passes, the EndpointSlice controller adds the pod's IP to the Service's endpoints, and kube-proxy (or the CNI's eBPF data path) routes Service traffic to it. During an update, the Deployment controller scales a new ReplicaSet up and the old one down within maxSurge and maxUnavailable.
Knowing this chain tells you where to look when something is stuck: admission rejection (API error), Pending (scheduling), ContainerCreating or ImagePullBackOff (kubelet/runtime), not ready (probes).
Key Points
- API server: authn, authz, admission, etcd.
- Deployment then ReplicaSet then Pods.
- Scheduler binds; kubelet starts containers.
- Readiness adds the pod to Service endpoints.
Explanation
What interviewers look for
A full, correct chain, and using it to reason about where a deployment can get stuck.
More most-asked Kubernetes questions
- Describe the Kubernetes architecture: what runs on the control plane and what runs on the nodes?
- What is the difference between resource requests and limits, and what are the QoS classes?
- How do rolling updates work in a Deployment, and how do you roll back?
- Explain the Service types: ClusterIP, NodePort, LoadBalancer, ExternalName and headless.
- Deployment, StatefulSet, DaemonSet, Job and CronJob: when do you use each?
- How does the scheduler place pods? Explain resource requests, node affinity, taints and tolerations.
- ConfigMaps and Secrets: how do they differ, and how should secrets really be handled?
- Liveness, readiness and startup probes: how do you configure them correctly?