Kubernetes interview questions and answers for engineers
Kubernetes interview questions check that you understand the control loop behind every object: you declare a desired state, and controllers keep changing the cluster until it matches. Expect questions on pods, Deployments and StatefulSets, Services and Ingress, ConfigMaps and Secrets, probes, resource requests and limits, autoscaling and RBAC. The deciding part is usually troubleshooting: a pod stuck in Pending, CrashLoopBackOff or OOMKilled, and the exact commands you would run.
By Evin JohnPublished 7 min read
How Kubernetes is tested
Kubernetes appears in DevOps, SRE, platform and cloud engineering interviews, and in backend interviews at companies that deploy on it. Application developers are expected to read and write manifests, set probes and resources, and debug their own pods. Platform candidates get questions on cluster architecture, upgrades, networking plugins, multi-tenancy and security. Many loops include a hands-on task in a test cluster or a whiteboard walk-through of a failing deployment.
- ConceptsArchitecture and the core objects, often as "what happens when you run kubectl apply".
- ManifestsWrite or review a Deployment and Service, including labels, probes, resources and the rollout strategy.
- Behavior questionsWhat happens if a pod is deleted, a node dies, a ConfigMap changes, or the limit is too low.
- TroubleshootingA described symptom, and you name the commands and the order in which you would use them.
Kubernetes fundamentals questions
| Question | What it tests | What a strong answer shows |
|---|---|---|
What happens after kubectl apply -f deployment.yaml? | Control plane flow | The API server authenticates, authorizes and validates the object and stores it in etcd. The Deployment controller creates a ReplicaSet, which creates pods. The scheduler assigns each pod to a node, and that node's kubelet tells the container runtime to start it. |
| What does etcd store? | Cluster state | Every object's desired and observed state as a consistent key-value store. Losing it without a backup means losing the cluster's configuration. |
| What is a pod and why is it not just a container? | Workload unit | One or more containers that share a network namespace and volumes and are scheduled together, such as an app with a sidecar proxy. |
| Deployment versus ReplicaSet? | Controllers | A ReplicaSet keeps N identical pods running. A Deployment manages ReplicaSets to do rolling updates and rollbacks; you rarely create ReplicaSets yourself. |
| When do you need a StatefulSet? | State | When each replica needs a stable name, stable storage and ordered startup, such as a database or a broker cluster. |
| DaemonSet, Job and CronJob? | Workload types | A DaemonSet runs one pod per node (log agents, node monitoring). A Job runs pods to completion. A CronJob creates Jobs on a schedule. |
| What are labels and selectors for? | Grouping | Labels tag objects; selectors pick them. Services, Deployments and network policies all find their pods this way, so a typo in a label silently breaks routing. |
| What is a namespace and what does it not isolate? | Multi-tenancy | A scope for names, quotas and RBAC. Without network policies, pods in different namespaces can still talk to each other. |
| What do kubelet and kube-proxy do? | Node components | The kubelet runs and reports on the pods assigned to its node. kube-proxy programs the node's networking so Service addresses reach healthy pods. |
| How does Kubernetes relate to Docker? | Runtimes | Kubernetes talks to a CRI runtime such as containerd. Images built with Docker run unchanged because they follow the OCI image format. |
Networking, configuration and storage questions
| Question | What it tests | What a strong answer shows |
|---|---|---|
| ClusterIP, NodePort and LoadBalancer? | Service types | ClusterIP is internal only. NodePort opens the same port on every node. LoadBalancer asks the cloud provider for an external load balancer in front of the Service. |
| How does one pod find another service? | DNS | Cluster DNS gives each Service a name such as api.payments.svc.cluster.local; within the same namespace, api is enough. |
| What is a headless Service? | Direct pod addresses | A Service with no cluster IP. DNS returns the individual pod addresses, which StatefulSets use for stable per-pod names. |
| Ingress versus a LoadBalancer Service? | HTTP routing | An Ingress, served by an ingress controller, routes HTTP by host and path to many Services behind one entry point. The Gateway API is the newer, more expressive model for the same job. |
| ConfigMap versus Secret? | Configuration | Both inject configuration as env variables or files. Secrets are only base64 encoded by default; protect them with RBAC, encryption at rest, or an external secret manager. |
| You update a ConfigMap. Do running pods see it? | Config reload | Environment variables do not change until the pod restarts. Mounted files update after a delay (not with subPath), and the app must reread them. Many teams roll the Deployment on config changes. |
| PersistentVolume, PersistentVolumeClaim and StorageClass? | Storage | A claim asks for storage; a StorageClass provisions a matching volume dynamically; the PV is the actual disk bound to the claim. |
| What does a NetworkPolicy do by default? | Network security | Nothing until a policy selects a pod: then only the allowed traffic in that direction gets through. It also needs a network plugin that enforces policies. |
Scheduling, scaling and rollout questions
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
spec:
replicas: 3
selector:
matchLabels:
app: api
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:
app: api
spec:
containers:
- name: api
image: registry.example.com/api:1.8.0
ports:
- containerPort: 3000
resources:
requests:
cpu: 250m
memory: 256Mi
limits:
memory: 512Mi
readinessProbe:
httpGet:
path: /healthz/ready
port: 3000
periodSeconds: 5
livenessProbe:
httpGet:
path: /healthz/live
port: 3000
initialDelaySeconds: 10
periodSeconds: 10
---
apiVersion: v1
kind: Service
metadata:
name: api
spec:
selector:
app: api
ports:
- port: 80
targetPort: 3000- Requests versus limits? The scheduler places pods by their requests. Limits cap usage: a container over its CPU limit is throttled, and one over its memory limit is killed (OOMKilled).
- What are QoS classes? Guaranteed (requests equal limits for every container), Burstable (some requests set) and BestEffort (none). Under memory pressure, BestEffort pods are evicted first.
- Readiness, liveness and startup probes? Readiness takes a pod out of Service endpoints while it cannot serve. Liveness restarts a stuck container. A startup probe holds the other two off while a slow app boots. A liveness probe that checks the database can restart every pod during a database blip.
- How does the Horizontal Pod Autoscaler decide? It compares observed metrics, commonly CPU utilization as a percentage of the request, with a target and changes replicas. No requests set means CPU-based scaling cannot work.
- What do maxSurge and maxUnavailable control? How many extra pods may be created and how many may be missing during a rolling update. With maxUnavailable at 0, capacity never drops below the replica count.
- How do you roll back a bad release?
kubectl rollout undo deployment/api, or better, revert in Git and let the GitOps tool apply it, so the cluster and the repository agree. - What is a PodDisruptionBudget? A limit on voluntary disruptions, such as node drains during upgrades, so at least N pods of a workload stay up.
- How do you keep replicas off the same node or zone? Pod anti-affinity or topology spread constraints. Taints and tolerations keep general workloads off special nodes such as GPU pools.
- What happens on kubectl delete pod for a pod owned by a Deployment? The ReplicaSet notices one pod is missing and creates a replacement with a new name. Deleting the pod is a restart, not a removal.
- What happens if a Deployment's selector does not match its template labels? The API server rejects the Deployment. In apps/v1 the selector is also immutable after creation.
Security and senior questions
- How does RBAC work? Roles (namespaced) and ClusterRoles define verbs on resources; RoleBindings and ClusterRoleBindings grant them to users, groups or service accounts. Check with
kubectl auth can-i. - How would you harden pods? Run as non-root, a read-only root filesystem, dropped capabilities, no privilege escalation, Pod Security admission at the restricted level for app namespaces, and images from a trusted registry.
- How do workloads get cloud credentials safely? Workload identity that maps a service account to a cloud role, instead of long-lived keys in Secrets.
- What is an operator? A controller plus custom resources that encode how to run a specific system, such as creating backups or handling failover for a database.
- Helm or Kustomize? Helm packages templated charts with versions and values; Kustomize patches plain YAML in overlays. Many teams use Helm for third-party software and Kustomize or plain manifests for their own.
- How do you upgrade a cluster safely? Read the deprecations for the target version, upgrade the control plane first, then node pools one at a time with drains, PodDisruptionBudgets in place and a rollback plan.
Troubleshooting scenarios
| Scenario | Likely cause | What to say you would check |
|---|---|---|
| Pod stuck in Pending. | Unschedulable | kubectl describe pod events: insufficient CPU or memory for the requests, a taint without a toleration, an affinity rule nothing satisfies, or an unbound volume claim. |
| ImagePullBackOff. | Image cannot be fetched | A wrong tag, a private registry without pull secrets, or the node lacking network access to the registry. |
| CrashLoopBackOff. | The container keeps exiting | kubectl logs --previous for the last crash, then configuration, missing Secrets, and a liveness probe that fires before the app is ready. |
| Status shows OOMKilled and restarts climb. | Memory limit | Compare usage with the limit over time. Raise the limit, fix the leak, or tune the runtime's heap size to fit inside the limit. |
| The Service returns connection refused, but pods are Running. | Routing | kubectl get endpoints (or EndpointSlices): empty means the selector does not match the pod labels, or pods are not ready. Also check targetPort against the container port. |
| Latency spikes, CPU usage looks low. | CPU throttling | A tight CPU limit throttles bursts. Check throttling metrics and consider raising or removing the CPU limit while keeping requests. |
| A node shows NotReady. | Node health | kubelet status, disk or memory pressure, network to the control plane. Pods on it are eventually rescheduled if they belong to controllers. |
kubectl get pods -n payments -o wide
kubectl describe pod api-7f9c6d8b5-x2k4q -n payments
kubectl logs api-7f9c6d8b5-x2k4q -n payments --previous
kubectl get events -n payments --sort-by=.lastTimestamp
kubectl get endpointslices -n payments -l kubernetes.io/service-name=api
kubectl top pod -n payments
kubectl rollout status deployment/api -n payments
kubectl rollout undo deployment/api -n paymentsFictional example
- I would first find out which kind of restart it is.
kubectl describe podshows the last state: if the reason is OOMKilled, it is memory; if the events show liveness probe failures, it is the probe. Say it is the probe. Under load the app's health endpoint queues behind real requests, takes longer than the probe timeout, and the kubelet kills a container that was only busy, which pushes more load onto the others and they fail too. I would make liveness check only that the process is alive and responsive, move dependency checks to readiness, lengthen the timeout and failure threshold, and add a startup probe if boot is slow. Then I would load test again and watch restarts and p99 latency, and look at whether CPU limits are throttling the pods, because throttling makes the same symptom.
Kubernetes practice plan
- Days 1 to 3: run a local cluster (kind, minikube or k3d). Deploy an app with a Deployment, Service and Ingress, written by hand rather than copied.
- Days 4 to 6: break it on purpose: wrong image tag, wrong label, memory limit too low, liveness probe on a slow path. Fix each using only get, describe, logs and events.
- Days 7 to 9: add an HPA, a PodDisruptionBudget, a NetworkPolicy and a service account with a narrow Role. Explain each in two sentences.
- Day 10: say the
kubectl applyflow from API server to kubelet out loud until it takes under a minute.
Containers come first: the image side is in Docker interview questions, and managed clusters on EKS appear in AWS interview questions. For the full role, see DevOps engineer interview questions.
Troubleshooting rounds reward a calm, ordered explanation. If you rehearse with Natively, an AI interview assistant for Mac and Windows, it writes a transcript of the mock session on your computer so you can check whether you described the pod before guessing at a fix. During practice it can read a manifest or a kubectl output from a screenshot and point at likely problems, and with Pro or the free trial it can use your résumé and the job description you add. You keep the transcript and notes afterwards.
Questions people ask
What Kubernetes questions are asked in interviews?
What happens on kubectl apply, pods versus Deployments versus StatefulSets, Service types and Ingress, ConfigMaps and Secrets, probes, requests and limits, autoscaling, RBAC, and how you debug Pending, CrashLoopBackOff and OOMKilled pods.
How do I answer Kubernetes troubleshooting questions?
Start from the pod's state, then name the commands in order: describe for events, logs with --previous for crashes, endpoints for routing, and top or metrics for resources. Form one hypothesis at a time.
What is the difference between liveness and readiness probes?
A readiness probe removes a pod from Service traffic while it cannot serve. A liveness probe restarts the container when it is stuck. Keep dependency checks out of liveness.
Are Kubernetes developer and administrator interviews different?
Developer interviews focus on manifests, probes, resources and debugging your own workloads. Administrator and platform interviews add cluster architecture, upgrades, networking plugins, security and multi-tenancy.
Where to go next
Practice with the same assistant you would use on a call: it listens, transcribes and suggests answers from your own resume and the job description.
Facts on this page were last checked on . Product details come from the Natively app itself; if something here is out of date, tell us at hello@heynatively.com.
