Kubernetes Interview Questions and Answers
Last updated 2026-11-19
Kubernetes interviews move quickly from definitions to scenarios: a pod is Pending, a Service has no endpoints, a rollout is stuck. The best preparation is to know the control plane components, the main objects and a repeatable troubleshooting routine. This page has 16 worked questions with YAML manifests and kubectl commands you can run on a local cluster such as kind or minikube.
Questions go from architecture to day-two operations. You will get the most from it with a cluster running next to you. For container fundamentals read the Docker questions, and for the wider role see how to crack a DevOps interview.
| Control plane | kube-apiserver, etcd, kube-scheduler, kube-controller-manager |
|---|---|
| Node components | kubelet, kube-proxy, container runtime (containerd or CRI-O) |
| Often asked | Pod lifecycle, Service types, probes, requests and limits, RBAC, debugging Pending and CrashLoopBackOff |
A troubleshooting routine to memorise
Most scenario questions are answered by walking down the same ladder. Start with kubectl get pods -o wide to see status and node. Run kubectl describe pod for events at the bottom, which explain scheduling failures, image pull errors and probe failures. Use kubectl logs, with --previous for a crashed container. Then check kubectl get events and node conditions. Saying this routine aloud before guessing causes shows interviewers a systematic approach.
kubectl get pods -o wide
kubectl describe pod web-7d9f6c5b8-abcde
kubectl logs web-7d9f6c5b8-abcde --previous
kubectl get events --sort-by=.lastTimestamp
kubectl top pod
kubectl get endpoints webKubernetes Interview Questions and Answers: questions with worked answers
1 Describe the Kubernetes architecture and what each control-plane component does.
easyThe kube-apiserver is the front door: every client and component talks to it, and it validates and persists objects. etcd is the consistent key-value store holding all cluster state, so it must be backed up. The kube-scheduler watches for unscheduled pods and assigns each to a node based on resource requests, affinity, taints and other constraints. The kube-controller-manager runs control loops (Deployment, ReplicaSet, Node, Job controllers) that continually move actual state toward desired state. On each node, the kubelet starts the pods assigned to it through the container runtime and reports status, and kube-proxy programs rules so Services route to pod IPs. The cloud-controller-manager integrates load balancers and nodes with the cloud provider.
2 What is a Pod and why does Kubernetes schedule pods instead of containers?
easyA pod is the smallest deployable unit: one or more containers that share a network namespace (one IP, localhost between them), can share volumes and are scheduled together on one node. Co-locating tightly coupled processes, such as an app and a log-shipping sidecar or an init container that prepares config, is the reason the abstraction exists. Pods are ephemeral and not self-healing: if a bare pod dies it stays dead, which is why you normally create them through a Deployment, StatefulSet, DaemonSet or Job. Pod IPs change on every recreation, so clients should use a Service.
3 Write a Deployment with three replicas, resource requests and limits, and probes.
mediumA Deployment manages a ReplicaSet that keeps the desired number of identical pods and performs rolling updates. Requests are what the scheduler reserves; limits are the cap. A readiness probe controls whether the pod is added to Service endpoints, and a liveness probe restarts a stuck container. The strategy fields control how many pods may be unavailable or extra during a rollout.
yamlapiVersion: apps/v1 kind: Deployment metadata: name: web spec: replicas: 3 selector: matchLabels: app: web strategy: type: RollingUpdate rollingUpdate: maxUnavailable: 0 maxSurge: 1 template: metadata: labels: app: web spec: containers: - name: web image: ghcr.io/example/web:1.4.2 ports: - containerPort: 8080 resources: requests: cpu: 100m memory: 128Mi limits: memory: 256Mi readinessProbe: httpGet: path: /ready port: 8080 periodSeconds: 5 livenessProbe: httpGet: path: /healthz port: 8080 initialDelaySeconds: 10 periodSeconds: 104 Explain the Service types: ClusterIP, NodePort, LoadBalancer and ExternalName. When is Ingress needed?
mediumA Service gives a stable virtual IP and DNS name in front of a changing set of pods chosen by a label selector. ClusterIP is the default and is reachable only inside the cluster. NodePort additionally opens a port (30000-32767 by default) on every node. LoadBalancer asks the cloud provider to provision an external load balancer in front of the NodePort. ExternalName returns a CNAME to an outside DNS name. Because each LoadBalancer costs money and works at layer 4, an Ingress (or the newer Gateway API) with an ingress controller such as NGINX gives layer 7 routing by host and path, TLS termination and many services behind one entry point.
5 A Service exists but requests to it fail. How do you debug it?
mediumCheck whether the Service has endpoints: kubectl get endpoints web. An empty list means the selector matches no ready pods, so compare the Service selector with pod labels using kubectl get pods --show-labels and check readiness. If endpoints exist, confirm targetPort matches the port the container actually listens on. Test from inside the cluster with a throwaway pod using curl against the service DNS name. Then look at DNS (kubectl run a busybox and nslookup), and finally at NetworkPolicies that may block traffic and at kube-proxy on the node. Most real cases are a label typo or a failing readiness probe.
bashkubectl get svc web -o yaml | grep -A3 selector kubectl get pods -l app=web --show-labels kubectl get endpoints web kubectl run tmp --rm -it --image=curlimages/curl --restart=Never -- curl -sv http://web.default.svc.cluster.local6 A pod is stuck in Pending. What are the likely causes?
mediumPending means the scheduler has not placed it, or the node has not pulled images yet. kubectl describe pod shows the reason in Events. Typical messages: Insufficient cpu or memory because requests exceed free capacity on every node; node taints with no matching toleration; a nodeSelector or affinity no node satisfies; an unbound PersistentVolumeClaim because no storage class or volume matches; or a ResourceQuota exceeded in the namespace. Fixes are to lower requests, add nodes or enable the cluster autoscaler, add tolerations, or fix the storage class. If the pod is scheduled but shows ContainerCreating, look at image pulls and volume mounts instead.
7 What causes CrashLoopBackOff and how do you fix it?
mediumThe container starts, exits, and the kubelet restarts it with exponentially increasing delay up to five minutes. Causes include an application error or missing config, a wrong command or args, a failing liveness probe killing a healthy but slow app, and out-of-memory kills (OOMKilled with exit code 137 in kubectl describe). Read kubectl logs --previous for the last run. If it is a slow start, add a startupProbe or raise initialDelaySeconds. If OOMKilled, raise the memory limit or fix the leak. If the image has no shell, use kubectl debug with an ephemeral container to inspect it.
bashkubectl logs web-abc --previous kubectl describe pod web-abc | grep -A5 'Last State' kubectl debug -it web-abc --image=busybox --target=web8 Explain resource requests and limits, and how they relate to QoS classes.
mediumThe scheduler uses requests to decide placement and the kubelet reserves that amount. Limits are enforced at runtime: exceeding a CPU limit throttles the container, exceeding a memory limit gets it OOM-killed. QoS classes derive from these. Guaranteed means every container has requests equal to limits for CPU and memory; Burstable means at least one request or limit is set but not equal; BestEffort means none are set. Under node memory pressure, BestEffort pods are evicted first, then Burstable ones exceeding their requests, and Guaranteed last. A common practice is to set memory request equal to limit and omit or loosen the CPU limit to avoid needless throttling.
9 What is the difference between a Deployment, StatefulSet and DaemonSet?
easyA Deployment runs interchangeable stateless replicas with rolling updates. A StatefulSet gives each pod a stable identity: ordered names like db-0, db-1, stable DNS through a headless Service and its own PersistentVolumeClaim from volumeClaimTemplates, with ordered startup and update; it suits databases and clustered systems such as Kafka. A DaemonSet runs exactly one pod on every node, or a selected subset, for node-level agents like log collectors, monitoring exporters and CNI plugins. Jobs and CronJobs cover run-to-completion work.
10 How do ConfigMaps and Secrets work, and are Secrets actually secure?
mediumBoth inject configuration into pods as environment variables or mounted files, keeping it out of the image. A Secret is only base64-encoded by default, which is encoding and not encryption; anyone with API read access or etcd access can decode it. Improve it by enabling encryption at rest for etcd, restricting access with RBAC, mounting as files rather than environment variables where possible, and using an external secrets operator or CSI driver to sync from Vault or a cloud secret manager. Mounted ConfigMap and Secret files update eventually when changed, but environment variables only change after a pod restart.
11 How does RBAC work in Kubernetes? Create a read-only role for pods in one namespace.
mediumRBAC grants permissions through Roles, which are namespaced, and ClusterRoles, which are cluster-wide or reusable. A RoleBinding or ClusterRoleBinding attaches a role to users, groups or ServiceAccounts. Permissions are purely additive; there are no deny rules. Rules list apiGroups, resources and verbs. Check effective access with kubectl auth can-i. Apply least privilege and give workloads their own ServiceAccount instead of the default.
yamlapiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: namespace: dev name: pod-reader rules: - apiGroups: [""] resources: ["pods", "pods/log"] verbs: ["get", "list", "watch"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: namespace: dev name: read-pods subjects: - kind: User name: asha apiGroup: rbac.authorization.k8s.io roleRef: kind: Role name: pod-reader apiGroup: rbac.authorization.k8s.iobashkubectl auth can-i list pods -n dev --as asha kubectl auth can-i delete pods -n dev --as asha12 What are taints, tolerations, node affinity and pod anti-affinity?
hardA taint on a node repels pods unless they carry a matching toleration; use it to reserve nodes, for example GPU nodes. Taints repel, but they do not attract, so a tolerating pod can still land elsewhere. Node affinity attracts pods to nodes by label, either required during scheduling or only preferred. Pod anti-affinity spreads replicas away from each other, for instance one per node or zone, to survive a failure; topologySpreadConstraints is the more modern and flexible way to express even spreading across zones. Combine taints with node affinity to dedicate a node pool to a workload.
13 How does a rolling update work, and how do you roll back?
mediumOn a change to the pod template, the Deployment creates a new ReplicaSet and scales it up while scaling the old one down, respecting maxSurge and maxUnavailable, and only proceeds as new pods become ready. If new pods never become ready, the rollout stalls and the old pods keep serving, which is exactly why readiness probes matter. Check progress with kubectl rollout status, view revisions with rollout history, and revert with rollout undo, optionally to a specific revision. Set revisionHistoryLimit sensibly, because old ReplicaSets are what make rollback possible.
bashkubectl set image deployment/web web=ghcr.io/example/web:1.4.3 kubectl rollout status deployment/web kubectl rollout undo deployment/web --to-revision=214 Explain PersistentVolumes, PersistentVolumeClaims and StorageClasses.
mediumA PersistentVolume is a piece of storage in the cluster. A PersistentVolumeClaim is a request for storage with a size and access mode, which the pod then mounts. A StorageClass describes a type of storage and its provisioner, so that dynamic provisioning creates a volume automatically when a claim appears. Access modes include ReadWriteOnce (one node), ReadOnlyMany, ReadWriteMany and ReadWriteOncePod. The reclaim policy, Delete or Retain, decides what happens to data when the claim is deleted; Retain is safer for important data. With WaitForFirstConsumer binding, a volume is created in the zone where the pod is scheduled, which avoids cross-zone mismatches.
15 How does the Horizontal Pod Autoscaler decide replica counts?
hardThe HPA compares an observed metric to its target and computes desiredReplicas = ceil(currentReplicas x currentMetric / targetMetric). For CPU utilisation, the metric is the percentage of the pod's request, so pods must define CPU requests for it to work, and the metrics-server must be installed. It scales on custom or external metrics too, and applies stabilisation windows and behaviour policies to avoid flapping. HPA changes replica count, VPA adjusts pod requests, and the cluster autoscaler or Karpenter adds nodes when pods cannot be scheduled. Do not drive the same resource with both HPA and VPA on CPU.
bashkubectl autoscale deployment web --cpu-percent=70 --min=3 --max=10 kubectl get hpa web16 What is a NetworkPolicy and what is its default behaviour?
hardBy default every pod can talk to every other pod. A NetworkPolicy selects pods and restricts ingress, egress or both; once a pod is selected by any policy for a direction, only the traffic explicitly allowed is permitted. Policies are enforced by the CNI plugin, so they do nothing on a CNI that lacks support, such as basic flannel. A common pattern is a default-deny policy per namespace and then specific allow rules, for example letting only the web pods reach the database on port 5432. Remember to allow DNS egress to kube-dns when you deny egress.
yamlapiVersion: networking.k8s.io/v1 kind: NetworkPolicy metadata: name: db-allow-web spec: podSelector: matchLabels: app: db policyTypes: [Ingress] ingress: - from: - podSelector: matchLabels: app: web ports: - protocol: TCP port: 543217 What is Helm and how does it differ from Kustomize?
mediumHelm is a package manager: a chart bundles templated manifests plus a values file, and a release is an installed instance with revision history, so helm upgrade and helm rollback are first-class. Kustomize is template-free: you keep plain base manifests and apply overlays with patches for each environment, and it is built into kubectl through kubectl apply -k. Helm suits distributing reusable software with many options; Kustomize suits configuring your own application per environment. Many teams use both, rendering Helm charts and patching the output, and GitOps tools such as Argo CD support either.
Frequently asked questions
Should I get the CKA certification for interviews?
It helps for DevOps and platform roles because it is a hands-on, timed exam and signals practical skill. It is not required, but the practice you do for it, using kubectl fast and fixing broken clusters, is the same practice interviews reward.
Which Kubernetes version should I mention?
Say you work with a recent supported release and know that the project ships roughly three minor versions a year, supports about the latest three, and that upgrades should go one minor version at a time. Check kubernetes.io for the current release.
What is the difference between Kubernetes and Docker Swarm?
Both orchestrate containers. Kubernetes has a larger ecosystem, richer scheduling, extensibility through CRDs and operators, and wide managed-cloud support. Swarm is simpler to set up but has far smaller adoption.
Do freshers get asked about etcd backups?
Occasionally. A short answer is enough: take snapshots with etcdctl snapshot save, store them off-cluster, and test a restore, because etcd holds all cluster state.
Related guides
More in Role-wise Interview Questions by Job and Tech Stack
- Machine Learning Interview Questions and Answers
- Manual Testing Interview Questions and Answers
- MERN Stack Interview Questions and Answers
- Next.js Interview Questions and Answers (Next.js 15)
- NLP Interview Questions and Answers
- Node.js Interview Questions and Answers (Node 22)
- NumPy Interview Questions and Answers
- Pandas Interview Questions and Answers
- Performance Testing and JMeter Interview Questions
- Power BI Interview Questions and Answers
- Probability for Data Science Interview Questions and Answers
- Product Analyst Interview Questions and Answers