PrepStack › DevOps & Cloud › Kubernetes
Kubernetes interview cheat sheet
Architecture, workloads, networking, scaling, security and troubleshooting
Kubernetes interviews check that you understand the declarative model: you describe desired state, and controllers keep pulling the cluster toward it. Expect questions on architecture, Pods and Deployments, Services and Ingress/Gateway, config, storage, resources and probes, scaling, scheduling, RBAC, and live debugging (CrashLoopBackOff, Pending). Read the 15-minute revision first, then use Quiz mode and answer out loud as if you were on call.
15-minute revision
- Control plane: kube-apiserver (the only component that talks to etcd), etcd (state store), kube-scheduler (picks a node), kube-controller-manager (reconciliation loops), cloud-controller-manager (cloud LBs, nodes, routes).
- Node: kubelet (runs Pods via the CRI, e.g. containerd or CRI-O), kube-proxy (Service rules), container runtime. Docker shim was removed in 1.24, but Docker-built images still run.
- Everything is desired state vs actual state. Controllers watch the API server and act to close the gap. That loop is called reconciliation.
- A Pod is the smallest unit: one or more containers sharing a network namespace (same IP,
localhost) and volumes. Pods are disposable; controllers recreate them. - Deployment → ReplicaSet → Pods. A rolling update creates a new ReplicaSet.
maxSurge/maxUnavailabledefault to 25%.kubectl rollout undorolls back. - StatefulSet = stable names (
db-0), ordered start, one PVC per Pod. DaemonSet = one Pod per node. Job = run to completion. CronJob = Job on a schedule. - Service types: ClusterIP (default, internal), NodePort (30000–32767), LoadBalancer (cloud LB), ExternalName (DNS CNAME), headless (
clusterIP: None, DNS returns Pod IPs). - Service DNS:
<svc>.<ns>.svc.cluster.local, served by CoreDNS. Pods find Services by name, not IP. - Ingress is frozen; Gateway API (GatewayClass, Gateway, HTTPRoute) is its successor. The community ingress-nginx controller was retired in March 2026.
- ConfigMaps hold config; Secrets hold sensitive data but are only base64-encoded, not encrypted. Enable encryption at rest and lock them down with RBAC.
- Requests are used for scheduling; limits cap usage. CPU over limit is throttled; memory over limit is OOMKilled (exit 137). QoS: Guaranteed, Burstable, BestEffort.
- Probes: liveness failure restarts the container; readiness failure removes the Pod from Service endpoints; startup holds off the other two until the app has booted.
- Scaling: HPA adds Pods, VPA resizes requests, Cluster Autoscaler/Karpenter add nodes when Pods are Pending.
- Scheduling controls:
nodeSelector, node/pod affinity and anti-affinity, taints (on nodes) + tolerations (on Pods), topologySpreadConstraints. - Security: RBAC (Role/ClusterRole + bindings), ServiceAccounts for Pod identity, NetworkPolicy (needs a supporting CNI), Pod Security Standards (privileged, baseline, restricted).
- Debug order:
kubectl get→describe(Events!) →logs --previous→exec/debug→get events. Pending = scheduling problem; CrashLoopBackOff = the app keeps exiting.
Foundations
Why Kubernetes & managed offerings
Kubernetes is a container orchestrator: you declare what should run, and it schedules, heals, scales and connects it across many machines.
- Containers solve packaging. Running hundreds of them across many machines needs scheduling, self-healing, service discovery, rolling updates, scaling and config management. Kubernetes provides all of these behind one API.
- It is declarative: you store desired state (YAML) in the API, and controllers keep reality matching it. This fits GitOps tools such as Argo CD and Flux well.
- It is portable and extensible: the same API runs on any cloud or on-prem, and CRDs plus operators let you add your own resource types.
- Costs: real operational complexity, a steep learning curve, and overhead that is not worth it for one small app. A PaaS, serverless containers or plain VMs can be a better fit.
- Managed Kubernetes (EKS, GKE, AKS) runs and upgrades the control plane for you. You still own workloads, node upgrades (unless you use a fully managed node mode), add-ons and security.
- Upstream supports the three newest minor versions, each for about 14 months. Plan for an upgrade roughly every few months; managed providers add their own support windows.
Interview questions
- Why do we need Kubernetes if we already have Docker?
- When would you NOT use Kubernetes?
- What does a managed service like EKS, GKE or AKS actually manage?
Cluster architecture
A control plane stores and decides; worker nodes run the Pods. Everything talks through the kube-apiserver.
- kube-apiserver: the REST front door. It authenticates, authorizes, runs admission, validates, and is the only component that reads and writes etcd. It scales horizontally.
- etcd: a consistent key-value store using the Raft consensus protocol. Run 3 or 5 members (odd numbers keep quorum). Losing etcd without a backup means losing the cluster state.
- kube-scheduler: watches for Pods with no
nodeName, filters nodes that can't fit them, scores the rest, and binds the Pod to the best node. - kube-controller-manager: one binary running many controllers (Deployment, ReplicaSet, Node, Job, EndpointSlice, ServiceAccount...). cloud-controller-manager holds the cloud-specific loops: nodes, routes and LoadBalancer Services.
- kubelet (on every node): watches Pods bound to its node, starts containers through the CRI, mounts volumes, runs probes and reports status. kube-proxy programs Service rules. The container runtime (containerd, CRI-O) pulls images and runs containers.
- Plug-in interfaces: CRI (runtime), CNI (Pod networking, e.g. Calico, Cilium), CSI (storage). Add-ons such as CoreDNS and metrics-server run as normal Pods.
Interview questions
- Explain the Kubernetes architecture.
- Why does etcd need an odd number of members?
- How does the scheduler choose a node?
- What is the difference between the controller-manager and the cloud-controller-manager?
Declarative model, reconciliation & kubectl apply
You write desired state into the API. Controllers keep comparing it with actual state and act until they match.
- Every object has
spec(desired state, written by you) andstatus(observed state, written by controllers). Controllers try to make status match spec. - A reconciliation loop is: watch → compare desired vs actual → take one step → repeat. It is level-triggered: it looks at the current state, not just the event, so missed events don't break it.
- Imperative (
kubectl run,kubectl scale) changes state directly. Declarative (kubectl apply -f) stores files that are the source of truth, which suits Git and code review. kubectl applymakes a 3-way merge: your new file, the last applied config (an annotation) and the live object. So fields set by others (like HPA-controlledreplicas) can survive.- Server-side apply (
kubectl apply --server-side) moves that merge into the API server and tracks field ownership inmanagedFields, reporting conflicts when two managers set the same field. - On write, the API server runs: authentication → authorization (RBAC) → mutating admission → schema validation → validating admission → persist to etcd.
Interview questions
- What is a reconciliation loop?
- Difference between
kubectl create,kubectl applyandkubectl replace? - What happens when you run
kubectl apply -f deployment.yaml? - What is server-side apply and why does it exist?
Namespaces, labels & selectors
Namespaces split a cluster into named scopes; labels tag objects so selectors can group them.
- A namespace scopes names, RBAC, ResourceQuotas, LimitRanges and NetworkPolicies. Default ones:
default,kube-system,kube-public,kube-node-lease. - Some objects are cluster-scoped: Nodes, PersistentVolumes, StorageClasses, ClusterRoles, Namespaces and CRDs themselves.
- Namespaces are not a network boundary by default. Pods in different namespaces can talk unless a NetworkPolicy blocks it.
- Labels are key/value pairs used for selection (
app=web,tier=frontend). Annotations store non-identifying metadata for tools (build info, ingress settings). - Selectors: equality-based (
app=web,env!=prod) and set-based (env in (dev,qa),!canary). Services, ReplicaSets, NetworkPolicies and affinity all use them. - Use the recommended
app.kubernetes.io/*labels (name,instance,version,component,part-of,managed-by) for consistency.
Interview questions
- Labels vs annotations?
- Do namespaces isolate workloads?
- How does a Service know which Pods to send traffic to?
Workloads
Pods, init containers & sidecars
A Pod is one or more containers that share an IP and volumes and are always scheduled together.
- Containers in a Pod share the network namespace (same IP, talk on
localhost, can't reuse a port) and can share volumes. Each container has its own filesystem and resource limits. - Pods are ephemeral: they are never moved or healed in place. A controller creates a new Pod with a new name and IP. Don't create bare Pods in production.
- Init containers run one by one, to completion, before app containers start. Use them for migrations, waiting on a dependency, or fetching config.
- Native sidecars (stable since 1.33): an init container with
restartPolicy: Always. It starts before the app, keeps running, is restarted on failure, stops after the app, and doesn't block Job completion. - Multi-container patterns: sidecar (log shipper, proxy), ambassador (local proxy to an outside service), adapter (reformat output, e.g. metrics).
- Pod phases:
Pending,Running,Succeeded,Failed,Unknown. Container states:Waiting,Running,Terminated.CrashLoopBackOffis a Waiting reason, not a phase.
Interview questions
- Why does Kubernetes use Pods instead of scheduling containers directly?
- Init container vs sidecar container?
- What happens when you delete a Pod?
ReplicaSets, Deployments & rollouts
A Deployment manages ReplicaSets to roll out new Pod versions gradually and roll back when needed.
- A ReplicaSet keeps N Pods matching a selector running. You rarely create one directly; a Deployment creates and manages them.
- Changing the Pod template (image, env, resources) creates a new ReplicaSet and triggers a rollout. Changing only
replicasjust scales the current one. - RollingUpdate (default):
maxSurge= extra Pods above desired;maxUnavailable= how many may be not ready. Both default to 25%.Recreatekills all old Pods first (has downtime). - A rollout only moves forward when new Pods become Ready, so readiness probes are what make rolling updates safe.
- Old ReplicaSets are kept (scaled to 0) for rollback;
revisionHistoryLimitdefaults to 10.progressDeadlineSeconds(default 600) marks a stuck rollout as failed, but does not auto-rollback. - Blue-green and canary are not built in. Use two Deployments with label switching, or tools like Argo Rollouts or Flagger, or Gateway API traffic weights.
Interview questions
- Deployment vs ReplicaSet?
- Explain
maxSurgeandmaxUnavailablewith an example. - A new release is broken. How do you roll back?
- How would you do a zero-downtime deployment?
StatefulSet, DaemonSet, Job & CronJob
Pick the controller by workload shape: stable identity, one per node, run to completion, or run on a schedule.
- StatefulSet: Pods get stable names (
db-0,db-1), stable DNS through a headless Service, and their own PVC fromvolumeClaimTemplates. Start and stop are ordered by default (podManagementPolicy: Parallelchanges that). - Deleting or scaling down a StatefulSet does not delete PVCs by default (configurable with
persistentVolumeClaimRetentionPolicy). Data is safe; cost may linger. - DaemonSet: one Pod per (matching) node, added automatically when nodes join. Used for log agents, node exporters, CNI and CSI node plugins.
- Job: runs Pods until
completionssucceed, withparallelismworkers.backoffLimit(default 6) caps retries;activeDeadlineSecondscaps total time;ttlSecondsAfterFinishedcleans up. - Job Pods need
restartPolicy: NeverorOnFailure. CronJob creates Jobs on a cronschedule, withconcurrencyPolicy(Allow,Forbid,Replace) and an optionaltimeZone. - A StatefulSet gives identity, not replication. The database itself must handle clustering and failover, which is why operators are popular for stateful systems.
Interview questions
- Deployment vs StatefulSet?
- When would you use a DaemonSet?
- Job
restartPolicy: OnFailurevsNever? - How do you stop overlapping CronJob runs?
Networking
Services, kube-proxy & DNS
A Service gives a changing set of Pods one stable virtual IP and DNS name, and load-balances across the ready ones.
- Kubernetes networking model: every Pod gets its own IP, and every Pod can reach every other Pod without NAT. The CNI plugin (Calico, Cilium, cloud CNIs) implements this.
- Pod IPs change, so clients use a Service. It selects Pods by label; the EndpointSlice controller tracks the ready ones.
- kube-proxy watches Services and EndpointSlices and programs each node. Modes on Linux: iptables (still the default), nftables (GA since 1.33, the future default), ipvs (deprecated since 1.35). eBPF CNIs like Cilium can replace kube-proxy completely.
- CoreDNS gives every Service a name:
web.shop.svc.cluster.local. Inside the same namespace, plainwebworks; across namespaces useweb.shop. - A headless Service (
clusterIP: None) has no virtual IP; DNS returns the Pod IPs directly. StatefulSet Pods also get names likedb-0.db.shop.svc.cluster.local. - Pods get
ndots:5in/etc/resolv.conf, so external names with few dots first try the cluster search domains. A trailing dot (api.example.com.) avoids extra lookups.
Interview questions
- Difference between ClusterIP, NodePort and LoadBalancer?
- What is a headless Service and when do you use it?
- How does kube-proxy work? Compare its modes.
- How does service discovery work in Kubernetes?
- What does
externalTrafficPolicy: Localdo?
Ingress vs Gateway API
Ingress is the original, now frozen, HTTP routing API; Gateway API is its role-oriented, more expressive successor.
- An Ingress routes external HTTP(S) by host and path to Services, and terminates TLS. It does nothing without an Ingress controller (Traefik, HAProxy, cloud controllers, F5 NGINX...).
- The Ingress API is frozen: it stays GA but gets no new features. Extra behaviour lives in controller-specific annotations, which are not portable.
- Ingress NGINX (kubernetes/ingress-nginx) was retired in March 2026: no more releases or security fixes. Existing installs still work, but you should migrate. The F5/NGINX Inc controller is a separate project.
- Gateway API (
gateway.networking.k8s.io/v1) splits roles: GatewayClass (infra provider), Gateway (cluster operator: listeners, TLS), HTTPRoute/GRPCRoute (app teams: routing). - Gateway API supports header and method matching, traffic splitting by weight (canaries), request mirroring, redirects, and cross-namespace routing guarded by
ReferenceGrant, all in the spec. - Many controllers implement it: Envoy Gateway, Istio, Cilium, NGINX Gateway Fabric, Traefik, Kong, and the cloud load balancers of GKE, EKS and AKS.
Interview questions
- Ingress vs a LoadBalancer Service?
- Why is Gateway API replacing Ingress?
- We still run ingress-nginx. What do you recommend?
Config & storage
ConfigMaps & Secrets
Keep config out of images: ConfigMaps for plain settings, Secrets for sensitive values (which are only base64-encoded by default).
- Consume both as environment variables (
env,envFrom) or as mounted files (volume). Each object is limited to about 1 MiB. - Env vars are read once at container start; changing the ConfigMap needs a Pod restart. Mounted volumes update eventually (about a minute), except
subPathmounts, which never update. - Secrets are base64-encoded, not encrypted. Anyone who can
getthem or read etcd sees the values. Protect them with RBAC, encryption at rest (EncryptionConfiguration, ideally a KMS provider) and audit logs. - Many teams keep the source of truth outside the cluster: External Secrets Operator (Vault, AWS/GCP/Azure secret managers), the Secrets Store CSI driver, or Sealed Secrets/SOPS for encrypted secrets in Git.
- Secret types include
Opaque,kubernetes.io/tls,kubernetes.io/dockerconfigjson(forimagePullSecrets) andkubernetes.io/basic-auth. immutable: trueblocks changes and reduces API server watch load. Roll out changes with a new name (Kustomize generators add a hash suffix) to trigger a rolling update.
Interview questions
- ConfigMap vs Secret?
- Are Kubernetes Secrets secure?
- I updated a ConfigMap but the app still uses the old value. Why?
Volumes, PV, PVC & StorageClass
A PVC is a request for storage; a PV is the actual volume; a StorageClass lets the cluster create PVs on demand.
- Container filesystems are ephemeral. Volumes add storage:
emptyDir(lives as long as the Pod),configMap/secret/projected,hostPath(node disk, risky), andpersistentVolumeClaim. - PersistentVolume (PV): a cluster-scoped piece of storage. PersistentVolumeClaim (PVC): a namespaced request (size, access mode, class) that binds to one PV.
- Dynamic provisioning: a PVC names a StorageClass, and its CSI driver (EBS, Persistent Disk, Azure Disk, Ceph...) creates the PV automatically.
- Access modes: RWO (one node read-write), ROX (many nodes read-only), RWX (many nodes read-write, needs file storage like NFS/EFS), RWOP (one Pod). Block disks are usually RWO only.
- Reclaim policy:
Delete(default for dynamic PVs, deletes the disk with the PVC) orRetain(keeps the disk for manual recovery). volumeBindingMode: WaitForFirstConsumerdelays provisioning until a Pod is scheduled, so the disk is created in the same zone as the Pod.allowVolumeExpansion: trueallows growing a PVC.
Interview questions
- Explain PV, PVC and StorageClass.
- What happens to data when a Pod or PVC is deleted?
- Why use
WaitForFirstConsumer?
Resources, health & scheduling
Requests, limits, QoS & OOMKilled
Requests reserve capacity for scheduling; limits cap usage. Together they set the Pod's QoS class and who gets evicted first.
- Requests are what the scheduler uses: a node only gets the Pod if the sum of requests fits its allocatable capacity. They also set the CPU weight under contention.
- Limits are enforced by the kernel via cgroups. CPU is compressible: over the limit the container is throttled. Memory is not: over the limit the container is OOMKilled (exit code 137).
- Units: CPU in cores or millicores (
500m= half a core); memory in bytes withMi/Gi(powers of 2) orM/G(powers of 10). - QoS classes: Guaranteed (every container has CPU and memory requests equal to limits), Burstable (at least one request or limit set), BestEffort (nothing set).
- Under node memory pressure, the kubelet evicts BestEffort first, then Burstable Pods using the most above their requests, and Guaranteed last.
- Since 1.35, in-place Pod resize is stable: you can change CPU and memory requests/limits of a running Pod through its
resizesubresource, often without a restart.
Interview questions
- Difference between requests and limits?
- What happens when a container exceeds its CPU limit vs memory limit?
- What are QoS classes and why do they matter?
- A Pod keeps getting OOMKilled. How do you fix it?
Liveness, readiness & startup probes
Liveness restarts a stuck container, readiness controls traffic, and startup gives slow apps time to boot.
- Liveness: 'is the process healthy?' Failure → the kubelet restarts the container. Use it for deadlocks that the process can't recover from.
- Readiness: 'can it serve traffic now?' Failure → the Pod is removed from Service endpoints, not restarted. It runs for the Pod's whole life.
- Startup: 'has it finished booting?' Until it passes, liveness and readiness are disabled. Use it for slow starters instead of a huge
initialDelaySeconds. - Mechanisms:
httpGet(2xx/3xx = success),tcpSocket,exec(exit 0), andgrpc(gRPC health protocol). - Defaults:
periodSeconds: 10,timeoutSeconds: 1,failureThreshold: 3,successThreshold: 1. Max startup time ≈failureThreshold × periodSeconds. - With no readiness probe, a container is treated as ready as soon as it starts, so it gets traffic before the app is listening.
Interview questions
- Liveness vs readiness probe?
- Why do we need a startup probe?
- Should a readiness probe check downstream dependencies?
Autoscaling: HPA, VPA, Cluster Autoscaler & Karpenter
HPA changes the number of Pods, VPA changes Pod sizes, and node autoscalers change the number of nodes.
- HPA (
autoscaling/v2) scales a Deployment or StatefulSet on CPU/memory (from metrics-server), custom or external metrics. Rule:desired = ceil(current × currentValue / target). - Utilization targets are a percentage of requests, so HPA needs requests set. Scale-down uses a stabilization window (default 300 s) to avoid flapping; tune with
behavior. - VPA (separate add-on) recommends or sets requests. Modes:
Off,Initial,Recreate(default),InPlaceOrRecreate,InPlace; the oldAutomode is deprecated. Don't let HPA and VPA both act on the same CPU/memory metric. - Cluster Autoscaler watches for unschedulable (Pending) Pods and grows node groups; it removes underused nodes when their Pods fit elsewhere.
- Karpenter provisions right-sized nodes directly (no fixed node groups), picks instance types from Pod needs, and consolidates to cut cost. It is common on EKS and powers AKS Node Auto Provisioning.
- KEDA scales on event sources (queue length, Kafka lag) and can scale to zero. Node autoscalers react to requests, not real usage.
Interview questions
- HPA vs VPA vs Cluster Autoscaler?
- How does HPA calculate replicas?
- Karpenter vs Cluster Autoscaler?
- HPA isn't scaling. What do you check?
Scheduling: affinity, taints & topology spread
Affinity pulls Pods toward nodes or other Pods; taints push Pods away unless they tolerate them; spread constraints balance Pods across zones.
- nodeSelector: simplest rule, the node must have all listed labels.
- nodeAffinity: richer expressions (
In,NotIn,Exists...).requiredDuringSchedulingIgnoredDuringExecutionis a hard rule;preferred...is a weighted wish. 'IgnoredDuringExecution' means running Pods are not moved if labels change. - podAffinity / podAntiAffinity: place Pods near (same node/zone) or away from Pods with certain labels, using a
topologyKeylikekubernetes.io/hostnameortopology.kubernetes.io/zone. - Taints on nodes repel Pods; tolerations on Pods allow (but don't force) placement there. Effects:
NoSchedule,PreferNoSchedule,NoExecute(also evicts running Pods). - topologySpreadConstraints keep the difference between domains within
maxSkew;whenUnsatisfiable: DoNotSchedule(hard) orScheduleAnyway(soft). Usually cheaper than anti-affinity at scale. - PriorityClass lets important Pods preempt (evict) lower-priority ones when the cluster is full. PodDisruptionBudgets limit voluntary evictions such as node drains.
Interview questions
- Taints and tolerations vs node affinity?
- How do you make sure replicas don't all land in one zone?
- What does the
NoExecutetaint effect do?
Security
RBAC & ServiceAccounts
RBAC grants verbs on resources to users, groups and ServiceAccounts; ServiceAccounts are the identity of Pods.
- Kubernetes has no user database. Authentication comes from certificates, OIDC tokens (SSO), or cloud IAM. Authorization is usually RBAC.
- Role (namespaced) and ClusterRole (cluster-wide or reusable) list
apiGroups,resourcesandverbs(get,list,watch,create,update,patch,delete). Rules only allow; there is no deny. - RoleBinding grants a Role or ClusterRole inside one namespace; ClusterRoleBinding grants a ClusterRole everywhere.
- Every Pod runs as a ServiceAccount (
defaultif not set). It gets a short-lived, audience-bound projected token; long-lived token Secrets are no longer created automatically. - Set
automountServiceAccountToken: falsefor Pods that don't call the API. Map ServiceAccounts to cloud IAM with IRSA/EKS Pod Identity, GKE Workload Identity or Entra Workload ID instead of static keys. - Watch for dangerous permissions:
secretsread,pods/exec, creating Pods (can mount any Secret),escalate,bind,impersonate, and wildcards*.
Interview questions
- Role vs ClusterRole, RoleBinding vs ClusterRoleBinding?
- What is a ServiceAccount and how does a Pod use it?
- How would you give a CI pipeline deploy access to one namespace?
NetworkPolicies & Pod Security Standards
NetworkPolicies firewall Pod traffic; Pod Security Standards stop Pods from running with dangerous privileges.
- By default all Pods can talk to all Pods. A NetworkPolicy selects Pods and lists allowed ingress and/or egress peers (podSelector, namespaceSelector, ipBlock) and ports.
- Policies are additive allow-lists. Once any policy selects a Pod for a direction, everything not allowed in that direction is denied. There is no explicit deny rule in this API.
- NetworkPolicies need a CNI that enforces them (Calico, Cilium, cloud-provided options). Otherwise they are silently ignored.
- Pod Security Standards: privileged (no limits), baseline (blocks known escalations: hostNetwork, privileged containers, hostPath...), restricted (non-root, drop all capabilities, seccomp, no privilege escalation).
- Pod Security Admission (built in, replaced PodSecurityPolicy which was removed in 1.25) applies them with namespace labels in
enforce,auditandwarnmodes. - For custom rules (allowed registries, required labels), add a policy engine: Kyverno, OPA Gatekeeper, or built-in ValidatingAdmissionPolicy (CEL).
Interview questions
- How do NetworkPolicies work?
- What are Pod Security Standards and how are they enforced?
- How would you secure a Kubernetes cluster? Give the main layers.
Tooling, extension & operations
Helm & Kustomize
Helm packages and templates apps as versioned releases; Kustomize patches plain YAML for each environment without templates.
- Helm is a package manager. A chart holds templates (Go templates) and default
values.yaml; installing it creates a release with a revision history, so you canupgradeandrollback. - Helm 4 was released in November 2025 (first major version in six years). Helm 3 gets its last feature release in September 2026 and security fixes until February 2027. Charts can live in OCI registries.
- Kustomize has a base plus overlays (dev, prod) that apply patches, name prefixes, labels, image tags and generators. It is built into kubectl as
kubectl apply -k. - Helm is great for distributing software to others (third-party charts, many options). Kustomize is great for your own manifests across environments.
- They combine well: Argo CD and Flux can render Helm charts and apply Kustomize overlays, and Kustomize can post-process Helm output.
- Common Helm commands:
helm upgrade --install,helm template(render locally),helm diff(plugin),helm rollback,helm list.
Interview questions
- Helm vs Kustomize?
- What is a Helm release and how does rollback work?
- How do you manage environment differences (dev/staging/prod)?
CRDs, operators & controllers
A CRD adds a new resource type to the API; an operator is a controller that manages that resource with built-in operational knowledge.
- A CustomResourceDefinition (
apiextensions.k8s.io/v1) registers a new kind (e.g.PostgresCluster) with an OpenAPI schema. After that, kubectl, RBAC and watches work on it like built-in types. - A CRD alone only stores data. A controller watches the custom resources and reconciles real objects (StatefulSets, Services, backups) to match.
- An operator = CRD + controller that encodes what a human operator would do: install, upgrade, fail over, back up, scale. Examples: Prometheus Operator, cert-manager, CloudNativePG, Strimzi (Kafka).
- Built with controller-runtime via Kubebuilder or the Operator SDK (Go), or frameworks in other languages (e.g. kopf for Python).
- Key patterns: idempotent reconcile,
statussubresource and conditions, finalizers for cleanup before deletion, owner references for garbage collection, and leader election. - Other extension points: admission webhooks, API aggregation (e.g. metrics-server), and scheduler plugins.
Interview questions
- What is an operator?
- CRD vs ConfigMap for custom configuration?
- What is a finalizer?
Troubleshooting Pods & clusters
Read the status, then describe for Events, then logs, then get inside. Most failures fall into a few named states.
- Pending: not scheduled. Look at Events: insufficient CPU/memory (requests too big), untolerated taints, affinity that can't be met, unbound PVC, or quota exceeded.
- ImagePullBackOff / ErrImagePull: wrong image name or tag, private registry without
imagePullSecretsor node IAM, rate limits, or wrong architecture. - CrashLoopBackOff: the container starts and exits again; restarts back off exponentially up to 5 minutes. Check
kubectl logs --previousand the exit code (1 = app error, 137 = SIGKILL/OOM, 143 = SIGTERM). - CreateContainerConfigError: a referenced ConfigMap or Secret (or key) doesn't exist. ContainerCreating stuck: volume attach/mount or CNI problems.
- Running but not working: readiness failing, Service selector or
targetPortwrong, NetworkPolicy blocking, DNS issues. Test from inside the cluster. - Node problems:
kubectl get nodes,describe node(conditions: MemoryPressure, DiskPressure, PIDPressure, Ready), kubelet logs on the node, andkubectl debug node/<name>.
Interview questions
- A Pod is in CrashLoopBackOff. Walk me through debugging it.
- A Pod is stuck in Pending. What do you check?
- What causes ImagePullBackOff?
- The Service returns nothing but the Pods are Running. How do you debug?