Kubernetes interview questions are now part of almost every backend, DevOps and cloud engineer interview, because most companies run their containers on Kubernetes. This post gives you 110 of the most asked questions, grouped from basic to advanced, and every one of them now has a full answer in simple English, with YAML and kubectl examples you can try.
You should first be comfortable with containers, so read our Docker interview questions before this list. If you build Go services, the Go microservices basics guide and the Go microservices scenario questions show how apps behave inside a cluster. The answers here match current Kubernetes releases (v1.37 at the time of writing).
What Do Kubernetes Interview Questions Cover?
Kubernetes (often written K8s) is an open-source system that runs and manages containers across many machines. You tell it what you want, such as “run 3 copies of my API”, and it keeps working to make that true.
Think of a restaurant manager. The manager does not cook. Instead, they watch the kitchen, give orders to cooks, and replace a cook who goes home sick, so customers always get their food. Kubernetes is that manager for your containers.
Most Kubernetes interview questions test six areas: architecture, pods, workloads, networking, storage and security. Senior rounds add scaling, troubleshooting and real outage scenarios.
How to Use These Kubernetes Interview Questions
Do not try to learn 110 answers by heart. Instead, use the list in three passes.
- First, read each question and try to answer it in two or three sentences before you read the answer.
- Next, practise those out loud with an example from a real cluster, even a local one.
- Finally, run the YAML and kubectl commands from the hands-on section on a local cluster such as kind or minikube.
The table below shows how interview rounds usually use these questions.
| Round | Focus | Question range |
|---|---|---|
| Phone screen | Basics and architecture | Q1 to Q25 |
| Technical round | Pods, workloads, services, config, storage | Q26 to Q80 |
| Senior or SRE round | Scaling, security, troubleshooting | Q81 to Q110 |
| Hands-on test | Write a Deployment and Service | Hands-on section |
How Kubernetes Works
A cluster has two parts. The control plane makes decisions, and the worker nodes run your containers inside pods.

When you run kubectl apply, the API server checks the request and saves it in etcd. The scheduler then picks a node for each new pod, and the kubelet on that node starts the containers through the container runtime. Meanwhile, controllers keep comparing the real state with the desired state and fix any gap.
Basic Kubernetes Interview Questions with Answers
These Kubernetes interview questions check that you know the core words and the architecture. Freshers should be able to answer all of them, so read each answer slowly and try the commands on a local cluster.
Q1. What is Kubernetes, and what problems does it solve?
Kubernetes (often written K8s) is an open-source platform that runs and manages containers across a group of machines. Google created it based on its internal system Borg, and it is now maintained by the Cloud Native Computing Foundation (CNCF).
It solves the problems you get when you run many containers in production.
- Scheduling: it decides which machine runs each container.
- Self-healing: it restarts crashed containers and replaces pods on failed machines.
- Scaling: it adds or removes copies of your app based on load.
- Service discovery and load balancing: it gives apps stable names and spreads traffic.
- Rolling updates and rollbacks: it updates apps with no downtime and can undo a bad release.
- Config and secrets: it passes settings to apps without rebuilding images.
Q2. Why do we need Kubernetes if we already have Docker?
Docker builds images and runs containers on one machine. That is enough for a laptop or a small server. However, in production you usually have many machines and many containers, and someone has to decide where each one runs, restart it when it dies and update it safely.
Kubernetes does that job across a whole cluster. So Docker (or another tool) packs your app into an image, and Kubernetes runs that image at scale. They work together, they are not rivals.
Q3. What is a cluster, a node and a pod?
These are the three basic building blocks.
- Cluster: the whole Kubernetes system, a group of machines managed together.
- Node: one machine in the cluster, either a physical server or a virtual machine. Worker nodes run your apps, and control plane nodes run the management parts.
- Pod: the smallest unit Kubernetes runs. It wraps one or more containers that share an IP address and can share storage.
Think of a cluster as an office building, nodes as floors and pods as desks where the work happens.
Q4. What are the main parts of the control plane?
The control plane is the “brain” of the cluster. It makes decisions and stores the state.
| Part | Job |
|---|---|
| kube-apiserver | Front door: every request goes through it |
| etcd | Database that stores the full cluster state |
| kube-scheduler | Picks a node for each new pod |
| kube-controller-manager | Runs control loops that fix differences between wanted and real state |
| cloud-controller-manager | Talks to the cloud provider, such as for load balancers |
In managed services like EKS, GKE and AKS, the cloud provider runs the control plane for you, so you only manage the worker nodes.
Q5. What does the API server do?
The API server (kube-apiserver) is the only part that everyone talks to. kubectl, the kubelet on each node, controllers and your CI pipeline all send requests to it. It is a REST API over HTTPS.
For each request, it first checks who you are (authentication), then what you are allowed to do (authorization, usually RBAC), then runs admission controllers that can change or reject the request. Only then does it save the object in etcd. It is also the only part that talks to etcd directly.
Q6. What is etcd, and why is it so important?
etcd is a distributed key-value database that stores the entire state of the cluster: every pod, Service, Secret, ConfigMap and node. It uses the Raft consensus algorithm, so several etcd members agree on every write and the data survives if one member fails.
It is so important because the cluster is only as good as its data. If etcd is lost and you have no backup, you lose the record of everything running in the cluster. That is why you run an odd number of etcd members, such as 3 or 5, and back it up regularly.
Q7. What does the scheduler do?
The scheduler watches for new pods that do not have a node yet. For each one, it picks the best node in two steps.
- First, filtering: remove nodes that cannot run the pod, for example because they lack enough CPU or memory, have a taint the pod does not tolerate, or do not match its node selector.
- Next, scoring: rank the remaining nodes, for example preferring nodes with more free resources or spreading pods across zones.
Then it writes the chosen node name into the pod. The scheduler does not start the pod itself. The kubelet on that node does.
Q8. What does the controller manager do?
The controller manager runs many controllers in one process. A controller is a loop that watches some objects, compares the desired state with the real state, and makes changes to close the gap.
For example, the ReplicaSet controller sees that you want 3 pods but only 2 exist, so it creates one more. The Node controller notices when a node stops responding, and the Job controller creates pods until a job finishes. This “watch and fix” pattern is the heart of how Kubernetes works.
Q9. What does the kubelet do on each node?
The kubelet is an agent that runs on every node. It watches the API server for pods assigned to its node, then asks the container runtime to pull images and start the containers. It also mounts volumes, runs liveness, readiness and startup probes, and restarts containers when needed.
Finally, it reports the status of the node and its pods back to the API server. If the kubelet stops, the node becomes NotReady, and its pods are eventually moved elsewhere.
Q10. What does kube-proxy do?
kube-proxy runs on every node and makes Services work. When a pod sends traffic to a Service IP, kube-proxy’s rules send it to one of the healthy pods behind that Service.
It does this by writing network rules on the node, using iptables, IPVS or the newer nftables mode. Some network plugins, such as Cilium, can replace kube-proxy completely with eBPF programs, which can be faster at large scale.
Q11. What is a container runtime, and which ones does Kubernetes support?
The container runtime is the software that actually pulls images and runs containers on a node. The kubelet tells it what to do. Kubernetes supports any runtime that implements the Container Runtime Interface (CRI).
The two most common are containerd and CRI-O. Both run standard OCI images, including images built with Docker. Docker Engine itself is no longer used directly as a runtime, since the dockershim adapter was removed in v1.24.
Q12. What is the CRI (Container Runtime Interface)?
The CRI is a standard API between the kubelet and the container runtime. It defines calls like “pull this image”, “start this container” and “list containers”.
Because of the CRI, Kubernetes does not need special code for each runtime. Any runtime that speaks CRI, such as containerd or CRI-O, can be plugged in. This is why Kubernetes could drop the Docker-specific shim without breaking images.
Q13. What is desired state, and what is a reconciliation loop?
Desired state is what you tell Kubernetes you want, written in a manifest, such as “3 replicas of my API using image version 1.4”. Actual state is what is really running right now.
A reconciliation loop is how controllers close the gap. They keep watching, compare the two states and act. If a pod crashes, the actual count drops to 2, the loop notices and creates a new pod. It works like a thermostat: you set 24°C, and it keeps switching the AC on and off to stay there.
Q14. What is the difference between declarative and imperative commands?
Imperative commands tell Kubernetes exactly what action to do now. Declarative configuration describes the end result you want, and Kubernetes works out the steps.
| Style | Example | Good for |
|---|---|---|
| Imperative | kubectl create deployment api --image=api:1.0, kubectl scale deploy api --replicas=5 | Quick tests and learning |
| Declarative | kubectl apply -f deployment.yaml | Real projects, Git, CI/CD |
So in real work, you keep YAML files in Git and use kubectl apply or a GitOps tool. Then the files are the single source of truth, and every change is reviewed and repeatable.
Q15. What is kubectl, and what is a kubeconfig file?
kubectl is the command-line tool for talking to a Kubernetes cluster. It sends requests to the API server, for example to list pods, apply YAML or read logs.
A kubeconfig file, usually ~/.kube/config, tells kubectl where the cluster is and how to log in. It holds clusters (API server addresses), users (credentials) and contexts (a cluster plus a user plus a default namespace).
kubectl config get-contexts # list contexts
kubectl config use-context prod-cluster # switch cluster
kubectl get pods -n shop # list pods in a namespace
Q16. What is a namespace, and when do you create one?
A namespace splits one cluster into separate areas. Names must be unique inside a namespace, but the same name can exist in different namespaces. You can also set RBAC rules, resource quotas and network policies per namespace.
Create namespaces per team, per app or per environment, such as shop-dev and shop-test. Many companies still use separate clusters for production, because namespaces share the same nodes and control plane. Kubernetes has some built-in namespaces, such as default and kube-system.
Q17. What are labels and selectors?
Labels are key-value tags you attach to objects, such as app: shop-api and env: prod. Selectors find objects by their labels.
They are how Kubernetes links objects together. A Service sends traffic to every pod whose labels match its selector, and a Deployment manages the pods that match its selector. You can also use them on the command line.
kubectl get pods -l app=shop-api,env=prod
Q18. What are annotations, and how are they different from labels?
Both are key-value data in an object’s metadata. Labels are short and are used for selecting and grouping objects. Annotations hold extra information that is not used for selection, and they can be long.
Tools read annotations for settings. For example, an ingress controller might read a timeout annotation, Prometheus might read a scrape annotation, and kubectl saves a “last applied configuration” annotation. So use labels to find things, and annotations to describe them.
Q19. What happens step by step when you run kubectl apply -f deployment.yaml?
This question tests whether you understand the whole flow.
- First, kubectl reads the file and sends it to the API server.
- Next, the API server checks authentication, authorization and admission rules, then stores the Deployment in etcd.
- Then the Deployment controller sees the new Deployment and creates a ReplicaSet.
- The ReplicaSet controller creates the pod objects it needs.
- After that, the scheduler assigns each pod to a node.
- The kubelet on each node sees its new pod and asks the container runtime to pull the image and start the containers.
- Finally, once readiness probes pass, the pods are added to matching Services and start getting traffic.
Q20. What is the cloud controller manager?
The cloud controller manager connects Kubernetes to a cloud provider’s API. It keeps cloud-specific code out of the core of Kubernetes.
For example, when you create a Service of type LoadBalancer, it asks AWS, Google Cloud or Azure to create a real load balancer. It also checks whether a cloud VM behind a node still exists, and sets up network routes. On-premise clusters often do not use it.
Q21. What are managed Kubernetes services such as EKS, GKE and AKS?
These are Kubernetes clusters run by cloud providers: Amazon EKS, Google GKE and Azure AKS. The provider runs and upgrades the control plane, including etcd, and keeps it highly available. You mostly manage your worker nodes and workloads.
Many offer even more managed modes, such as GKE Autopilot or EKS with Fargate and Auto Mode, where the provider also manages the nodes. Most companies use a managed service, because running the control plane yourself is a lot of work.
Q22. How do you run Kubernetes on your laptop for practice?
You can run a small cluster on your laptop for free. Popular tools are kind (Kubernetes in Docker), minikube, k3d (which runs the light k3s distribution) and Docker Desktop’s built-in Kubernetes.
kind create cluster --name practice
kubectl get nodes
kubectl create deployment hello --image=nginx:1.27
kubectl get pods
kind is great for CI and quick tests, and minikube has many add-ons. Practising on one of these is the best way to prepare for hands-on interview tasks.
Q23. What is a manifest, and which fields does every object have?
A manifest is a YAML (or JSON) file that describes a Kubernetes object you want. Almost every object has the same four top-level fields.
apiVersion: apps/v1 # which API group and version
kind: Deployment # what type of object
metadata: # name, namespace, labels, annotations
name: shop-api
namespace: shop
spec: # the desired state
replicas: 3
After you create the object, Kubernetes adds a status field that shows the actual state.
Q24. What is the difference between spec and status?
spec is the desired state you write, such as “3 replicas using image 1.4”. status is the actual state that Kubernetes writes back, such as “2 replicas ready, 1 updating”.
Controllers keep reading spec and status and work to make them match. So you edit spec, and you read status to see progress. For example, kubectl get deploy shows READY 2/3 from the status.
Q25. How does Kubernetes release new versions, and how often?
Kubernetes releases a new minor version about three times a year, roughly every 15 weeks. Versions are written as v1.MINOR.PATCH, such as v1.37.1. Patch releases with bug and security fixes come out often for supported versions.
The project supports the newest three minor versions, each for about 14 months. So you should upgrade at least once a year, one minor version at a time. New features usually move through alpha, beta and stable (GA) stages over several releases.
Pod Kubernetes Interview Questions with Answers
The pod is the smallest unit in Kubernetes. So interviewers ask many Kubernetes interview questions about it, especially probes, crashes and shutdown.
Q26. What is a pod, and why does Kubernetes not run containers directly?
A pod is a wrapper around one or more containers that always run together on the same node. Containers in a pod share one network namespace, so they share an IP address and can talk over localhost. They can also share volumes.
Kubernetes uses pods instead of bare containers because some containers need to work as a team. For example, an app and its log shipper need the same files and network. A pod gives them one shared “home”. In most cases, though, a pod has just one main container.
apiVersion: v1
kind: Pod
metadata:
name: hello
labels:
app: hello
spec:
containers:
- name: web
image: nginx:1.27
ports:
- containerPort: 80
Q27. When would you put more than one container in a pod?
Only when the containers are tightly coupled, meaning they must share the same network or files and always be scheduled together. Common patterns are listed below.
- Sidecar: a helper that adds a feature, such as a log shipper or a service mesh proxy.
- Ambassador: a local proxy that hides how to reach an outside service.
- Adapter: changes the app’s output into a standard format, such as metrics for Prometheus.
Do not put an app and its database in one pod. They scale differently, so they should be separate pods connected through a Service.
Q28. What is a sidecar container, and how do native sidecars work?
A sidecar is a helper container that runs next to the main app container in the same pod. Examples are an Envoy proxy, a log collector or a tool that refreshes certificates.
Before native sidecars, sidecars were just normal containers, which caused problems. They could start after the app, and a Job never finished because the sidecar kept running. Native sidecars, stable since v1.33, are init containers with restartPolicy: Always. Kubernetes starts them before the app containers, keeps them running for the life of the pod and stops them after the main containers exit.
spec:
initContainers:
- name: log-shipper
image: fluent/fluent-bit:4.0
restartPolicy: Always # this makes it a native sidecar
containers:
- name: api
image: shop-api:1.4.0
Q29. What is an init container?
An init container runs to completion before the app containers start. If there are several, they run one after another, in order. If one fails, Kubernetes restarts it until it succeeds, and the app containers never start until all init containers finish.
They are useful for setup work, such as waiting for a database to be reachable, running database migrations, downloading config or fixing file permissions on a volume. They can use a different image with tools the app image does not need.
Q30. What are the phases of a pod: Pending, Running, Succeeded, Failed and Unknown?
The phase is a simple summary of where a pod is in its life.
| Phase | Meaning |
|---|---|
| Pending | Accepted, but not all containers are running yet (scheduling or pulling images) |
| Running | Bound to a node, and at least one container is running |
| Succeeded | All containers finished with exit code 0 and will not restart |
| Failed | All containers stopped, and at least one failed |
| Unknown | The node cannot be reached, so the state is unknown |
Words like CrashLoopBackOff and ImagePullBackOff are not phases. They are container states shown in the STATUS column of kubectl get pods.
Q31. What does CrashLoopBackOff mean?
It means a container keeps starting and crashing, so Kubernetes waits longer between each restart. The wait (back-off) doubles each time, from 10 seconds up to 5 minutes. It is a symptom, not the cause.
To find the cause, check the logs of the crashed run and the events.
kubectl logs shop-api-7c9f --previous # logs from the last crashed run
kubectl describe pod shop-api-7c9f # exit code, reason, events
Common causes are an app error at startup, a missing environment variable or Secret, a wrong command, a failing liveness probe, or the container being OOMKilled.
Q32. What does ImagePullBackOff mean?
It means the kubelet could not pull the container image, so it keeps retrying with growing delays. ErrImagePull is the first failure, and ImagePullBackOff means it is waiting before the next try.
Common causes are a typo in the image name or tag, a tag that does not exist, a private registry without an imagePullSecret, registry rate limits (such as Docker Hub) or no network access from the node. kubectl describe pod shows the exact error message in its events.
Q33. What are liveness, readiness and startup probes?
Probes are health checks the kubelet runs on a container. Each type answers a different question.
| Probe | Question | On failure |
|---|---|---|
| Liveness | Is the app stuck or dead? | The container is restarted |
| Readiness | Can it take traffic right now? | Removed from Service endpoints, no restart |
| Startup | Has the app finished starting? | Other probes wait, and the container restarts if it never starts |
A probe can be an HTTP GET, a TCP connection, a gRPC health check or a command.
readinessProbe:
httpGet:
path: /readyz
port: 8080
periodSeconds: 5
livenessProbe:
httpGet:
path: /healthz
port: 8080
periodSeconds: 10
failureThreshold: 3
Q34. What happens when a readiness probe fails?
The pod is marked as not ready and is removed from the endpoints of every Service that selects it. So it stops getting new traffic, but the container is not restarted. When the probe passes again, the pod goes back into the Service.
This is useful during startup, while warming a cache, or when a dependency like the database is down for a moment. During a rolling update, the Deployment also waits for new pods to become ready before it removes old ones.
Q35. What happens when a liveness probe fails?
After the probe fails failureThreshold times in a row, the kubelet kills the container and restarts it, based on the pod’s restart policy. This helps recover apps that are stuck, for example in a deadlock, but still running.
Be careful: a liveness probe that checks the database will restart every pod when the database has a short outage, which makes things worse. So keep liveness checks simple, such as “can the process answer at all”, and set sensible timeouts.
Q36. What is the pod restart policy?
restartPolicy decides what the kubelet does when a container in the pod exits.
- Always: restart the container whenever it stops. This is the default, and Deployments require it.
- OnFailure: restart only if it exits with an error. Common for Jobs.
- Never: never restart. Also used for Jobs that should fail fast.
Restarts happen on the same node, with the back-off delay described for CrashLoopBackOff. If the whole node fails, it is the controller (such as a ReplicaSet) that creates a new pod on another node.
Q37. How does a pod shut down, and what is terminationGracePeriodSeconds?
When a pod is deleted, for example during a rolling update, Kubernetes follows these steps.
- First, the pod is marked as terminating and removed from Service endpoints, so new traffic stops.
- Next, any
preStophook runs. - Then the kubelet sends SIGTERM to the main process in each container.
- The app has
terminationGracePeriodSeconds(30 seconds by default) to finish requests and exit. - Finally, if it is still running after that, the kubelet sends SIGKILL.
So your app must handle SIGTERM and shut down cleanly. In Go, catch it with signal.NotifyContext and call http.Server.Shutdown.
Q38. What is a preStop hook?
A preStop hook is a command or HTTP call that runs right before the container gets SIGTERM. It counts against the grace period.
A common use is a short sleep. Removing the pod from Service endpoints happens at the same time as shutdown starts, and it can take a few seconds to reach every node. So a 5 to 10 second wait lets old traffic drain and avoids errors during deploys.
lifecycle:
preStop:
sleep:
seconds: 10 # built-in sleep action, no shell needed
Q39. What is an ephemeral container, and how does kubectl debug use it?
An ephemeral container is a temporary container you add to a running pod for debugging. It cannot have ports or probes, and it is not restarted. It is useful when the app image has no shell or tools, such as a distroless image.
kubectl debug -it shop-api-7c9f --image=busybox:1.37 --target=api
The --target flag shares the process namespace with the app container, so you can see its processes. kubectl debug can also copy a pod with changes, or open a shell on a node with kubectl debug node/<name>.
Q40. What is a static pod?
A static pod is managed directly by the kubelet on one node, not by the API server. You put its YAML file in a folder on the node, usually /etc/kubernetes/manifests, and the kubelet starts it and keeps it running.
The API server shows a read-only “mirror pod” for it, but you cannot control it with kubectl. Clusters built with kubeadm run the control plane parts, such as the API server, etcd and scheduler, as static pods. This solves the chicken-and-egg problem of starting the API server itself.
Workload Kubernetes Interview Questions with Answers
You rarely create pods by hand. Instead, you use workload objects that create and manage pods for you, and these Kubernetes interview questions cover them.
Q41. What is a ReplicaSet?
A ReplicaSet makes sure a set number of identical pods is always running. If a pod dies or a node fails, it creates a new one. If there are too many, it deletes some. It finds its pods with a label selector.
You almost never create a ReplicaSet directly. A Deployment creates and manages ReplicaSets for you, and adds rolling updates and rollbacks on top.
Q42. What is a Deployment, and how is it related to a ReplicaSet?
A Deployment is the standard way to run stateless apps, such as APIs and web servers. You describe the pod template and the number of replicas, and the Deployment does the rest.
Each time you change the pod template, for example a new image tag, the Deployment creates a new ReplicaSet and slowly moves pods from the old one to the new one. It keeps old ReplicaSets (scaled to zero) so you can roll back.
apiVersion: apps/v1
kind: Deployment
metadata:
name: shop-api
spec:
replicas: 3
selector:
matchLabels:
app: shop-api
template:
metadata:
labels:
app: shop-api
spec:
containers:
- name: api
image: registry.example.com/shop-api:1.4.0
ports:
- containerPort: 8080
Q43. How does a rolling update work?
A rolling update replaces old pods with new ones a few at a time, so the app stays available. It is the default strategy for Deployments.
- First, you change the pod template, for example with a new image.
- Next, the Deployment creates a new ReplicaSet and starts some new pods.
- Then it waits until the new pods pass their readiness probes.
- After that, it scales down the old ReplicaSet a little, and repeats.
- Finally, all pods run the new version, and the old ReplicaSet has zero pods.
You can watch it with kubectl rollout status deployment/shop-api. If new pods never become ready, the rollout stops, and the old pods keep serving traffic.
Q44. What do maxSurge and maxUnavailable control?
These two settings control the speed and safety of a rolling update. Both can be a number or a percentage.
- maxSurge: how many extra pods can exist above the desired count during the update. Default 25%.
- maxUnavailable: how many pods can be unavailable during the update. Default 25%.
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0 # never go below full capacity
With maxUnavailable: 0, Kubernetes always starts a new pod before removing an old one. It is the safest setting, but it needs spare cluster capacity.
Q45. How do you roll back a Deployment?
Kubernetes keeps a history of revisions, one per ReplicaSet. You can go back to the previous one or to a specific revision.
kubectl rollout history deployment/shop-api
kubectl rollout undo deployment/shop-api # previous revision
kubectl rollout undo deployment/shop-api --to-revision=3
The number of old revisions kept is set by revisionHistoryLimit, which defaults to 10. In a GitOps setup, it is better to revert the change in Git, so the cluster and Git stay the same.
Q46. What is a StatefulSet, and when do you need one?
A StatefulSet runs pods that each need a stable identity and their own storage. Each pod gets a fixed name with a number, such as db-0, db-1 and db-2, a stable DNS name and its own PersistentVolumeClaim that follows it if it moves to another node.
You need it for stateful systems where pods are not interchangeable, such as databases (PostgreSQL, MySQL), message brokers (Kafka, RabbitMQ) and clustered stores (Elasticsearch, etcd). Pods start one by one in order, and stop in reverse order.
Q47. How is a StatefulSet different from a Deployment?
A Deployment treats all pods as identical and replaceable. A StatefulSet gives each pod its own name, order and storage. The table below sums up the main differences.
| Feature | Deployment | StatefulSet |
|---|---|---|
| Pod names | Random, such as api-7c9f-x2k | Stable, such as db-0 and db-1 |
| Storage | Usually shared or none | One PVC per pod |
| Start and stop order | Any order | One by one, in order |
| Network identity | Through a normal Service | Stable DNS through a headless Service |
| Best for | Stateless APIs and web apps | Databases, queues, clusters |
| Scaling | Fast and simple | Slower and careful |

So use a Deployment for almost every app you build. Choose a StatefulSet only when each pod needs its own identity or its own data. Many teams use a managed database outside the cluster instead.
Q48. What is a DaemonSet, with a real example?
A DaemonSet runs one copy of a pod on every node (or on every node that matches a selector). When a new node joins, the DaemonSet adds the pod there automatically, and when a node leaves, the pod goes too.
Real examples are log collectors such as Fluent Bit, monitoring agents such as the Prometheus node exporter, network plugins such as Cilium or Calico, and storage drivers. kube-proxy also runs as a DaemonSet in many clusters.
Q49. What is a Job?
A Job runs pods until a task finishes successfully, then stops. It is for one-off or batch work, such as a database migration, a data import or sending a report. If a pod fails, the Job retries it, up to backoffLimit times.
apiVersion: batch/v1
kind: Job
metadata:
name: db-migrate
spec:
backoffLimit: 3
ttlSecondsAfterFinished: 3600 # clean up an hour after it finishes
template:
spec:
restartPolicy: OnFailure
containers:
- name: migrate
image: shop-api:1.4.0
command: ["/app", "migrate"]
You can also run many pods in parallel with parallelism and completions, for example to process a queue.
Q50. What is a CronJob?
A CronJob creates Jobs on a schedule, written in cron format, such as "0 2 * * *" for 2 AM every day. It is used for backups, nightly reports, cleanup tasks and sending reminder emails.
apiVersion: batch/v1
kind: CronJob
metadata:
name: nightly-report
spec:
schedule: "0 2 * * *"
timeZone: "Asia/Kolkata"
concurrencyPolicy: Forbid # do not start a new run if the last one is still running
jobTemplate:
spec:
template:
spec:
restartPolicy: OnFailure
containers:
- name: report
image: shop-report:2.1.0
Since a run can be missed or started twice in rare cases, make the job safe to run more than once.
Q51. How do you run a blue-green or canary release in Kubernetes?
Kubernetes Deployments only do rolling updates by default, but you can build other strategies.
- Blue-green: run two Deployments,
blue(current) andgreen(new). When green is tested, switch the Service selector from blue to green in one step. Rollback is switching back. - Canary: send a small share of traffic, such as 5%, to the new version first, watch errors and latency, then increase step by step.
A simple canary is two Deployments behind one Service, with replica counts setting the split. For exact percentages and automatic analysis, teams use the Gateway API traffic weights, a service mesh, or tools such as Argo Rollouts and Flagger.
Q52. What is a PodDisruptionBudget?
A PodDisruptionBudget (PDB) limits how many pods of an app can be down at once during voluntary disruptions. Voluntary disruptions are planned events, such as draining a node for an upgrade or the cluster autoscaler removing a node.
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: shop-api-pdb
spec:
minAvailable: 2
selector:
matchLabels:
app: shop-api
With this PDB, kubectl drain waits rather than evicting a pod that would leave fewer than 2 running. It does not protect against crashes or node failures, which are involuntary.
Q53. What is a headless Service, and why do StatefulSets use one?
A headless Service is a Service with clusterIP: None. It has no virtual IP and no load balancing. Instead, a DNS lookup returns the IP addresses of the pods directly, and each pod gets its own DNS name.
StatefulSets use one so every pod has a stable address, such as db-0.db.shop.svc.cluster.local. This lets clients and cluster members talk to a specific pod, for example to always write to the primary database db-0.
Service and Networking Kubernetes Interview Questions with Answers
Networking is where many candidates struggle. These Kubernetes interview questions start simple and get deeper, so make sure you can explain how a request travels from the internet to a pod.
Q54. Why do pods need a Service in front of them?
Pods are temporary. They are created, killed and moved all the time, and each new pod gets a new IP address. So if one app called another app’s pod IP directly, it would break after the next deploy.
A Service gives a group of pods one stable name and one stable virtual IP. It keeps track of which pods are healthy and spreads traffic across them. So other apps just call http://shop-api:8080, and the Service handles the rest.
apiVersion: v1
kind: Service
metadata:
name: shop-api
spec:
selector:
app: shop-api # send traffic to pods with this label
ports:
- port: 8080 # the Service port
targetPort: 8080 # the container port
Q55. What are the Service types: ClusterIP, NodePort, LoadBalancer and ExternalName?
Each Service type decides who can reach the Service and how.
| Type | Reachable from | How it works |
|---|---|---|
| ClusterIP | Inside the cluster only | A virtual IP inside the cluster. This is the default |
| NodePort | Outside, through any node’s IP | Opens the same port (30000 to 32767) on every node |
| LoadBalancer | The internet or your network | Asks the cloud to create an external load balancer |
| ExternalName | Inside the cluster | A DNS alias (CNAME) to an outside name, such as a managed database |
So use ClusterIP for internal services, LoadBalancer or an Ingress or Gateway for public traffic, and NodePort mostly for testing or on-premise setups.
Q56. How does a Service find its pods?
A Service uses a label selector. Kubernetes constantly finds every pod whose labels match the selector and is ready, and records their IPs and ports as the Service’s endpoints. kube-proxy (or the network plugin) then sends Service traffic only to those endpoints.
So if a Service has no traffic, the first thing to check is whether the selector matches the pod labels exactly.
kubectl get endpointslices -l kubernetes.io/service-name=shop-api
Q57. What are EndpointSlices?
EndpointSlices store the list of pod IPs and ports behind a Service. They replaced the older single Endpoints object, which became too big and slow in large clusters, because one change rewrote the whole list.
EndpointSlices split the list into small pieces of up to 100 endpoints each by default. So a change only updates one small slice. They also carry extra details, such as whether each endpoint is ready and which zone it is in, which helps with topology-aware routing.
Q58. How does DNS work inside a cluster, for example api.shop.svc.cluster.local?
Every cluster runs a DNS server, usually CoreDNS. Each Service gets a DNS name in this format: service.namespace.svc.cluster.local. So api.shop.svc.cluster.local is the Service api in the namespace shop.
Pods are set up so short names also work. From a pod in the same namespace, just api works. From another namespace, use api.shop. The DNS server returns the Service’s ClusterIP, or for a headless Service, the pod IPs.
Q59. What is the Kubernetes network model, where every pod gets its own IP?
Kubernetes has a simple, flat network model with three basic rules.
- Every pod gets its own unique IP address in the cluster.
- Pods can reach all other pods on any node without NAT.
- Agents on a node, such as the kubelet, can reach all pods on that node.
So containers do not need port mapping, and apps see the same IP that others use to reach them. Kubernetes itself does not build this network. A CNI plugin does.
Q60. What is a CNI plugin, with examples such as Calico and Cilium?
CNI (Container Network Interface) is a standard for plugins that set up pod networking. When a pod starts, the container runtime calls the CNI plugin, which gives the pod an IP address and connects it to the network.
| Plugin | Known for |
|---|---|
| Calico | Popular, strong NetworkPolicy support, BGP routing |
| Cilium | eBPF based, fast, can replace kube-proxy, deep observability |
| Flannel | Simple overlay network, no NetworkPolicy by itself |
| AWS VPC CNI | Gives pods real VPC IP addresses on EKS |
The choice affects performance, security features and whether NetworkPolicies are enforced.
Q61. What is an Ingress, and what is an ingress controller?
An Ingress is a Kubernetes object that defines HTTP and HTTPS routing rules from outside the cluster to Services, based on host names and paths. For example, shop.example.com/api goes to the shop-api Service, and / goes to shop-web. It can also hold TLS settings.
An Ingress by itself does nothing. An ingress controller is the actual proxy that reads Ingress objects and routes the traffic. Examples are Traefik, HAProxy, Contour and cloud controllers such as the AWS Load Balancer Controller. You must install one controller in the cluster.
Q62. What is the Gateway API, and why is it replacing Ingress for new setups?
The Gateway API is the newer, official Kubernetes standard for routing traffic into and inside a cluster. It splits the job into roles: a GatewayClass (the kind of proxy), a Gateway (the actual entry point and listeners) and routes such as HTTPRoute and GRPCRoute.
It improves on Ingress in several ways.
- Features like header matching, traffic splitting by weight and redirects are built in, not vendor-specific annotations.
- Platform teams own Gateways, and app teams own their routes, which fits real organisations.
- It supports more than HTTP, such as gRPC, TCP and TLS routes.
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: shop
spec:
parentRefs:
- name: public-gateway
hostnames: ["shop.example.com"]
rules:
- matches:
- path:
type: PathPrefix
value: /api
backendRefs:
- name: shop-api
port: 8080
Q63. What happened to the Ingress NGINX project, and how would you plan a migration?
Ingress NGINX, the community kubernetes/ingress-nginx controller, was one of the most used ingress controllers. In late 2025, the Kubernetes project announced its retirement because of a lack of maintainers, and after March 2026 it stopped getting releases and security fixes. Existing installs keep working, but running an unpatched edge proxy is a security risk.
A migration plan could look like this.
- First, list every Ingress and the NGINX-specific annotations it uses.
- Next, pick a replacement: a Gateway API implementation (such as Envoy Gateway, Cilium, Istio, Traefik or a cloud gateway) or another maintained ingress controller.
- Then convert the rules. The
ingress2gatewaytool can translate Ingress objects to Gateway API resources. - Run the new controller alongside the old one, and test with a separate DNS name or a small share of traffic.
- Finally, move DNS step by step, watch errors and latency, and remove the old controller.
Do not confuse it with the separate NGINX Ingress Controller made by F5 NGINX, which is a different project.
Q64. What is a NetworkPolicy, and does every cluster enforce it?
A NetworkPolicy is a firewall rule for pods. It selects pods by label and says which incoming (ingress) and outgoing (egress) traffic is allowed, by pod labels, namespaces, IP ranges and ports. By default, all pods can talk to all pods, so once a policy selects a pod, only the allowed traffic gets through.
However, Kubernetes only stores the policy. The CNI plugin must enforce it. Calico and Cilium do, but a plain Flannel setup does not. So a NetworkPolicy silently does nothing on a network plugin that lacks support.
Q65. How do you allow traffic only from the frontend pods to the backend pods?
Create a NetworkPolicy that selects the backend pods and allows ingress only from pods labelled as frontend, on the backend port. All other incoming traffic to the backend is then blocked.
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: backend-allow-frontend
namespace: shop
spec:
podSelector:
matchLabels:
app: backend
policyTypes: ["Ingress"]
ingress:
- from:
- podSelector:
matchLabels:
app: frontend
ports:
- protocol: TCP
port: 8080
A good practice is to start with a “default deny” policy in each namespace, then add allow rules like this one for each real flow.
Q66. What is a service mesh, and when is it worth the extra complexity?
A service mesh adds a proxy next to each service (a sidecar) or on each node (ambient mode). The proxies handle service-to-service traffic, giving you mutual TLS encryption, retries, timeouts, traffic splitting and detailed metrics without changing your app code. Istio, Linkerd and Cilium are common examples.
It is worth it when you have many services and need zero-trust security with mTLS, fine traffic control for canaries, or consistent observability across teams. For a few services, it usually adds more moving parts than value, and good libraries plus the Gateway API are enough.
Q67. How does traffic reach a pod from the internet, step by step?
Here is a typical path in a cloud cluster.
- First, the user’s browser resolves
shop.example.comwith DNS to the IP of a cloud load balancer. - Next, the cloud load balancer, created by a
LoadBalancerService, forwards traffic to the gateway or ingress controller pods. - Then the gateway or ingress controller ends TLS, matches the host and path rules, and picks the target Service.
- It sends the request to one of the Service’s ready endpoints, a pod IP.
- The CNI network delivers the packet to that pod, even if it is on another node.
- Finally, the app container receives the request on its port and responds back along the same path.

Configuration and Storage Kubernetes Interview Questions with Answers
Apps need settings, secrets and sometimes data that survives restarts. These Kubernetes interview questions cover ConfigMaps, Secrets and the storage objects.
Q68. What is a ConfigMap?
A ConfigMap stores non-secret configuration as key-value pairs, such as a log level, a feature flag or a whole config file. It keeps settings out of your container image, so the same image can run in dev, test and production with different config.
apiVersion: v1
kind: ConfigMap
metadata:
name: shop-config
data:
LOG_LEVEL: "info"
FEATURE_NEW_CHECKOUT: "true"
app.yaml: |
cache:
ttl: 300
A ConfigMap can hold up to 1 MiB of data. For larger files, use a volume or object storage.
Q69. What is a Secret, and are Secrets encrypted by default?
A Secret is like a ConfigMap but meant for sensitive data, such as passwords, API keys and TLS certificates. Kubernetes treats Secrets a little more carefully. For example, they can be kept in memory (tmpfs) on nodes and only sent to nodes that run pods using them.
However, Secrets are not encrypted by default. The values are only base64-encoded, which anyone can decode, and they are stored as plain data in etcd unless you turn on encryption at rest. So anyone who can read Secrets through the API or read etcd can see them.
kubectl create secret generic db-cred --from-literal=password='S3cret!'
kubectl get secret db-cred -o jsonpath='{.data.password}' | base64 -d
Q70. How do you pass a ConfigMap or Secret to a pod as files or environment variables?
You can use them in two ways. Environment variables are simple, and mounted files are better for whole config files and for values that change.
spec:
containers:
- name: api
image: shop-api:1.4.0
envFrom:
- configMapRef:
name: shop-config # every key becomes an env var
env:
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: db-cred
key: password # one key as one env var
volumeMounts:
- name: config
mountPath: /etc/shop # each key becomes a file here
readOnly: true
volumes:
- name: config
configMap:
name: shop-config
Q71. Why does a pod not see a changed environment variable until it restarts?
Environment variables are set once, when the container process starts. Linux does not let you change the environment of a running process from outside. So if you update a ConfigMap, pods that use it as env vars keep the old values until they are restarted.
Mounted files are different. The kubelet updates mounted ConfigMap and Secret files after a short delay, usually under a minute, but the app must reload the file to notice (except for subPath mounts, which never update). To roll out env var changes, restart the pods with kubectl rollout restart deployment/shop-api, or add a hash of the config to a pod annotation, which Helm charts often do.
Q72. How do you keep secrets safe, for example with encryption at rest or an external store?
Use several layers of protection together.
- Encryption at rest: turn on etcd encryption for Secrets, ideally with a KMS provider so the key lives outside the cluster. Managed services such as EKS, GKE and AKS offer this.
- RBAC: give
getandliston Secrets only to the few users and ServiceAccounts that need them. - External secret stores: keep the real values in AWS Secrets Manager, Google Secret Manager, Azure Key Vault or HashiCorp Vault, and sync them with the External Secrets Operator or mount them with the Secrets Store CSI Driver.
- Git safety: never commit plain Secrets to Git. Use Sealed Secrets or SOPS to store them encrypted.
- Prefer files over env vars, because env vars leak more easily into logs and crash reports.
Q73. What is a Volume in a pod?
A volume is a folder that containers in a pod can mount. Unlike the container’s own file system, a volume can outlive a container restart, and it can be shared by all containers in the pod.
There are many types. Some are temporary, such as emptyDir. Some inject data, such as configMap, secret and projected. Others give lasting storage through a persistentVolumeClaim.
Q74. What is an emptyDir volume?
An emptyDir is an empty folder created when the pod starts on a node. The folder lives as long as the pod lives. It survives container restarts, but it is deleted when the pod is removed from the node.
It is useful for scratch space, caches and sharing files between containers in the same pod, such as an app writing logs and a sidecar reading them. You can set medium: Memory to keep it in RAM and sizeLimit to cap its size.
Q75. What is a PersistentVolume (PV)?
A PersistentVolume is a piece of storage in the cluster, such as an AWS EBS disk, a Google persistent disk or an NFS share. It is a cluster-wide resource with its own life, separate from any pod. So the data stays even when pods are deleted and recreated.
A PV can be created by an admin by hand (static provisioning) or automatically by a StorageClass when someone asks for storage (dynamic provisioning, which is the usual way today).
Q76. What is a PersistentVolumeClaim (PVC)?
A PersistentVolumeClaim is a request for storage made by a user or app. It says how much storage is needed, which access mode and optionally which StorageClass. Kubernetes then binds the claim to a matching PV, creating one if needed.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pgdata
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: gp3
resources:
requests:
storage: 20Gi
The pod then mounts the claim by name. The PV and PVC split works like a parking system: the PV is the parking spot, and the PVC is your ticket that reserves one.
Q77. What is a StorageClass, and what is dynamic provisioning?
A StorageClass describes a kind of storage that can be created on demand, such as “fast SSD” or “cheap HDD”, along with the driver (provisioner) and its settings. Dynamic provisioning means that when a PVC asks for that class, the driver creates a new disk and PV automatically.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: gp3
provisioner: ebs.csi.aws.com
parameters:
type: gp3
reclaimPolicy: Delete
volumeBindingMode: WaitForFirstConsumer # create the disk in the pod's zone
allowVolumeExpansion: true
WaitForFirstConsumer matters on clouds, because a disk can only attach to nodes in its own zone.
Q78. What are the access modes: ReadWriteOnce, ReadOnlyMany and ReadWriteMany?
Access modes say how a volume can be mounted by nodes.
| Mode | Short name | Meaning | Example storage |
|---|---|---|---|
| ReadWriteOnce | RWO | Read-write by pods on one node | AWS EBS, GCE PD |
| ReadOnlyMany | ROX | Read-only by many nodes | Shared datasets |
| ReadWriteMany | RWX | Read-write by many nodes | NFS, AWS EFS, Azure Files |
| ReadWriteOncePod | RWOP | Read-write by only one pod in the whole cluster | CSI drivers that support it |
So most block disks are RWO. If many pods on different nodes must write the same files, you need a shared file system that supports RWX.
Q79. What is the reclaim policy of a volume?
The reclaim policy decides what happens to a PV and its real disk when the PVC that used it is deleted.
- Delete: the PV and the cloud disk are deleted. This is the default for most dynamic StorageClasses.
- Retain: the PV and data stay, and an admin must clean them up or reuse them by hand.
For important data such as production databases, use Retain, so deleting a PVC by mistake does not wipe the data. Also, take snapshots or backups, for example with VolumeSnapshots or Velero.
Q80. What is CSI (Container Storage Interface)?
CSI is a standard API between Kubernetes and storage systems. Storage vendors write a CSI driver once, and it works with Kubernetes without changing Kubernetes code. Before CSI, storage drivers lived inside the Kubernetes code (in-tree), which made updates slow.
Almost all storage today uses CSI drivers, such as the AWS EBS and EFS drivers, the Google Persistent Disk driver and Ceph. CSI also brings features like volume snapshots, cloning and resizing.
Scheduling, Scaling and Security Kubernetes Interview Questions with Answers
Senior rounds focus on keeping clusters safe, fair and fast. So expect these Kubernetes interview questions there, and back each answer with a YAML example.
Q81. What are resource requests and limits?
A request is the amount of CPU and memory the scheduler reserves for a container. The scheduler only places a pod on a node with enough unreserved capacity. A limit is the most the container may use.
resources:
requests:
cpu: "250m" # a quarter of one CPU core
memory: "256Mi"
limits:
memory: "512Mi"
CPU is measured in cores, where 1000m (millicores) is one core. Memory uses units like Mi and Gi. Many teams set memory limits but leave out CPU limits, because CPU throttling can slow apps for no good reason when the node has spare CPU.
Q82. What happens when a container uses more memory than its limit?
Memory cannot be taken back from a process, so the kernel’s OOM killer stops the container. Kubernetes shows the reason OOMKilled and exit code 137, then restarts it according to the restart policy. If it keeps happening, you see CrashLoopBackOff.
Also, if a node runs low on memory overall, the kubelet evicts pods, starting with those using more than they requested. For Go apps, set GOMEMLIMIT a little below the container limit, so the garbage collector works harder before the kernel kills the process.
Q83. What happens when a container uses more CPU than its limit?
CPU can be shared, so the container is not killed. Instead, it is throttled: the kernel lets it run only for its share of each time period. So the app becomes slower, and latency goes up, but it keeps running.
Throttling can happen even when the node has idle CPU, which is why some teams skip CPU limits and rely on requests. Since Go 1.25, the Go runtime reads the container CPU limit and sets GOMAXPROCS to match, which reduces throttling for Go services.
Q84. What are the QoS classes: Guaranteed, Burstable and BestEffort?
Kubernetes gives each pod a Quality of Service class based on its requests and limits. The class decides which pods are evicted first when a node runs short of memory.
| QoS class | Rule | Eviction order |
|---|---|---|
| Guaranteed | Every container has requests equal to limits for CPU and memory | Last |
| Burstable | At least one request or limit set, but not Guaranteed | Middle |
| BestEffort | No requests or limits at all | First |
So for important workloads, set requests (and usually memory limits), and never run production pods as BestEffort.
Q85. What are nodeSelector and node affinity?
Both control which nodes a pod can run on, based on node labels. nodeSelector is the simple version: the node must have all the listed labels.
Node affinity is more flexible. It supports operators like In and NotIn, and it has two kinds of rules: required (a hard rule) and preferred (a soft wish with a weight).
spec:
nodeSelector:
disktype: ssd
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 50
preference:
matchExpressions:
- key: topology.kubernetes.io/zone
operator: In
values: ["ap-south-1a"]
Q86. What are taints and tolerations?
A taint on a node pushes pods away from it. Only pods with a matching toleration can be scheduled there. So taints are the node saying “keep out unless you are allowed”, while node affinity is the pod saying “I want to go there”.
kubectl taint nodes gpu-node-1 gpu=true:NoSchedule
tolerations:
- key: "gpu"
operator: "Equal"
value: "true"
effect: "NoSchedule"
The effects are NoSchedule, PreferNoSchedule and NoExecute (which also evicts running pods). Teams use taints for GPU nodes, nodes kept for system tools and control plane nodes. Kubernetes also adds taints itself, for example to nodes that are not ready.
Q87. What is pod affinity and anti-affinity?
Pod affinity places a pod near other pods with certain labels, for example on the same node or zone as its cache for low latency. Pod anti-affinity keeps pods away from each other, for example spreading replicas of the same app across different nodes, so one node failure does not take them all down.
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchLabels:
app: shop-api
topologyKey: kubernetes.io/hostname
Q88. What are topology spread constraints?
Topology spread constraints spread pods evenly across failure domains, such as zones or nodes. You set the maximum allowed difference (maxSkew) in pod count between domains. They are simpler and more exact than anti-affinity for even spreading.
topologySpreadConstraints:
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
app: shop-api
With 6 replicas and 3 zones, this aims for 2 pods per zone, so losing one zone only removes a third of the capacity.
Q89. What is the Horizontal Pod Autoscaler (HPA), and how does it decide to scale?
The HPA changes the number of replicas of a Deployment or StatefulSet based on metrics. Every 15 seconds by default, it reads metrics such as CPU use from the Metrics Server and compares them with your target.
The basic formula is: desired replicas = current replicas × (current metric ÷ target metric), rounded up. So if 4 pods average 90% CPU and the target is 60%, it scales to 6. It stays within your minReplicas and maxReplicas.
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: shop-api
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: shop-api
minReplicas: 3
maxReplicas: 20
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 60
CPU percentage is measured against the pod’s CPU request, so requests must be set. It can also scale on custom metrics, such as requests per second, and KEDA adds scaling on queue length.
Q90. What is the Vertical Pod Autoscaler (VPA)?
The VPA adjusts the CPU and memory requests (and limits) of pods based on their real usage over time. So instead of adding more pods like the HPA, it makes each pod the right size.
It is an add-on, not built into Kubernetes. It can just recommend values, or apply them. Do not let VPA and HPA both act on CPU or memory for the same app, because they will fight each other. A common pattern is VPA in recommendation mode to tune requests, plus HPA for scaling out.
Q91. What is the Cluster Autoscaler, and how is it different from HPA?
The HPA adds pods. The Cluster Autoscaler adds and removes nodes. When pods are stuck in Pending because no node has room, the Cluster Autoscaler adds a node. When nodes are mostly empty for a while, it moves their pods and removes the node to save money.
So they work together: HPA creates more pods, and if they do not fit, the Cluster Autoscaler adds nodes. Karpenter is a popular alternative, especially on AWS, which picks the best instance type for the waiting pods and starts nodes quickly.
Q92. What is in-place pod resize, and why is it useful?
In-place pod resize lets you change the CPU and memory requests and limits of a running pod without recreating it. Before this feature, any change to resources meant killing the pod and starting a new one, which was slow for big apps and disruptive for stateful ones. It is stable in recent Kubernetes versions.
Each container can say whether a change needs a restart, with resizePolicy. For example, CPU can usually change with no restart, while some apps need a restart to use more memory. It also makes vertical autoscaling much smoother.
Q93. What is RBAC: Role, ClusterRole, RoleBinding and ClusterRoleBinding?
RBAC (role-based access control) decides who can do what in the cluster. It has four objects.
| Object | Scope | Purpose |
|---|---|---|
| Role | One namespace | A list of allowed actions (verbs) on resources |
| ClusterRole | Whole cluster | Same, but cluster-wide or for cluster-level resources like nodes |
| RoleBinding | One namespace | Gives a Role (or ClusterRole) to users, groups or ServiceAccounts in that namespace |
| ClusterRoleBinding | Whole cluster | Gives a ClusterRole across all namespaces |
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: pod-reader
namespace: shop
rules:
- apiGroups: [""]
resources: ["pods", "pods/log"]
verbs: ["get", "list", "watch"]
RBAC only allows, it never denies. So start with no access and add the smallest set of rights each person or app needs. Check with kubectl auth can-i list secrets --as dev-user -n shop.
Q94. What is a ServiceAccount?
A ServiceAccount is an identity for apps running in pods, while user accounts are for people. Each namespace has a default ServiceAccount, and pods use it unless you choose another.
The pod gets a short-lived token, mounted automatically, that it can use to call the Kubernetes API, with rights given through RBAC. Cloud providers can also map a ServiceAccount to a cloud role, such as EKS Pod Identity or GKE Workload Identity, so pods get cloud access without stored keys. If an app does not call the API, set automountServiceAccountToken: false.
Q95. What are Pod Security Standards and Pod Security Admission?
Pod Security Standards are three official security levels for pods.
- Privileged: no restrictions, for trusted system tools.
- Baseline: blocks known dangerous settings, such as privileged containers and host networking.
- Restricted: strict best practices, such as running as non-root and dropping all capabilities.
Pod Security Admission is the built-in admission controller that enforces these levels per namespace, using labels. It replaced the old PodSecurityPolicy, which was removed in v1.25.
kubectl label namespace shop pod-security.kubernetes.io/enforce=restricted
Q96. What is a securityContext, and which settings should every pod have?
A securityContext sets security options for a pod or a container, such as which user it runs as and what it is allowed to do. A good default for most apps looks like this.
securityContext:
runAsNonRoot: true
runAsUser: 10001
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]
seccompProfile:
type: RuntimeDefault
These settings match the Restricted level. Go services usually run fine with all of them, since a static binary needs no root, no capabilities and no writable root file system.
Q97. What are admission controllers and webhooks?
Admission controllers are plugins in the API server that check or change requests after authentication and authorization, before the object is saved. Built-in ones include LimitRanger, ResourceQuota and Pod Security Admission.
Webhooks let you add your own logic. A mutating webhook can change objects, for example to inject a sidecar or default labels. A validating webhook can reject objects, for example images not from your company registry. Tools like Kyverno and OPA Gatekeeper use webhooks to enforce policies. Kubernetes also has ValidatingAdmissionPolicy, which uses simple CEL expressions without running a webhook server.
Q98. What is a Custom Resource Definition (CRD) and an operator?
A CRD lets you add your own object types to Kubernetes, such as PostgresCluster or Certificate. Once installed, you can create these objects with YAML and kubectl, like built-in ones.
An operator is a controller that watches those custom objects and does the work, using the same reconcile loop as Kubernetes itself. It puts expert knowledge into code. For example, a PostgreSQL operator can create replicas, run backups and handle failover when you just write replicas: 3. Operators are often written in Go with tools like Kubebuilder or the Operator SDK.
Q99. What is Helm, and what is a Helm chart?
Helm is a package manager for Kubernetes, like apt or npm. A Helm chart is a package of YAML templates plus a values.yaml file with default settings. You install a chart with your own values, and Helm renders the final YAML and applies it as a release.
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm install monitoring prometheus-community/kube-prometheus-stack -n monitoring --create-namespace
helm upgrade shop-api ./charts/shop-api -f values-prod.yaml
helm rollback shop-api 2
It is good for reusing setups across environments and installing third-party software. Kustomize is a template-free alternative built into kubectl, which patches plain YAML for each environment.
Q100. What is GitOps, with tools such as Argo CD or Flux?
GitOps means Git is the single source of truth for what runs in the cluster. You store your manifests or Helm charts in Git. An agent inside the cluster, such as Argo CD or Flux, keeps pulling Git and applying any changes, and it fixes drift if someone changes the cluster by hand.
So deployments happen through pull requests, every change is reviewed and recorded, and rollback is a Git revert. CI builds and pushes the image and updates the image tag in Git, and the GitOps tool deploys it. It also means CI does not need admin access to the cluster.
Troubleshooting and Scenario Kubernetes Interview Questions with Answers
For each scenario, explain what you would check first, and why. Interviewers care more about your steps than the final answer, so these answers follow a clear “look, find, fix” order.
Q101. A pod is stuck in Pending. How do you find out why?
Pending means the pod has not been scheduled to a node yet, or its containers have not started. Start with the events.
kubectl describe pod shop-api-7c9f # read the Events section at the bottom
kubectl get events -n shop --sort-by=.lastTimestamp
The event message usually names the cause. Here are the common ones.
- Not enough resources: “Insufficient cpu” or “Insufficient memory”. Lower the requests, free up space or add nodes (the Cluster Autoscaler should do this).
- PVC not bound: the storage claim is waiting, for example a wrong StorageClass or a zone mismatch.
- Rules no node matches: a node selector, affinity rule or taint that no node satisfies.
- Quota reached: a ResourceQuota in the namespace blocks new pods.
Q102. A pod is in CrashLoopBackOff. What do you check, in order?
The container keeps starting and crashing, so you need to see why the last run died.
- First, read the logs of the crashed run:
kubectl logs <pod> --previous. Most causes show here, such as a panic or a missing setting. - Next, run
kubectl describe pod <pod>and look at the last state, exit code and reason.OOMKilledwith exit code 137 means memory. Exit code 1 is usually an app error. - Then check the config: environment variables, ConfigMaps, Secrets and mounted files the app expects.
- Check the command and args are correct for the image.
- Check the liveness probe. A probe that is too strict, or starts too early, keeps killing a healthy app. Add a startup probe for slow starters.
- Finally, check dependencies, such as the database being reachable.
Q103. A Service returns no response, but the pods are running. How do you debug it?
Work from the Service down to the pod.
- First, check the Service has endpoints:
kubectl get endpointslices -l kubernetes.io/service-name=shop-api. If it is empty, the selector does not match the pod labels, or the pods are not ready. - Next, compare the labels:
kubectl get pods --show-labelsandkubectl describe svc shop-api. - Then check the ports. The Service
targetPortmust match the port the container really listens on. - Check the app listens on
0.0.0.0, not127.0.0.1, inside the container. - Test from inside the cluster with a debug pod:
kubectl run tmp --rm -it --image=busybox:1.37 -- wget -qO- http://shop-api:8080/healthz. - Finally, check NetworkPolicies that might block the traffic, and DNS with
nslookup shop-api.
Q104. A Deployment rollout is stuck. How do you see what is wrong and roll back?
A rollout gets stuck when new pods never become ready, so the Deployment stops replacing old ones.
kubectl rollout status deployment/shop-api # shows it is waiting
kubectl get pods -l app=shop-api # find the new, unhealthy pods
kubectl describe pod <new-pod> # events: image pull, probes, scheduling
kubectl logs <new-pod>
kubectl rollout undo deployment/shop-api # go back to the last good version
Common causes are a wrong image tag, a failing readiness probe, a crash on startup, or not enough capacity for the extra surge pods. Setting progressDeadlineSeconds makes the Deployment report a clear failure after a set time, which CI pipelines can detect.
Q105. A pod was OOMKilled. How do you confirm it and fix it?
First, confirm it. kubectl describe pod shows Last State: Terminated, Reason: OOMKilled, Exit Code: 137, and kubectl get pod shows restarts going up. Then look at the memory graph for the pod in your monitoring, or run kubectl top pod.
Next, decide if the limit is too low or the app has a problem. If memory rises to a steady level that is just above the limit, raise the limit and the request. If it keeps growing over time, it is a leak, so profile the app. For Go services, use pprof heap profiles, check for caches without a size limit and goroutine leaks, and set GOMEMLIMIT to about 90% of the container limit.
Q106. A node shows NotReady. What could cause it?
NotReady means the kubelet on that node is not reporting healthy status to the API server. Run kubectl describe node <name> and read the Conditions and Events.
- Kubelet problems: the kubelet stopped or crashed. Check it with
systemctl status kubeletandjournalctl -u kubelet. - Container runtime down: containerd is not running or is stuck.
- Resource pressure: conditions like
MemoryPressure,DiskPressureorPIDPressure, often from a full disk with images and logs. - Network problems: the node cannot reach the API server, or the CNI plugin is broken.
- Expired certificates or a dead VM.
After about five minutes, pods on a NotReady node get evicted and are recreated elsewhere by their controllers.
Q107. Your app is slow after a deploy. How do you compare old and new pods?
First, confirm it is the new version. Compare latency and error dashboards before and after the deploy time, and check if only new pods are slow. If users are hurting, roll back first with kubectl rollout undo and investigate after.
Then compare the two versions.
- Check what changed: image, config, resource requests and limits, and replica count.
- Look at CPU throttling and memory in
kubectl top podsand your metrics. - Use distributed traces to find which step got slower, such as a database query or an outside call.
- Profile one new pod, for example with Go’s pprof through
kubectl port-forward.
A canary release with automatic analysis catches these problems before all users are affected.
Q108. How would you upgrade a cluster to a new Kubernetes version safely?
Upgrade one minor version at a time, and test first.
- First, read the release notes and check for removed APIs your manifests or charts still use, with tools like
plutoorkubent. - Next, upgrade a test or staging cluster and run your tests.
- Then back up etcd (or rely on your managed provider) and your manifests.
- Upgrade the control plane first. On EKS, GKE or AKS, this is one action.
- After that, upgrade worker nodes a few at a time, by draining each node (
kubectl drain) so pods move safely. PodDisruptionBudgets keep enough replicas running. - Finally, upgrade add-ons such as the CNI plugin, CoreDNS and ingress or gateway controllers, and watch your dashboards.
Q109. How do you back up and restore etcd?
On a self-managed cluster, take a snapshot with etcdctl and store it outside the cluster. You need the etcd endpoint and its TLS certificates.
ETCDCTL_API=3 etcdctl snapshot save /backup/etcd-$(date +%F).db \
--endpoints=https://127.0.0.1:2379 \
--cacert=/etc/kubernetes/pki/etcd/ca.crt \
--cert=/etc/kubernetes/pki/etcd/server.crt \
--key=/etc/kubernetes/pki/etcd/server.key
To restore, stop the API server, restore the snapshot into a new data folder (newer etcd versions use etcdutl snapshot restore for this), point etcd at that folder and start everything again. On managed services, the provider handles etcd. There, you back up your workloads and volumes with a tool like Velero, and keep all manifests in Git.
Q110. How would you design a cluster for a small company with three services and one database?
Keep it simple and managed. A good design for a small team looks like this.
- Cluster: one managed cluster (EKS, GKE or AKS) per environment, at least for production, with nodes across 2 or 3 zones.
- Workloads: each service as a Deployment with 2 or more replicas, requests and limits, readiness and liveness probes, a PDB and an HPA.
- Database: a managed database such as Amazon RDS or Cloud SQL, outside the cluster, for easy backups and failover.
- Traffic: one Gateway API implementation or ingress controller with TLS from cert-manager, and ClusterIP Services inside.
- Config: ConfigMaps, plus Secrets synced from a cloud secret manager.
- Delivery: CI builds images, and Argo CD or Flux deploys from Git.
- Observability: Prometheus and Grafana for metrics, a log stack such as Loki, and alerts on error rate and latency.
- Security: namespaces per environment, RBAC, Pod Security
restrictedand default-deny NetworkPolicies.
This setup is small enough to run with one or two engineers, and it can grow later without a redesign.
Hands-On Kubernetes Interview Questions Practice
Interviewers often ask you to write a Deployment and a Service from memory. Here is a clean example for a small API with three replicas. It answers questions 33, 42, 54 and 81 in one go.
# deployment.yaml: run 3 copies of the shop API
apiVersion: apps/v1
kind: Deployment
metadata:
name: shop-api
labels:
app: shop-api
spec:
replicas: 3
selector:
matchLabels:
app: shop-api # must match the pod labels below
template:
metadata:
labels:
app: shop-api
spec:
containers:
- name: api
image: registry.example.com/shop-api:1.0.0 # pin a version, never latest
ports:
- containerPort: 8080
resources:
requests:
cpu: "100m" # 0.1 CPU reserved by the scheduler
memory: "128Mi"
limits:
memory: "256Mi" # above this, the container is OOMKilled
readinessProbe:
httpGet:
path: /ready
port: 8080
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 10
The selector tells the Deployment which pods it owns, so it must match the template labels. Next, the requests help the scheduler place pods, and the memory limit stops one pod from eating a whole node. The readiness probe keeps traffic away until the app is ready, and the liveness probe restarts it if it hangs.
Next, here is the Service that puts one stable name in front of those pods.
# service.yaml: one stable address for all shop-api pods
apiVersion: v1
kind: Service
metadata:
name: shop-api
spec:
type: ClusterIP # reachable only inside the cluster
selector:
app: shop-api # sends traffic to pods with this label
ports:
- port: 80 # port other pods call
targetPort: 8080 # port the container listens on
Other pods in the same namespace can now call http://shop-api, and DNS resolves it to the Service. The Service sends each request to a ready pod that has the app: shop-api label.
Finally, these are the kubectl commands you should know without looking them up.
kubectl apply -f deployment.yaml -f service.yaml # create or update objects
kubectl get pods -o wide # list pods with node and IP
kubectl describe pod <pod-name> # details and recent events
kubectl logs <pod-name> --previous # logs from the crashed container
kubectl exec -it <pod-name> -- sh # open a shell in a pod
kubectl rollout status deployment/shop-api # watch a rollout
kubectl rollout undo deployment/shop-api # roll back to the last version
kubectl scale deployment/shop-api --replicas=5 # change replica count
kubectl top pods # CPU and memory (needs metrics-server)
kubectl get events --sort-by=.metadata.creationTimestamp # newest events last
Common Mistakes in Kubernetes Interview Questions
- Calling a pod a container: a pod can hold several containers that share one IP.
- Mixing up liveness and readiness: one restarts the container, the other only stops traffic.
- Saying Secrets are encrypted: by default they are only base64-encoded.
- Forgetting the selector match: a Service or Deployment with wrong labels finds no pods.
- Skipping kubectl describe: in troubleshooting answers, always start with events and logs.
Best Practices for Answering Kubernetes Interview Questions
- Explain the flow: request, API server, etcd, scheduler, kubelet, container runtime.
- Use a real example, such as a rollout you fixed or a pod you debugged.
- Mention resources and probes in every Deployment you write.
- Talk about security by default: RBAC, non-root containers and Pod Security Standards.
- Know the current state, such as Gateway API for new routing and dockershim removal.
Practice Task
To practise these Kubernetes interview questions, create a local cluster with kind or minikube. Then deploy the YAML above with any small web image, break the readiness path on purpose, and watch what happens to the Service. Hint: use kubectl describe pod and kubectl get endpointslices to see the change.
Official Resources
- Kubernetes overview in the official docs
- Pods in the Kubernetes docs
- kubectl quick reference
- Gateway API in the Kubernetes docs
Quick Recap
- Kubernetes interview questions focus on architecture, pods, workloads, networking, storage and security.
- The control plane decides, and the kubelet on each node runs the pods.
- Use a Deployment for stateless apps and a StatefulSet for apps that need identity and storage.
- Services give pods a stable name, and Gateway API is the modern way to route outside traffic.
- Always set resource requests, limits and probes.
- In troubleshooting answers, start with kubectl describe, events and logs.
- Every one of the 110 questions now has a full answer, with YAML you can try.
What’s Next?
Containers and clusters are now covered. Next, see how code reaches the cluster in our CI/CD interview questions. Then practise the real-world angle with the Go deployment interview questions, which cover builds, CI pipelines and rollbacks. For every topic in one place, browse the Go interview questions hub.


