Kubernetes Hour 9 (Optional): 50 Production Problems and 50 Interview Questions

Turn the first 7 hours into reflexes for “see the error, know what to check” and into systematic answers you can explain clearly in an interview.
Kubernetes v1.37kind v0.33 · AKS · EKSVerified 2026-11Optional · review and interview prep
Overall learning goals
  • Part A · 50 production problems: each problem includes the original kubectl / event error text, the root cause, the first diagnostic command, the expected output, the fix and prevention. Most can be reproduced on the kind cluster lab.
  • Standard troubleshooting order: symptom (STATUS / events) → locate the layer (scheduling / image / container process / probes / network / storage / permissions / node / cloud platform) → diagnostic commands → fix → prevention.
  • Part B · 50 interview questions: cover architecture, workloads, scheduling, networking, storage, security, multi-tenancy, production operations, AKS/EKS and open-ended scenario design. Each question includes a 30-second short answer, a deeper answer, follow-up questions, bonus points and common wrong answers.
  • Use “Mock interview” (random questions, a 2-minute countdown and self-rated mastery) and “Capstone lab” (mixed-fault scenarios) to check whether you can run Kubernetes in production on your own.

1-hour timetable

#TimeModuleCore contentAnimation · interactionLab
0Before classUsage notes and fault-lab environmentRebuild the kind cluster lab, the shop namespace and metrics-server; reading methodSelf-checkOne-command setup script
100–08A · Scheduling and workloads (problems 1–12)Four kinds of Pending causes, CrashLoopBackOff, OOMKilled, image pulls, missing configuration, probes, stuck rollouts, Jobs, HPAPod status troubleshooting decision tree4 fault reproductions
208–16A · Networking, DNS and traffic (13–25)No endpoints, targetPort, DNS, ndots, NetworkPolicy, LB Pending, Gateway 404/503, source IP, MTU, conntrackNetworking troubleshooting decision tree4 fault reproductions
316–24A · Storage, configuration and security (26–38)PVC Pending, Multi-Attach, permissions, ConfigMap hot reload, Secret leaks, RBAC 403, PSA, webhook timeouts, SA tokens, quotasStorage/security troubleshooting decision tree4 fault reproductions
424–30A · Upgrades, scaling, nodes and cloud platforms (39–50)NotReady, DiskPressure eviction, PDB blocking drain, deprecated APIs, certificates, etcd quota, cgroup v1, EKS IP exhaustion, AKS upgrade stuckNode upgrade (drain) simulator3 fault reproductions
530–37B · Architecture and core objects (interview 1–13)Control plane, the full apply path, etcd, Pod, controllers, Service, SSA, CRD/Operator, API deprecationMock interview2 scenario questions
637–44B · Workloads, scheduling and networking (14–25)QoS, probes, release strategies, StatefulSet, scheduler, topology spread, CNI, kube-proxy, DNS, Gateway, NetworkPolicyMock interview2 scenario questions
744–52B · Storage, security and multi-tenancy (26–38)PV/PVC/CSI, running databases on Kubernetes, Secret, authentication/authorization/admission, RBAC, Workload Identity, PSS, multi-tenancy, supply chainMock interview3 scenario questions
852–60B · Production operations, cloud platforms and scenario design (39–50)Scaling system, observability, upgrade strategy, Helm/Kustomize, GitOps, AKS vs EKS, HA/DR, cost, incident reviews, troubleshooting methodologyMock interview3 scenario questions

One hour is only enough for a first pass. Use this as a question bank you keep coming back to: each day, do one module quiz and 5 mock interview questions.

Knowledge Coverage Matrix

Target skillA1A2A3A4B5B6B7B8Key commandsLab
Read Pod STATUS and events✓–✓✓✓––✓kubectl describe pod, get events --sort-by1-A/1-B
Scheduling and resources✓––✓–✓–✓describe node, top, get pdb1-A, 4-B
Container process and probes✓✓–––✓––logs --previous, debug1-B/1-C
Service / DNS / NetworkPolicy–✓––✓✓––get endpointslices, nslookup, dig2-A…2-D
Gateway API / external traffic–✓–––✓–✓get httproute -o yaml (status.parents)2-C
Storage and stateful apps✓–✓–––✓✓get pvc,pv,sc, get volumeattachment3-A
RBAC / PSA / admission––✓–––✓–auth can-i --as, label ns pod-security…3-B/3-C
Nodes, upgrades, certificates, etcd–––✓✓––✓drain, kubeadm certs check-expiration, etcdctl endpoint status4-A…4-C
AKS / EKS platform issues–✓✓✓––✓✓az aks nodepool upgrade, aws eks list-insightsExplanation only (not reproduced)
Interview communication and scenario design––––✓✓✓✓Whiteboard diagram + STAR reviewMock interview

Excluded from this hour

  • Systematic teaching of new concepts: this hour covers only problems and interview review. For the underlying principles, see hours 1–7 (each problem links to them at the end).
  • Deep troubleshooting of service meshes (Istio/Linkerd), eBPF kernel tracing and etcd source-level tuning: out of scope; see each project's official documentation.
  • CKA/CKS exam question formats: this hour focuses on production and interviews, not exam simulation; the CNCF official outline is the authority for the exam.
  • Problems specific to other platforms such as GKE or OpenShift: cloud platforms are covered only for AKS (hour 6) and EKS (hour 7).

How to use this material

Part A · symptom first, then cause

The “Quick view” tab can filter by error keyword (for example Insufficient cpu, OOMKilled, 403). Click a row to jump to “Problem details”. Each detail follows this structure: symptom → root cause → diagnostic commands → expected output → fix → prevention → see hour N.

Part B · answer first, then check

The “Mock interview” tab picks questions at random with a 2-minute countdown. Answer aloud first, then expand the reference answer and self-rate as “Answered / Partial / Didn't know”. Results are stored locally and your mastery rate is shown. Difficulty: BeginnerIntermediateAdvanced.

Hands-on · reproduce, then fix

Each Part A module has a “reproduction lab”: create the fault on the kind cluster lab → observe the error → diagnose → fix → clean up. AKS/EKS-specific problems only get explanations and commands; reproduction is not required (it needs a cloud account and incurs costs).

Version note This hour is based on Kubernetes v1.37 (latest patch 1.37.1, 2026-09-15). Labs use kind v0.33.0 (node image kindest/node:v1.37.0). The wording of kubectl, kubelet and cloud platform errors changes across versions, so this hour lists typical original text; defer to the output your own cluster actually shows. The key is to recognize the keywords (for example Insufficient, untolerated taint, violates PodSecurity).

Module 0 · Usage notes and fault-lab environment

Before class · Reuse the kind cluster lab and the shop app to prepare an environment you can break freely
Before class: 5–10 minkind v0.33.0 · v1.37.0Local · no cloud cost
Goals for this module
  • A kind cluster lab (1 control plane + 2 workers) and the namespace shop, consistent with hours 1–6.
  • Install metrics-server (needed for HPA problems) and, optionally, cloud-provider-kind (for the LoadBalancer comparison problem).
  • Memorize the general “first-minute troubleshooting commands”.

1. Prerequisites

  • Lab machine: the Azure VM from hour 1 (Ubuntu 24.04, Standard_D4s_v5, resource group rg-k8s-lab, canadacentral) or local Docker Desktop; Docker Engine 29.x.
  • Tools: kind v0.33.0, kubectl v1.37.x (within ±1 minor version of the apiserver), jq, and optionally helm 4.3.x.
  • Knowledge: complete hours 1–6; the AKS problems need the background of hour 6, and the EKS problems need the background of hour 7.

2. Rebuild (or reuse) the lab cluster

If the lab cluster from hour 6 still exists, reuse it (kubectl config use-context kind-lab). Otherwise, run:

mkdir -p ~/k8slab/p8 && cd ~/k8slab/p8
cat > kind-lab.yaml <<'EOF'
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: lab
nodes:
- role: control-plane
  image: kindest/node:v1.37.0@sha256:a1ed56cfb0e7b93589bdf97c8cd566405a265939e3620fc4f5de89adff580ae5
- role: worker
  image: kindest/node:v1.37.0@sha256:a1ed56cfb0e7b93589bdf97c8cd566405a265939e3620fc4f5de89adff580ae5
- role: worker
  image: kindest/node:v1.37.0@sha256:a1ed56cfb0e7b93589bdf97c8cd566405a265939e3620fc4f5de89adff580ae5
EOF
kind get clusters | grep -qx lab || kind create cluster --config kind-lab.yaml
kubectl cluster-info --context kind-lab
kubectl get nodes -o wide
NAME                STATUS   ROLES           AGE   VERSION   INTERNAL-IP   OS-IMAGE                         CONTAINER-RUNTIME
lab-control-plane   Ready    control-plane   62s   v1.37.0   172.18.0.4    Debian GNU/Linux 12 (bookworm)   containerd://2.x
lab-worker          Ready    <none>          45s   v1.37.0   172.18.0.2    Debian GNU/Linux 12 (bookworm)   containerd://2.x
lab-worker2         Ready    <none>          45s   v1.37.0   172.18.0.3    Debian GNU/Linux 12 (bookworm)   containerd://2.x

OS-IMAGE and the containerd minor version are example values; kind's default CNI, kindnet, has supported NetworkPolicy since v0.24.0 (see hour 3).

3. Deploy the baseline shop app

kubectl create namespace shop --dry-run=client -o yaml | kubectl apply -f -
kubectl config set-context --current --namespace=shop
cat > api.yaml <<'EOF'
apiVersion: apps/v1
kind: Deployment
metadata: {name: api, namespace: shop, labels: {app: api}}
spec:
  replicas: 2
  selector: {matchLabels: {app: api}}
  template:
    metadata: {labels: {app: api}}
    spec:
      containers:
      - name: api
        image: ghcr.io/stefanprodan/podinfo:6.17.0
        ports: [{containerPort: 9898, name: http}]
        resources:
          requests: {cpu: 100m, memory: 64Mi}
          limits: {memory: 128Mi}
        readinessProbe: {httpGet: {path: /readyz, port: http}, periodSeconds: 5}
        livenessProbe: {httpGet: {path: /healthz, port: http}, periodSeconds: 10}
---
apiVersion: v1
kind: Service
metadata: {name: api, namespace: shop}
spec:
  selector: {app: api}
  ports: [{name: http, port: 80, targetPort: http}]
EOF
kubectl apply -f api.yaml
kubectl rollout status deploy/api
kubectl run curl --image=curlimages/curl:8.17.0 --restart=Never --rm -it -- curl -s api.shop/version
deployment "api" successfully rolled out
{
  "commit": "…",
  "version": "6.17.0"
}
pod "curl" deleted

For the tags of curlimages/curl, use the version currently available on Docker Hub; if the pull fails, switch to curlimages/curl:latest.

4. Install metrics-server (needed for problem #12)

kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
# kind's kubelet uses a self-signed certificate, so the lab must skip verification (do not do this in production)
kubectl -n kube-system patch deploy metrics-server --type=json \
  -p='[{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--kubelet-insecure-tls"}]'
kubectl -n kube-system rollout status deploy/metrics-server
kubectl top nodes

5. First-minute troubleshooting commands (used throughout this hour)

# 1) Global view: which Pods are not Running/Completed
kubectl get pods -A --field-selector=status.phase!=Running,status.phase!=Succeeded
# 2) Events: sorted by time, Warning only
kubectl get events -A --field-selector type=Warning --sort-by=.lastTimestamp | tail -30
# 3) Single Pod: Events section + Last State + container exit code
kubectl describe pod POD -n NS
kubectl logs POD -n NS -c CONTAINER --previous
# 4) Controllers: Deployment conditions, ReplicaSet events
kubectl describe deploy NAME -n NS ; kubectl get rs -n NS
# 5) Node: Conditions, Allocated resources, Taints
kubectl describe node NODE | sed -n '/Taints/,/Events/p'

6. Self-check

Clean up the whole environment when you finish: kind delete cluster --name lab; if you used the Azure VM: az group delete -n rg-k8s-lab --yes --no-wait.

Module 1 · Part A: Scheduling and Workloads (problems 1–12)

00:00 – 08:00 · Pending, CrashLoopBackOff, OOMKilled, images, configuration, probes, rollouts, Jobs, HPA
8 minkube-scheduler · kubelet · controllers12 problems · ★★★★★
Learning goals
  • Use STATUS to identify the failing layer: Pending = scheduling; ErrImagePull/ImagePullBackOff = image; CreateContainerConfigError = configuration reference; CrashLoopBackOff/OOMKilled = container process; Running but 0/1 READY = probe.
  • Read the sections of 0/3 nodes are available: … and the second half about preemption.
  • Know where to start diagnosing stuck rollouts, failed Jobs and HPAs that won't scale (use conditions and events).
Prerequisites: hour 1 (Pods and Deployments), hour 2 (resources, probes, scheduling and Jobs), hour 6 (HPA). Importance: ★★★★★

Type an error keyword (for example Insufficient, taint, 137, not found, deadline) to filter, then click a row to jump to its details.

#1 0/3 nodes are available: 3 Insufficient cpu (Pending: insufficient resources)
Events:
  Warning  FailedScheduling  12s   default-scheduler  0/3 nodes are available: 1 node(s) had untolerated taint {node-role.kubernetes.io/control-plane: }, 2 Insufficient cpu. preemption: 0/3 nodes are available: 1 Preemption is not helpful for scheduling, 2 No preemption victims found for incoming pod.
Symptom

The Pod stays Pending, and kubectl get pod -o wide shows <none> in the NODE column.

Root cause

The scheduler compares the sum of requests with Allocatable, not actual usage: even if kubectl top is low, a node whose requests are full cannot take the Pod. Triggers: oversized requests (for example cpu: "4"), more replicas, DaemonSets taking capacity, and system or kube-reserved resources making Allocatable smaller than physical capacity. The second half about preemption means that even after preempting lower-priority Pods, it still doesn't fit.

Diagnostic commands
kubectl describe pod POD | sed -n '/Events/,$p'
# Allocatable and allocated requests on each node
kubectl describe nodes | grep -A8 'Allocated resources'
# The Pod's own requests
kubectl get pod POD -o jsonpath='{range .spec.containers[*]}{.name}{" "}{.resources.requests}{"\n"}{end}'
Allocated resources:
  Resource           Requests      Limits
  cpu                3850m (96%)   200m (5%)
  memory             1270Mi (8%)   2Gi (13%)
Fix
  • Lower the requests based on real usage (kubectl top pod, Prometheus P95), or add nodes to the node pool (CA / Karpenter, #46).
  • Set a PriorityClass on critical workloads so they can preempt lower-priority Pods.
Prevention
  • Configure a LimitRange with default requests in the namespace.
  • Monitor kube_pod_status_phase{phase="Pending"} and requests utilization, not just CPU usage.

See Hour 2: Resources and Scheduling.

#2 0/3 nodes are available: 3 node(s) had untolerated taint {dedicated: gpu} (Pending: taint)
Warning  FailedScheduling  default-scheduler  0/3 nodes are available: 1 node(s) had untolerated taint {node-role.kubernetes.io/control-plane: }, 2 node(s) had untolerated taint {dedicated: gpu}. preemption: 0/3 nodes are available: 3 Preemption is not helpful for scheduling.
Symptom

After a new node pool comes online, all Pods are Pending; or nodes carry automatic taints such as node.kubernetes.io/disk-pressure or node.kubernetes.io/unreachable.

Root cause

The node has a NoSchedule/NoExecute taint and the Pod has no matching toleration. Dedicated pools (GPU, Spot, system pools) often carry taints, such as the AKS system pool CriticalAddonsOnly=true:NoSchedule or EKS/Karpenter NodePools. A toleration only allows the Pod onto the node; to attract the Pod, you need nodeSelector or affinity.

Diagnostic commands
kubectl get nodes -o custom-columns=NAME:.metadata.name,TAINTS:.spec.taints
kubectl get pod POD -o jsonpath='{.spec.tolerations}' | jq
NAME                TAINTS
lab-control-plane   [map[effect:NoSchedule key:node-role.kubernetes.io/control-plane]]
lab-worker          [map[effect:NoSchedule key:dedicated value:gpu]]
lab-worker2         [map[effect:NoSchedule key:dedicated value:gpu]]
Fix
spec:
  tolerations:
  - {key: dedicated, operator: Equal, value: gpu, effect: NoSchedule}
  nodeSelector: {pool: gpu}  # Also use a selector to direct the Pod to this pool

Taint added by mistake: kubectl taint nodes lab-worker dedicated=gpu:NoSchedule- (a trailing minus removes it).

Prevention
  • Write taints and labels together into the node pool IaC (Terraform, Bicep or eksctl), and expose tolerations in Helm values.
  • Automatic taints (disk-pressure and similar) indicate an unhealthy node: fix the node first (#40) instead of adding tolerations to Pods.

See Hour 2: Scheduling.

#3 node(s) didn't match Pod's node affinity/selector · didn't match pod topology spread constraints (Pending: affinity and topology)
Warning  FailedScheduling  default-scheduler  0/3 nodes are available: 1 node(s) had untolerated taint {…}, 2 node(s) didn't match Pod's node affinity/selector. preemption: …
Warning  FailedScheduling  default-scheduler  0/3 nodes are available: 2 node(s) didn't match pod topology spread constraints, 1 node(s) had untolerated taint ...
Warning  FailedScheduling  default-scheduler  0/3 nodes are available: 2 node(s) didn't match pod anti-affinity rules, ...
Symptom

Gets stuck when scaling to the 3rd replica, or all Pods stay Pending after switching node pools.

Root cause
  • nodeSelector / requiredDuringScheduling: no node has the required label (a typo, a new pool missing the label, or a changed key such as topology.kubernetes.io/zone).
  • Required anti-affinity (one replica per node) while the replica count > the number of nodes.
  • topologySpreadConstraints set to whenUnsatisfiable: DoNotSchedule + maxSkew: 1, while one zone has no capacity.
Diagnostic commands
kubectl get pod POD -o jsonpath='{.spec.affinity}{"\n"}{.spec.nodeSelector}{"\n"}{.spec.topologySpreadConstraints}' | jq .
kubectl get nodes -L topology.kubernetes.io/zone,pool,kubernetes.io/arch
kubectl get pods -l app=api -o wide  # Which nodes the existing replicas are spread across
Fix
  • Add the label: kubectl label node lab-worker pool=general, or correct the selector.
  • Change hard anti-affinity to preferredDuringSchedulingIgnoredDuringExecution, or change the topology spread to ScheduleAnyway.
Prevention
  • For high availability, prefer topologySpreadConstraints (DoNotSchedule for zone, ScheduleAnyway for hostname) + PDB.
  • Design the replica count, zone count and minimum node count of the node pool together; the HPA maxReplicas must also account for anti-affinity.

See Hour 2: Scheduling.

#4 had volume node affinity conflict / pod has unbound immediate PersistentVolumeClaims (Pending: volume)
Warning  FailedScheduling  default-scheduler  0/3 nodes are available: pod has unbound immediate PersistentVolumeClaims. preemption: …
Warning  FailedScheduling  default-scheduler  0/3 nodes are available: 1 node(s) had untolerated taint {…}, 2 node(s) had volume node affinity conflict. ...
Symptom

A StatefulSet Pod (such as db-0) is Pending after being rebuilt or on its first deployment.

Root cause
  • Unbound immediate PVC: the PVC is not bound (no default StorageClass, or the provisioner failed); check the PVC instead (#26).
  • volume node affinity conflict: the PV carries a nodeAffinity (a cloud disk is restricted to a zone, a local PV to a node), and that location has no capacity, has taints, or was deleted. For example, the disk is in zone 1, but zone 1's nodes were scaled to 0.
Diagnostic commands
kubectl get pvc -n shop
PV=$(kubectl get pvc data-db-0 -o jsonpath='{.spec.volumeName}')
kubectl get pv $PV -o jsonpath='{.spec.nodeAffinity}' | jq
kubectl get nodes -L topology.kubernetes.io/zone
{"required":{"nodeSelectorTerms":[{"matchExpressions":[{"key":"topology.kubernetes.io/zone","operator":"In","values":["canadacentral-1"]}]}]}}
Fix
  • The zone where the PV lives must have schedulable nodes (one node pool per zone, or Karpenter allowing that zone).
  • Use volumeBindingMode: WaitForFirstConsumer in the StorageClass, so the volume is created in the right zone after the Pod is scheduled.
  • To migrate data across zones: snapshot, then restore in the target zone (hour 4). Do not delete the PVC.
Prevention

Use zone-redundant storage for stateful workloads (such as Azure ZRS disks) or database replication; spread node pools across zones and set minimum node counts.

See Hour 4: Storage Topology.

#5 CrashLoopBackOff · Back-off restarting failed container api in pod …
NAME                   READY   STATUS             RESTARTS      AGE
api-7d9c6b8f5d-x2kqp   0/1     CrashLoopBackOff   5 (32s ago)   3m

    Last State:     Terminated
      Reason:       Error
      Exit Code:    1
Events:
  Warning  BackOff  10s (x14 over 3m)  kubelet  Back-off restarting failed container api in pod api-7d9c6b8f5d-x2kqp_shop(4f1c…)
Symptom

The container exits right after starting, and the kubelet restarts it with exponential backoff (10s, 20s, 40s… capped at 5 minutes). CrashLoopBackOff is a result, not a cause.

Root cause

Check the Exit Code: 1/2 is an application error (missing configuration, cannot connect to the database, wrong arguments); 127 is command not found (wrong command/args, or the image lacks that binary); 126 means no execute permission; 137 means killed by SIGKILL (OOM #6 or a failed liveness probe #9); 139 is a segmentation fault; 0 means it exited normally but restartPolicy=Always (a one-off script put in a Deployment).

Diagnostic commands
kubectl logs POD -c api --previous  # Logs from the previous crash (the most important)
kubectl get pod POD -o jsonpath='{.status.containerStatuses[0].lastState.terminated}' | jq
kubectl get pod POD -o jsonpath='{.spec.containers[0].command}{" "}{.spec.containers[0].args}'
# A container that dies instantly can't be exec'd: copy the Pod and run sleep instead, then get in to investigate
kubectl debug POD -it --copy-to=api-debug --container=api -- sh
{"containerID":"containerd://…","exitCode":1,"reason":"Error","startedAt":"…","finishedAt":"…"}
level=fatal msg="failed to parse flags" error="unknown flag: --ui-mesage"
Fix

Fix the configuration, arguments or dependencies based on the logs. If a dependency isn't ready yet, retry inside the application or wait with an init container, rather than relying on Kubernetes restarts.

Prevention
  • Run an image startup smoke test and configuration schema validation in CI.
  • Write fatal errors to stderr and set terminationMessagePolicy: FallbackToLogsOnError, so describe shows the last few log lines right away.

See Hour 1: Pod, the Smallest Scheduling Unit and Hour 6: Observability and kubectl debug.

#6 Last State: Terminated · Reason: OOMKilled · Exit Code: 137
    State:          Running
    Last State:     Terminated
      Reason:       OOMKilled
      Exit Code:    137
    Restart Count:  4
    Limits:
      memory:  128Mi
Symptom

Pods restart periodically (more often at peak), or the node evicts Pods under memory pressure (Evicted, The node was low on resource: memory).

Root cause

Container memory exceeds limits.memory, and the cgroup triggers the kernel OOM killer (SIGKILL → 137). Common causes: JVM or Node.js heap not sized to the limit, memory leaks, uncapped caches, or limits set too low. Nodes use cgroup v2 (v1 has been rejected by default since v1.35, #47). In v1.37, MemoryQoS Beta is enabled by default: memory.high applies reclaim pressure near the limit, but exceeding the limit still causes OOM.

Diagnostic commands
kubectl get pod POD -o jsonpath='{range .status.containerStatuses[*]}{.name}{" "}{.lastState.terminated.reason}{"\n"}{end}'
kubectl top pod POD --containers
kubectl get events --field-selector reason=OOMKilling -A  # Node-level OOM (only visible when a node problem detector is running)
kubectl describe node NODE | grep -i -A3 'MemoryPressure'
Fix
  • Raise the limit based on P99 plus headroom. requests = limits (Guaranteed) protects the Pod from being evicted first under node pressure.
  • Adjust for the runtime: for Java, use -XX:MaxRAMPercentage=75; for Node.js, use --max-old-space-size.
  • Since v1.35, in-place Pod resize is GA. You can adjust temporarily with kubectl patch pod POD --subresource resize -p '{"spec":{"containers":[{"name":"api","resources":{"limits":{"memory":"256Mi"}}}]}}' (whether it restarts depends on resizePolicy), then write the change back to the Deployment.
Prevention

Use VPA (Off/Initial) to collect recommendations; alert on kube_pod_container_status_last_terminated_reason{reason="OOMKilled"}; watch container_memory_working_set_bytes during load tests.

See Hour 2: Resource requests/limits and QoS and Hour 6: Autoscaling.

#7 ErrImagePull / ImagePullBackOff · failed to pull and unpack image … not found / 401 Unauthorized
Warning  Failed     kubelet  Failed to pull image "ghcr.io/stefanprodan/podinfo:6.17": rpc error: code = NotFound desc = failed to pull and unpack image "…": failed to resolve reference "…": ghcr.io/stefanprodan/podinfo:6.17: not found
Warning  Failed     kubelet  Error: ErrImagePull
Warning  Failed     kubelet  Error: ImagePullBackOff
Symptom

STATUS alternates between ErrImagePull and ImagePullBackOff, and the container never starts.

Root cause
KeywordMeaning
not found / manifest unknownWrong tag or repository name, or the image was deleted
401 Unauthorized / 403 Forbidden / pull access deniedNo imagePullSecrets configured; AKS not attached to ACR (az aks update --attach-acr); EKS node role lacks ECR read permission
429 Too Many Requests / toomanyrequestsDocker Hub anonymous pull rate limit
no matching manifest for linux/arm64The image lacks this architecture (Graviton/Ampere)
dial tcp … i/o timeoutThe node cannot reach the internet (no NAT, private endpoint or proxy)
Diagnostic commands
kubectl describe pod POD | grep -A3 -i 'failed to pull'
kubectl get pod POD -o jsonpath='{.spec.imagePullSecrets}{" "}{.spec.serviceAccountName}'
# Pull directly with CRI on the node to rule out Kubernetes (kind nodes are containers)
docker exec lab-worker crictl pull ghcr.io/stefanprodan/podinfo:6.17.0
Fix
kubectl create secret docker-registry regcred --docker-server=REGISTRY --docker-username=U --docker-password=P -n shop
kubectl patch serviceaccount default -n shop -p '{"imagePullSecrets":[{"name":"regcred"}]}'
Prevention
  • In production, use immutable tags or a @sha256: digest; sync images to ACR/ECR and enable a pull-through cache to avoid rate limits.
  • Build multi-architecture images (docker buildx --platform linux/amd64,linux/arm64).

See Hour 1: Pod and Docker course: image registries.

#8 CreateContainerConfigError · Error: configmap "api-config" not found / couldn't find key
Warning  Failed  kubelet  Error: configmap "api-config" not found
Warning  Failed  kubelet  Error: secret "db-cred" not found
Warning  Failed  kubelet  Error: couldn't find key DB_HOST in ConfigMap shop/api-config
Warning  Failed  kubelet  Error: container has runAsNonRoot and image will run as root (pod: "api-…", container: api)
Symptom

STATUS is CreateContainerConfigError, RESTARTS is 0, and the container is never created.

Root cause

Before creating the container, the kubelet resolves the ConfigMap and Secret references in env.valueFrom / envFrom and their keys, and validates the securityContext (for example, runAsNonRoot: true while the image runs as UID 0). A missing object, a reference to another namespace (cross-namespace references are not allowed), or a misspelled key all produce this error. A missing ConfigMap mounted as a volume produces ContainerCreating + FailedMount instead.

Diagnostic commands
kubectl get cm,secret -n shop
kubectl get cm api-config -n shop -o jsonpath='{.data}' | jq 'keys'
kubectl get pod POD -o yaml | grep -B2 -A4 -E 'configMapKeyRef|secretKeyRef|envFrom'
Fix
  • Create the ConfigMap or Secret before deploying (same Helm/Kustomize release unit; use sync-wave in Argo CD).
  • Use optional: true for optional configuration.
  • runAsNonRoot conflict: set USER 10001 in the image or specify runAsUser.
Prevention

Run kubectl apply --dry-run=server against the rendered manifests in CI. When using External Secrets or the CSI Secrets Store, monitor syncing so Pods don't start before their Secret is ready.

See Hour 2: ConfigMap and Secret and Hour 5: securityContext.

#9 Liveness probe failed … connection refused · Container api failed liveness probe, will be restarted
Warning  Unhealthy  kubelet  Readiness probe failed: Get "http://10.244.1.7:9898/readyz": dial tcp 10.244.1.7:9898: connect: connection refused
Warning  Unhealthy  kubelet  Liveness probe failed: Get "http://10.244.1.7:9898/healthz": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
Normal   Killing    kubelet  Container api failed liveness probe, will be restarted
Symptom

Repeated restarts at startup or under high load (137 but not OOM), or stuck at 0/1 READY with no traffic.

Root cause
  • Slow startup without a startupProbe: the liveness probe starts before the app is listening, and after failureThreshold failures the container is killed, so it never comes up.
  • Liveness depends on an external component (such as a database): a dependency blip restarts all replicas at once, causing a cascading failure.
  • Timeout too short: timeoutSeconds defaults to 1 second, so a GC pause or CPU throttling causes a timeout.
  • Wrong port or path (named port mismatch, /health vs /healthz); the app listens only on 127.0.0.1, so the kubelet cannot reach it from the Pod IP.
Diagnostic commands
kubectl get pod POD -o jsonpath='{.spec.containers[0].livenessProbe}' | jq
kubectl get events --field-selector involvedObject.name=POD,reason=Unhealthy
# Send a request to the probe address manually
kubectl run t --image=curlimages/curl:8.17.0 --rm -it --restart=Never -- curl -sv http://POD_IP:9898/healthz
Fix
startupProbe:  {httpGet: {path: /healthz, port: http}, periodSeconds: 5, failureThreshold: 30}  # Allows up to 150 seconds to start
livenessProbe: {httpGet: {path: /healthz, port: http}, periodSeconds: 10, timeoutSeconds: 3, failureThreshold: 3}
readinessProbe: {httpGet: {path: /readyz, port: http}, periodSeconds: 5}
Prevention

Liveness should only check whether the process is stuck; put dependency checks in readiness. Don't set the CPU limit too low, because throttling makes probes time out.

See Hour 2: Probes and Graceful Termination.

#10 error: deployment "api" exceeded its progress deadline (ProgressDeadlineExceeded)
Waiting for deployment "api" rollout to finish: 1 out of 3 new replicas have been updated...
error: deployment "api" exceeded its progress deadline

Conditions:
  Type           Status  Reason
  Available      True    MinimumReplicasAvailable
  Progressing    False   ProgressDeadlineExceeded
Symptom

In CI, kubectl rollout status times out; old and new ReplicaSets coexist, and the new Pods are stuck in Pending, CrashLoop or not ready.

Root cause

The Deployment controller hasn't seen a new Pod become Available within progressDeadlineSeconds (default 600 seconds). It is only a summary signal. The cause is in the new ReplicaSet's Pods: one of #1–#9, or a ResourceQuota limit being exceeded (#36, shown as the RS event FailedCreate). It does not roll back automatically; the old replicas keep serving because of maxUnavailable.

Diagnostic commands
kubectl rollout history deploy/api
kubectl get rs -l app=api -o wide  # DESIRED/CURRENT/READY of the new RS
kubectl describe rs NEW_RS | sed -n '/Events/,$p'  # FailedCreate (quota, admission or PSA)
kubectl get pods -l app=api,pod-template-hash=HASH
Fix
kubectl rollout undo deploy/api  # Go back to the previous version
kubectl rollout undo deploy/api --to-revision=3
# After the fix, roll out again; use pause/resume for batch changes
kubectl rollout pause deploy/api ; kubectl rollout resume deploy/api
Prevention
  • In CI, run rollout undo if kubectl rollout status --timeout=5m fails, or use Argo Rollouts or Flagger for canary analysis.
  • Set minReadySeconds so a version that crashes right after becoming ready isn't counted as successful.

See Hour 2: Advanced Release Strategies and Hour 1: Deployment and ReplicaSet.

#11 Job has reached the specified backoff limit (BackoffLimitExceeded) / DeadlineExceeded / Job never completes
Conditions:
  Type     Status  Reason
  Failed   True    BackoffLimitExceeded
Events:
  Warning  BackoffLimitExceeded  job-controller  Job has reached the specified backoff limit

# or
  Warning  DeadlineExceeded      job-controller  Job was active longer than specified deadline
Symptom

A migration Job or backup CronJob fails, or a Job stays Running (COMPLETIONS 0/1).

Root cause
  • The failure count reached backoffLimit (default 6).
  • activeDeadlineSeconds has expired.
  • Never completes: a sidecar (proxy, log agent) is a regular container and doesn't exit when the main container finishes. A native sidecar (initContainers + restartPolicy: Always, GA in v1.33) is terminated once the main container finishes.
  • CronJob doesn't trigger: concurrencyPolicy: Forbid and the previous run hasn't finished; startingDeadlineSeconds is too small; suspend: true; or spec.timeZone is misunderstood.
Diagnostic commands
kubectl get jobs,cronjobs -n shop
kubectl get pods -l job-name=migrate --sort-by=.metadata.creationTimestamp
kubectl logs job/migrate --all-containers
kubectl get cronjob backup -o jsonpath='{.status.lastScheduleTime}{" "}{.status.lastSuccessfulTime}'
Fix
  • Fix the script. For idempotent tasks you can raise backoffLimit. Use podFailurePolicy so non-retryable exit codes fail immediately.
  • Switch to native sidecars, and set ttlSecondsAfterFinished to clean up completed Jobs automatically.
  • Trigger a CronJob manually: kubectl create job --from=cronjob/backup backup-manual-1.
Prevention

For critical CronJobs, monitor lastSuccessfulTime: an alert for “no success in N hours” is more reliable than an alert for “failed”.

See Hour 2: Jobs and CronJobs.

#12 HPA doesn't scale up: <unknown>/70% · failed to get cpu utilization: missing request for cpu
NAME   REFERENCE        TARGETS              MINPODS   MAXPODS   REPLICAS
api    Deployment/api   cpu: <unknown>/70%   2         10        2

Conditions:
  ScalingActive   False   FailedGetResourceMetric  the HPA was unable to compute the replica count: failed to get cpu utilization: missing request for cpu in container api of Pod api-7d9c…
Events:
  Warning  FailedGetResourceMetric  horizontal-pod-autoscaler  failed to get cpu utilization: unable to get metrics for resource cpu: … the server could not find the requested resource (get pods.metrics.k8s.io)
Symptom

Replicas don't change when load rises; TARGETS shows <unknown>; or MAXPODS is reached (ScalingLimited True TooManyReplicas).

Root cause
  • metrics-server is not installed or unavailable (no pods.metrics.k8s.io). In v1.37, metrics.k8s.io is GA (v1beta1 is still available during the transition).
  • A container has no resources.requests.cpu. Utilization = usage / requests, so any container (including sidecars) without requests makes the calculation impossible.
  • maxReplicas is already reached, or the new Pods are Pending (#1/#46).
  • The custom or external metrics adapter (Prometheus Adapter, KEDA) is misconfigured.
Diagnostic commands
kubectl get apiservice v1beta1.metrics.k8s.io v1.metrics.k8s.io 2>/dev/null
kubectl -n kube-system get deploy metrics-server ; kubectl top pods
kubectl describe hpa api | sed -n '/Conditions/,$p'
Fix

Fix metrics-server; add CPU requests to all containers; raise maxReplicas and confirm that node autoscaling is available.

Prevention
  • Use behavior.scaleUp/scaleDown to rate-limit and damp scaling. In v1.37, the configurable HPA tolerance is GA.
  • HPA scale-to-zero (minReplicas: 0) is enabled by default as Beta in v1.37. Waking from 0 needs external or object metrics; CPU is not enough.
  • Don't let HPA and VPA both scale the same workload on CPU or memory.

See Hour 6: Autoscaling.

Every stop in the Pod lifecycle, and the STATUS you see when it fails there ① Admission + write to etcdapiserver / controllers ② SchedulingFilter → Score → Bind ③ Pull image + mount volumeskubelet → CRI / CSI ④ Create and run containerenv resolution · process start ⑤ Probes → ReadyAdded to EndpointSlice RS event FailedCreateQuota #36 · PSA #33Webhook #34→ Stuck rollout #10 Pending#1 resources · #2 taints#3 affinity/topology#4 volume topology ImagePullBackOff #7ContainerCreatingFailedMount #28Multi-Attach #27 CreateContainerConfigError #8CrashLoopBackOff #5OOMKilled #6Job failure #11 Running 0/1Liveness restart #9No endpoints #13HPA not scaling #12 Locating mnemonic: no NODE → check scheduler events; NODE but no container → check kubelet events; container exiting repeatedly → check logs --previous and the Exit CodeController-level problems (the Pod was never created at all) → check the ReplicaSet or Job events, not the Pod
Figure 1-1: locating problems 1–12 by lifecycle stage
Structure of scheduling failure messages (#1–#4) 0/3 nodes are available: 1 node(s) had untolerated taint {…}, 2 Insufficient cpu. preemption: 0/3 nodes are available: … 0/3Feasible nodes / total nodes Nodes eliminated by each Filter pluginTaintToleration · NodeResourcesFit · NodeAffinityPodTopologySpread · VolumeBinding · InterPodAffinity preemption: result of the preemption simulation“not helpful” = preemption can't solve it either (taints or affinity)“No victims” = there are no lower-priority Pods to preempt
Figure 1-2: first count the nodes eliminated for each reason; the total should equal the number of nodes

Pod status troubleshooting decision tree

Select a symptom and step through to get the diagnostic commands and conclusion; you can jump to the matching details. The log area shows the source of each signal (scheduler events, kubelet events or container status).

Environment: the kind cluster lab and namespace shop from module 0. Local only, no cloud cost; clean up after each lab.

Lab 1-A: create Pending (#1, #2)

Request CPU more than Allocatable:
kubectl create deploy hog --image=registry.k8s.io/pause:3.10 -n shop
kubectl set resources deploy/hog -n shop --requests=cpu=64
kubectl get pods -n shop -l app=hog
NAME                   READY   STATUS    RESTARTS   AGE
hog-5c7f9d8b6d-7n2lp   0/1     Pending   0          5s

Use the current pause tag from registry.k8s.io.

Check the scheduler events:
kubectl describe pod -n shop -l app=hog | grep FailedScheduling
Warning  FailedScheduling  … 0/3 nodes are available: 1 node(s) had untolerated taint {node-role.kubernetes.io/control-plane: }, 2 Insufficient cpu. preemption: …
Change the requests back to reasonable values, and taint two workers to observe #2:
kubectl set resources deploy/hog -n shop --requests=cpu=50m
kubectl taint nodes lab-worker lab-worker2 dedicated=gpu:NoSchedule
kubectl rollout restart deploy/hog -n shop; sleep 5
kubectl get pods -n shop -l app=hog
kubectl describe pod -n shop -l app=hog | grep -m1 FailedScheduling
… 2 node(s) had untolerated taint {dedicated: gpu} …
Fix and clean up:
kubectl taint nodes lab-worker lab-worker2 dedicated=gpu:NoSchedule-
kubectl delete deploy hog -n shop

Lab 1-B: CrashLoopBackOff and OOMKilled (#5, #6)

Misspelled argument, exit code 1:
kubectl create deploy crash -n shop --image=ghcr.io/stefanprodan/podinfo:6.17.0 -- ./podinfo --ui-mesage=hi
sleep 40; kubectl get pods -n shop -l app=crash
kubectl logs -n shop -l app=crash --previous --tail=5
crash-6b9…   0/1   CrashLoopBackOff   3 (15s ago)   45s
unknown flag: --ui-mesage

The wording varies with podinfo's argument-parsing library; the key is “unknown flag”.

Use stress to allocate more memory than the limit to cause OOM:
kubectl run oom -n shop --image=polinux/stress --restart=Never \
  --overrides='{"spec":{"containers":[{"name":"oom","image":"polinux/stress","command":["stress","--vm","1","--vm-bytes","200M","--vm-hang","1"],"resources":{"limits":{"memory":"100Mi"}}}]}}'
sleep 10; kubectl get pod oom -n shop -o jsonpath='{.status.containerStatuses[0].state.terminated.reason} {.status.containerStatuses[0].state.terminated.exitCode}{"\n"}'
OOMKilled 137

Community images are for labs only. If the pull fails, use any image that can allocate memory.

Cleanup: kubectl delete deploy crash -n shop; kubectl delete pod oom -n shop

Lab 1-C: image and configuration errors (#7, #8)

Wrong tag and missing ConfigMap:
kubectl create deploy badimg -n shop --image=ghcr.io/stefanprodan/podinfo:9.99.99
kubectl create deploy badcfg -n shop --image=ghcr.io/stefanprodan/podinfo:6.17.0
kubectl set env deploy/badcfg -n shop --from=configmap/api-config
sleep 15; kubectl get pods -n shop -l 'app in (badimg,badcfg)'
badcfg-…   0/1   CreateContainerConfigError   0   15s
badimg-…   0/1   ImagePullBackOff             0   15s

If the ConfigMap doesn't exist, kubectl set env --from errors out. You can first run kubectl create cm api-config --from-literal=A=1, then delete it after set env and run rollout restart.

Diagnose and fix:
kubectl describe pod -n shop -l app=badcfg | grep -m1 'not found'
kubectl create configmap api-config -n shop --from-literal=PODINFO_UI_MESSAGE=hello
kubectl set image deploy/badimg -n shop podinfo=ghcr.io/stefanprodan/podinfo:6.17.0
kubectl rollout status deploy/badcfg -n shop; kubectl rollout status deploy/badimg -n shop
Cleanup: kubectl delete deploy badimg badcfg -n shop; kubectl delete cm api-config -n shop

Lab 1-D: stuck rollout and rollback (#10)

Shorten progressDeadlineSeconds and roll out a bad version:
kubectl patch deploy api -n shop -p '{"spec":{"progressDeadlineSeconds":30}}'
kubectl set image deploy/api -n shop api=ghcr.io/stefanprodan/podinfo:0.0.0-bad
kubectl rollout status deploy/api -n shop --timeout=90s
Waiting for deployment "api" rollout to finish: 1 out of 2 new replicas have been updated...
error: deployment "api" exceeded its progress deadline
Confirm the old replicas are still serving, then roll back:
kubectl get deploy api -n shop -o jsonpath='{.status.conditions[?(@.type=="Progressing")].reason}{"\n"}'
kubectl rollout undo deploy/api -n shop && kubectl rollout status deploy/api -n shop
kubectl patch deploy api -n shop -p '{"spec":{"progressDeadlineSeconds":600}}'
ProgressDeadlineExceeded
deployment.apps/api rolled back
deployment "api" successfully rolled out
Command questions

1) A Pod is in CrashLoopBackOff. The current container just restarted, so its logs are empty. Use one command to see the logs of the previous crash.

Reference answer
kubectl logs POD -c CONTAINER --previous

2) List the taints of all nodes (one node per line).

Reference answer
kubectl get nodes -o custom-columns=NAME:.metadata.name,TAINTS:.spec.taints
Scenario analysis questions

At 18:00 on Friday, after a release, CI reports exceeded its progress deadline, yet monitoring shows the service is healthy. A colleague on call wants to “retry the release once more.” How do you judge and handle this?

Key points of the reference answer
  • The service looks healthy because the old RS is still running (protected by maxUnavailable). The new version has not taken effect, so retrying is pointless.
  • Check the Pods of the new RS: Pending (resources or quota), ImagePullBackOff (tag), CrashLoop (configuration), 0/1 (probe). Locate the cause with #1–#9.
  • First run rollout undo to return to a consistent state; after the fix, release again. Retrospective: add automatic rollback and canary analysis to CI.

Video lessons (oEmbed verified)

▶
Setting Resource Requests and Limits in Kubernetes — Google Cloud Tech
English · covers #1, #6, #12: requests affect scheduling, limits cause OOM · duration and date not verified
▶
Kubernetes Health Checks with Readiness and Liveness Probes — Google Cloud Tech
English · covers #9: probe design
▶
Kubectl Basic Commands - Create and Debug Pod in a Minikube cluster | Kubernetes Tutorial 18 — TechWorld with Nana
English · basic troubleshooting with describe, logs and exec

No verified video specifically covering problems 1–12 was found, so below is a 3-minute storyboard script.

Shot 1 (0:00–0:40) On screen: kubectl get pods, highlighting Pending, ImagePullBackOff, CreateContainerConfigError, CrashLoopBackOff and 0/1 in turn. Narration: “First, see which lifecycle stage STATUS is stuck at.”
Shot 2 (0:40–1:20) On screen: a FailedScheduling message split into three parts (0/3, the eliminated count per plugin, preemption). Narration: “Count the eliminated nodes, and you know whether to change requests, tolerations or affinity.”
Shot 3 (1:20–2:10) On screen: logs --previous and a table of exit codes (1, 127, 137, 139). Narration: “CrashLoopBackOff is the result; the exit code is the clue. Exit code 137 tells OOM apart from probe failures.”
Shot 4 (2:10–3:00) On screen: rollout status times out → rollout undo; HPA shows unknown → add requests. Narration: “Conditions are summary signals; the cause is one layer down.”

Official documentation

or quiz score ≥ 70%

Module 2 · Part A: Networking, DNS and Traffic (problems 13–25)

08:00 – 16:00 · Service, EndpointSlice, CoreDNS, NetworkPolicy, LoadBalancer, Gateway API, source IP, MTU, conntrack
8 minkube-proxy nftables · Gateway API v1.613 problems · ★★★★★
Learning goals
  • Locate “can't connect” issues layer by layer: DNS → Service → EndpointSlice → Pod port → NetworkPolicy → node or cloud network.
  • Read status.parents[].conditions of the Gateway API (Accepted, ResolvedRefs, Programmed), and tell 404 apart from 503.
  • Understand three kinds of intermittent failures: source IP, MTU and conntrack.
Prerequisite: all modules of hour 3. Importance: ★★★★★

Type a keyword (for example endpoints, refused, NXDOMAIN, pending, 404, conntrack) to filter, then click a row to jump to its details.

#13 Service has no endpoints: curl: (7) Failed to connect … / Endpoints: <none>
Name:              api
Selector:          app=api-v2
IP:                10.96.142.17
Port:              http  80/TCP
TargetPort:        http/TCP
Endpoints:         <none>
Symptom

Accessing api.shop from inside the cluster fails or times out (kube-proxy rejects a ClusterIP with no backends directly, usually with Connection refused); Ingress or Gateway returns 503.

Root cause
  • The Service selector does not match the Pod labels (labels were changed, a Helm template renamed them, or extra labels were added).
  • All Pods are not ready (readiness fails); the EndpointSlice shows ready: false, so no traffic is sent to them.
  • The Service and the Pods are in different namespaces (the selector only matches its own namespace).
Diagnostic commands
kubectl get svc api -o jsonpath='{.spec.selector}'; echo
kubectl get pods --show-labels -l app=api
kubectl get endpointslices -l kubernetes.io/service-name=api -o wide
kubectl get endpointslices -l kubernetes.io/service-name=api -o jsonpath='{range .items[*].endpoints[*]}{.addresses[0]}{" ready="}{.conditions.ready}{"\n"}{end}'
NAME        ADDRESSTYPE   PORTS   ENDPOINTS                AGE
api-x7k2m   IPv4          9898    10.244.1.7,10.244.2.4    3d
10.244.1.7 ready=false
10.244.2.4 ready=false
Fix

Correct the selector or the Pod labels (the Deployment spec.selector is immutable and requires a rebuild). For Pods that are not ready, go to #9.

Prevention

Use recommended labels such as app.kubernetes.io/name consistently. In CI, verify that every Service matches at least one workload template.

See Hour 1: Service Basics and Hour 3: Services in Depth.

#14 Still gets connection refused with endpoints present: targetPort doesn't match the container port
$ kubectl run t --image=curlimages/curl:8.17.0 --rm -it --restart=Never -- curl -sv api.shop
* connect to 10.96.142.17 port 80 from 10.244.2.9 port 41022 failed: Connection refused
curl: (7) Failed to connect to api.shop port 80 after 3 ms: Couldn't connect to server
Symptom

The EndpointSlice has ready addresses but requests are rejected; curl to Pod IP:9898 succeeds.

Root cause
  • targetPort is set to 80 (the app actually listens on 9898), or the named port targetPort: http doesn't exist on the container or is spelled differently.
  • The app listens only on 127.0.0.1 (curl inside the container works, but the Pod IP doesn't).
  • Protocol mismatch: the Service uses TCP while the app uses UDP (or the reverse).
Diagnostic commands
kubectl get svc api -o jsonpath='{.spec.ports}' | jq
kubectl get endpointslices -l kubernetes.io/service-name=api -o jsonpath='{.items[0].ports}'
kubectl get pod POD -o jsonpath='{.spec.containers[0].ports}'
# Check the listen address inside the Pod (use a temporary debug container if ss or netstat is missing)
kubectl debug -it POD --image=nicolaka/netshoot --target=api -- ss -lntp
State   Recv-Q  Send-Q  Local Address:Port   Peer Address:Port
LISTEN  0       4096    127.0.0.1:9898        0.0.0.0:*        ← only listens on the loopback address
Fix

Set targetPort to the container port or the correct named port; make the app listen on 0.0.0.0.

Prevention

Always use named ports (targetPort: http). If the port number changes, the Service doesn't need to change.

See Hour 3: Services in Depth.

#15 DNS resolution fails: nslookup: can't resolve / NXDOMAIN / i/o timeout (CoreDNS)
;; connection timed out; no servers could be reached
** server can't find api.shop.svc.cluster.local: NXDOMAIN
dial tcp: lookup db on 10.96.0.10:53: read udp 10.244.1.7:51212->10.96.0.10:53: i/o timeout
Symptom

The app can't connect to the database, but connecting by IP works.

Root cause
  • NXDOMAIN: the name is misspelled; a short name used across namespaces only resolves within its own namespace (db needs to be db.data or the FQDN db.data.svc.cluster.local); or the Service doesn't exist.
  • timeout: CoreDNS is unhealthy or OOM, kube-dns has no endpoints, a NetworkPolicy blocks port 53 (#17), there is a network problem to CoreDNS, or the upstream DNS is unreachable.
  • A Pod with dnsPolicy: Default (inherits the node's DNS), or a hostNetwork Pod without ClusterFirstWithHostNet, can't resolve cluster names.
Diagnostic commands
kubectl -n kube-system get pods -l k8s-app=kube-dns -o wide
kubectl -n kube-system get endpointslices -l kubernetes.io/service-name=kube-dns
kubectl -n kube-system logs -l k8s-app=kube-dns --tail=30
kubectl run dnsutils --image=registry.k8s.io/e2e-test-images/agnhost:2.53 --rm -it --restart=Never -- \
  sh -c 'cat /etc/resolv.conf; nslookup api.shop.svc.cluster.local'
search shop.svc.cluster.local svc.cluster.local cluster.local
nameserver 10.96.0.10
options ndots:5
Name:      api.shop.svc.cluster.local
Address:   10.96.142.17

Use the agnhost version from registry.k8s.io, or nicolaka/netshoot.

Fix

Correct the name; restore CoreDNS (check Corefile changes with kubectl -n kube-system get cm coredns -o yaml, add resources, scale replicas); allow outbound DNS (#17).

Prevention

Run CoreDNS with ≥ 2 replicas, a PDB and anti-affinity; monitor coredns_dns_responses_total{rcode="SERVFAIL"}; for large clusters, use NodeLocal DNSCache (when AKS Standard node pools are upgraded to 1.37, LocalDNS may be enabled, #49). kube-dns is deprecated in v1.37; migrate to CoreDNS.

See Hour 3: CoreDNS and Service Discovery.

#16 External domain resolution is slow, with occasional 5-second delays: ndots:5 causes multiple queries
Symptom

P99 is high when calling external services such as api.github.com or sqlserver.database.windows.net. CoreDNS QPS far exceeds business requests, with many NXDOMAIN responses.

Root cause

A Pod's /etc/resolv.conf defaults to options ndots:5: a name with fewer than 5 dots first gets each search domain appended (shop.svc.cluster.local, svc.cluster.local, cluster.local, plus the cloud domain inherited from the node). Each is queried for A and AAAA, and only after all return NXDOMAIN is the original name queried. One resolution becomes 8–10 queries. Combined with UDP packet loss (conntrack races, #23), this leads to 5-second timeouts and retries.

Diagnostic commands
kubectl exec POD -- cat /etc/resolv.conf
# Temporarily enable CoreDNS query logging (use with caution in production): add the log plugin to the Corefile
kubectl -n kube-system edit configmap coredns
kubectl -n kube-system logs -l k8s-app=kube-dns | grep api.github.com | head
"A IN api.github.com.shop.svc.cluster.local. udp …" NXDOMAIN
"AAAA IN api.github.com.shop.svc.cluster.local. udp …" NXDOMAIN
"A IN api.github.com.svc.cluster.local. udp …" NXDOMAIN
…
"A IN api.github.com. udp …" NOERROR
Fix
spec:
  dnsConfig:
    options:
    - {name: ndots, value: "2"}  # Or use a fully qualified name ending in a dot in code: api.github.com.
    - {name: single-request-reopen}  # glibc: sends A and AAAA on different sockets, easing the conntrack race
Prevention

Deploy NodeLocal DNSCache. For high-frequency external calls, use connection pooling and DNS caching. Standardize dnsConfig in platform templates.

See Hour 3: CoreDNS and Service Discovery.

#17 After adding default-deny, all services are unreachable: NetworkPolicy forgot to allow DNS (UDP/TCP 53)
$ kubectl exec deploy/web -- wget -qO- -T 3 http://api
wget: bad address 'api'
Symptom

After default-deny egress, even allowed destinations are unreachable, because the names can't be resolved.

Root cause

Once a NetworkPolicy selects a Pod for Egress, any outbound traffic not explicitly allowed is denied, including port 53 to the CoreDNS in kube-system. DNS uses UDP by default and falls back to TCP when responses are truncated beyond 512 bytes, so both must be allowed.

Diagnostic commands
kubectl get networkpolicy -n shop
kubectl describe networkpolicy -n shop
kubectl exec deploy/web -n shop -- nslookup api.shop.svc.cluster.local 10.96.0.10
Fix
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: {name: allow-dns, namespace: shop}
spec:
  podSelector: {}
  policyTypes: [Egress]
  egress:
  - to:
    - namespaceSelector: {matchLabels: {kubernetes.io/metadata.name: kube-system}}
      podSelector: {matchLabels: {k8s-app: kube-dns}}
    ports:
    - {protocol: UDP, port: 53}
    - {protocol: TCP, port: 53}
Prevention

The platform should apply both default-deny and allow-dns to every namespace. When using NodeLocal DNSCache, also allow the node-local address (such as 169.254.20.10).

See Hour 3: NetworkPolicy.

#18 LoadBalancer Service stays at EXTERNAL-IP <pending>
NAME      TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE
web-lb    LoadBalancer   10.96.33.120   <pending>     80:31442/TCP   12m

Events:
  Warning  SyncLoadBalancerFailed  service-controller  Error syncing load balancer: failed to ensure load balancer: …
Symptom

No external IP is assigned.

Root cause
  • No cloud controller: kind and kubeadm bare-metal clusters have no LoadBalancer implementation by default, so the IP stays pending forever with no events. You need cloud-provider-kind (lab) or MetalLB.
  • AKS: the cluster identity lacks Network Contributor on the node resource group or VNet subnet; the static public IP's resource group or SKU is wrong (Standard LB requires a Standard IP); public IP quota is insufficient; or the subnet in the internal LB annotation doesn't exist.
  • EKS: the AWS Load Balancer Controller is not installed or lacks IAM permissions; subnets lack discovery tags (kubernetes.io/role/elb / kubernetes.io/role/internal-elb); or the controller named by loadBalancerClass doesn't exist.
Diagnostic commands
kubectl describe svc web-lb | sed -n '/Events/,$p'
kubectl get svc web-lb -o jsonpath='{.spec.loadBalancerClass}{" "}{.metadata.annotations}'
# AKS:
az aks show -g rg-k8s-lab -n aks-lab --query identity
# EKS:
kubectl -n kube-system logs deploy/aws-load-balancer-controller --tail=50
Fix

kind: run cloud-provider-kind (hour 3). AKS: grant the cluster identity network roles and correct the annotations. EKS: install the LBC and tag the subnets.

Prevention

Use a single Gateway entry point instead of “one LoadBalancer per service” (this saves cost and IPs). Write LB-related IAM and RBAC into IaC.

See Hour 3: LoadBalancer and External Traffic, Hour 6: Managed Cluster Comparison, AKS course and Hour 7: AWS Load Balancer Controller.

#19 Gateway API returns 404: HTTPRoute is not attached to the Gateway (Accepted=False · NotAllowedByListeners / NoMatchingListenerHostname)
status:
  parents:
  - parentRef: {name: shop-gw, namespace: infra}
    conditions:
    - type: Accepted
      status: "False"
      reason: NotAllowedByListeners
      message: No listeners included by this parent ref allowed this attachment.
Symptom

Accessing http://shop.example.com/ returns 404 (the gateway data plane, such as Envoy, returns it directly without reaching the backend).

Root cause
  • The Gateway is in infra, and the listener's allowedRoutes.namespaces.from defaults to Same, so the HTTPRoute in shop can't attach.
  • The HTTPRoute hostnames don't intersect the listener hostname (NoMatchingListenerHostname).
  • The parentRefs name, namespace or sectionName is wrong; the path rule doesn't cover the request (PathPrefix vs Exact).
Diagnostic commands
kubectl get gateway -A
kubectl get httproute -n shop
kubectl get httproute web -n shop -o jsonpath='{range .status.parents[*].conditions[*]}{.type}={.status} {.reason}{"\n"}{end}'
kubectl get gateway shop-gw -n infra -o jsonpath='{.spec.listeners}' | jq '.[]|{name,hostname,allowedRoutes}'
Fix
listeners:
- name: http
  protocol: HTTP
  port: 80
  hostname: "*.example.com"
  allowedRoutes:
    namespaces:
      from: Selector
      selector: {matchLabels: {gateway-access: "true"}}  # Then add this label to the shop namespace
Prevention

The platform team owns the Gateway, and the app teams own the HTTPRoutes. In CI, check the Route's Accepted and ResolvedRefs conditions, not just whether apply succeeded.

See Hour 3: Gateway API v1.6.

#20 Gateway / Ingress returns 503: no healthy upstream · ResolvedRefs=False · RefNotPermitted / BackendNotFound
$ curl -i http://shop.example.com/api
HTTP/1.1 503 Service Unavailable
no healthy upstream

status.parents[0].conditions:
- type: ResolvedRefs
  status: "False"
  reason: RefNotPermitted
  message: Failed to process route rule 0 backendRef 0: backendRef api/shop not accessible to a HTTPRoute in namespace "web" (missing a ReferenceGrant?).

The message varies by implementation (Envoy Gateway, Istio, Cilium, etc.); the reason is defined by the Gateway API specification.

Symptom

The route is accepted (not 404), but it returns 503 or intermittent 503.

Root cause
  • Cross-namespace backend reference without a ReferenceGrant in the target namespace → RefNotPermitted.
  • Wrong Service name or port in backendRef → BackendNotFound. The port must be the Service's port, not its targetPort.
  • No ready endpoints in the backend (#13). Protocol mismatch (the app requires HTTPS / HTTP2).
  • The retired ingress-nginx (archived in 2026-03, no security patches) also shows default backend - 404 / 503. Migrate to the Gateway API (ingress2gateway).
Diagnostic commands
kubectl get httproute web -n web -o yaml | grep -A6 -E 'ResolvedRefs|Programmed'
kubectl get referencegrant -n shop
kubectl get endpointslices -n shop -l kubernetes.io/service-name=api
Fix
apiVersion: gateway.networking.k8s.io/v1beta1
kind: ReferenceGrant
metadata: {name: allow-web-routes, namespace: shop}
spec:
  from: [{group: gateway.networking.k8s.io, kind: HTTPRoute, namespace: web}]
  to:   [{group: "", kind: Service, name: api}]

The ReferenceGrant API version depends on the Gateway API CRDs you installed (kubectl api-resources | grep -i referencegrant).

Prevention

A Route and its Service in the same namespace do not need a ReferenceGrant. Configure readiness probes and a PDB on the backend so that no rolling update leaves it with zero available endpoints.

See Hour 3: Gateway API and Ingress.

#21 The app sees only node IPs / 10.244.x.x as client IPs: the source IP is lost (externalTrafficPolicy)
Symptom

Access logs, rate limits, and IP allow lists stop working, because every request appears to come from a few internal IPs.

Root cause

NodePort and LoadBalancer Services default to externalTrafficPolicy: Cluster. Traffic can be sent to Pods on other nodes, and kube-proxy applies SNAT so replies return the same way. The source IP becomes the node IP. Behind an L7 proxy (Gateway/Ingress, Application Gateway, ALB), the real client IP appears only in X-Forwarded-For.

Diagnostic commands
kubectl get svc web-lb -o jsonpath='{.spec.externalTrafficPolicy}{" "}{.spec.healthCheckNodePort}{"\n"}'
kubectl logs deploy/web --tail=5  # check remote_addr
Fix
kubectl patch svc web-lb -p '{"spec":{"externalTrafficPolicy":"Local"}}'

Local sends traffic only to Pods on the same node and skips SNAT. The cloud LB uses healthCheckNodePort to exclude nodes with no Pods. The trade-off: load can be uneven across nodes, and rolling updates need a preStop wait. In L7 setups, configure the proxy to trust the upstream and pass through X-Forwarded-For / PROXY protocol.

Prevention

For entry points that need the source IP, use Local with topology spread so every node has a replica. Put security controls in the WAF or gateway layer where possible.

See Hour 3: LoadBalancer and External Traffic.

#22 Small requests work, but large responses hang or TLS handshakes stall: MTU / fragmentation problem
Symptom

curl health checks pass, but large files, large JSON responses, image pulls, and TLS handshakes (with large certificate chains) time out. This is common across VPN, ExpressRoute, or Direct Connect links, or with a self-managed overlay (VXLAN, IPIP, WireGuard).

Root cause

Overlay encapsulation adds headers (about 50 bytes for VXLAN). When the Pod MTU is equal to or higher than the underlay MTU, large packets must be fragmented. If fragmentation is forbidden and the ICMP "Fragmentation Needed" messages are dropped by a security group or firewall, you get a PMTU black hole: small packets pass, large packets are dropped.

Diagnostic commands
kubectl debug node/lab-worker -it --image=nicolaka/netshoot -- ip link  # check the MTU of the node and of cni/veth
kubectl exec POD -- cat /sys/class/net/eth0/mtu
# Increase the ping size step by step with the DF bit set, to find the largest size that passes (1472 + 28 = 1500)
kubectl exec POD -- ping -M do -s 1472 -c 2 10.244.2.4
kubectl exec POD -- ping -M do -s 1400 -c 2 10.244.2.4
ping: local error: message too long, mtu=1450
Fix

CNI MTU = underlay MTU − encapsulation overhead (Calico veth_mtu, Cilium MTU, and so on; follow each CNI's docs). Allow ICMP type 3 code 4. Enable TCP MSS clamping on VPN links.

Prevention

Managed cloud CNIs (Azure CNI, AWS VPC CNI) usually route natively without encapsulation. For hybrid cloud links, confirm the MTU when you design the link.

See Hour 3: CNI and Network Troubleshooting.

#23 nf_conntrack: table full, dropping packet / occasional timeouts under high concurrency
nf_conntrack: nf_conntrack: table full, dropping packet
Symptom

Random timeouts and 5-second DNS delays at peak times. Node CPU is not high, and restarting Pods does not help.

Root cause
  • kube-proxy (iptables / nftables) relies on the kernel conntrack table for Service DNAT. A storm of short-lived connections (no connection pooling, many DNS UDP queries) fills the table to nf_conntrack_max, and new connections are dropped.
  • Concurrent A/AAAA DNS queries over UDP with the same 5-tuple race on conntrack insertion and drop packets (the classic "5-second DNS delay").
Diagnostic commands
kubectl debug node/lab-worker -it --image=nicolaka/netshoot -- sh -c \
  'cat /proc/sys/net/netfilter/nf_conntrack_count /proc/sys/net/netfilter/nf_conntrack_max; conntrack -S | head'
kubectl -n kube-system get cm kube-proxy -o yaml | grep -A6 conntrack
262139
262144
cpu=0 found=0 invalid=1532 insert=0 insert_failed=4821 drop=4821 …
Fix
  • Tune conntrack.maxPerCore / min in the kube-proxy configuration (KubeProxyConfiguration), or the node sysctls. On managed clusters, make changes the way the platform supports.
  • Enable keep-alive and connection pooling in the app. Deploy NodeLocal DNSCache, which uses TCP to the upstream and creates fewer conntrack entries.
Prevention

Monitor node_nf_conntrack_entries / node_nf_conntrack_entries_limit. On new clusters, prefer nftables (GA in v1.33; v1.37 switches to netlink for better performance). ipvs was deprecated in v1.37, so do not use it as a performance fix anymore.

See Hour 3: Services in Depth and Network Troubleshooting.

#24 A few 502s / connection resets during rolling updates: a race between termination and endpoint removal
upstream connect error or disconnect/reset before headers. reset reason: connection termination
HTTP/1.1 502 Bad Gateway
Symptom

Every release or drain causes a few seconds of 502/503 errors.

Root cause

When a Pod is deleted, "kubelet sends SIGTERM" and "EndpointSlice removes the address → kube-proxy or the gateway updates its rules" happen in parallel. If the app exits immediately, the LB or gateway still sends new requests, and keep-alive connections are reset.

Diagnostic commands
kubectl get deploy api -o jsonpath='{.spec.template.spec.terminationGracePeriodSeconds}{" "}{.spec.template.spec.containers[0].lifecycle}{"\n"}'
kubectl get deploy api -o jsonpath='{.spec.strategy}'
# Run a load test during the release and watch for errors
kubectl run load --image=curlimages/curl:8.17.0 --rm -it --restart=Never -- sh -c 'while true; do curl -s -o /dev/null -w "%{http_code}\n" api.shop; done' | sort | uniq -c
Fix
spec:
  terminationGracePeriodSeconds: 45
  containers:
  - name: api
    lifecycle:
      preStop:
        sleep: {seconds: 10}  # native sleep action; older versions use exec: ["sleep","10"] (the image must include sleep)
strategy:
  rollingUpdate: {maxUnavailable: 0, maxSurge: 25%}

The native preStop sleep is available by default in newer versions. For GA versions, follow the official "Container Lifecycle Hooks" docs.

Prevention

Shut the app down gracefully: after SIGTERM, stop accepting new connections and finish in-flight requests before exiting. Make readiness fail as soon as shutdown starts. Use it together with a PDB.

See Hour 2: Probes, Graceful Termination and Rollout Strategy.

#25 Cross-namespace access denied: AND / OR logic between namespaceSelector and podSelector is wrong in the NetworkPolicy
Symptom

Gateway namespace infra times out when it calls shop/api. Or the reverse: you meant to allow only the gateway, but the policy allows too much.

Root cause

Putting both namespaceSelector and podSelector in the same from list item is an AND (only those Pods in that namespace). Two list items (each with its own -) is an OR (all Pods in that namespace, or those Pods in the policy's own namespace). Another common mistake is using a custom label that does not exist on the namespace. Use the automatic label kubernetes.io/metadata.name instead.

# AND: only allow envoy Pods in the infra namespace
ingress:
- from:
  - namespaceSelector: {matchLabels: {kubernetes.io/metadata.name: infra}}
    podSelector: {matchLabels: {app.kubernetes.io/name: envoy}}
# OR (one extra "-"): all Pods in infra, or Pods with app=envoy in shop
ingress:
- from:
  - namespaceSelector: {matchLabels: {kubernetes.io/metadata.name: infra}}
  - podSelector: {matchLabels: {app.kubernetes.io/name: envoy}}
Diagnostic commands
kubectl get ns --show-labels | grep -E 'infra|shop'
kubectl get networkpolicy -n shop -o yaml | grep -B2 -A8 'from:'
kubectl get pods -n infra --show-labels | head
Fix

Rewrite the policy with AND logic if that is what you intended. The ports must match too. They are the container ports of the target Pod, not the Service port.

Prevention

Use policy visualization or CNI audit tools (Cilium Hubble, Calico policy preview). Write a connectivity test for every policy: traffic that should pass must pass, and traffic that should be blocked must be blocked.

See Hour 3: NetworkPolicy.

Each layer a "web → api.shop" request passes through, and the typical problems at that layer ① DNSCoreDNS 10.96.0.10 ② NetworkPolicyegress (source Pod) ③ ClusterIP DNATkube-proxy + conntrack ④ EndpointSliceReady Pod IP ⑤ Node-to-node routingCNI · MTU ⑥ Target Podingress policy · port #15 NXDOMAIN / timeout#16 Slow lookups (ndots) #17 DNS left out of allow rules#25 AND/OR #23 conntrack table full#21 SNAT source IP #13 No endpoints#24 Removal race #22 MTU black hole#48 EKS IP exhaustion #14 targetPortListening on 127.0.0.1 Bisect: if curl Pod IP:container port works, the problem is in ①–④. If it fails, the problem is in ⑤–⑥.nslookup of the FQDN succeeds → rule out ①. Pods on the same node can talk, but cross-node traffic fails → ⑤ (CNI / MTU / security group).External entry points add three more layers: cloud LB (#18) → Gateway/Route (#19/#20) → Service.
Figure 2-1: The six-layer model for in-cluster requests and where problems 13–25 fit
Gateway API status conditions: 404 or 503? GatewayClassAccepted GatewayAccepted · Programmed HTTPRoute attachmentAccepted=False → 404 (#19) Backend resolutionResolvedRefs=False → 503 (#20) Accepted=True and ResolvedRefs=True but still 503 → the backend Service has no ready endpoints (#13), or the protocol does not matchkubectl get httproute NAME -o jsonpath='{range .status.parents[*].conditions[*]}{.type}={.status} {.reason}{"\n"}{end}'
Figure 2-2: Check the Route conditions first, then the backend

Network troubleshooting decision tree

Start from the observed failure and narrow it down layer by layer using the six-layer model. The log area shows the command for each step.

Environment: kind cluster lab, namespace shop, and the api from Module 0. kindnet has supported NetworkPolicy since kind v0.24.0.

Lab 2-A: Wrong selector leaves no endpoints (#13)

Create a Service with a wrong selector:
kubectl create service clusterip api-bad -n shop --tcp=80:9898
kubectl get endpointslices -n shop -l kubernetes.io/service-name=api-bad
NAME            ADDRESSTYPE   PORTS     ENDPOINTS   AGE
api-bad-8f2kd   IPv4          <unset>   <unset>     4s

kubectl create service generates the selector app=api-bad, which does not match the Pod label app=api.

Fix the selector and verify:
kubectl patch svc api-bad -n shop -p '{"spec":{"selector":{"app":"api"}}}'
kubectl get endpointslices -n shop -l kubernetes.io/service-name=api-bad
kubectl run t -n shop --image=curlimages/curl:8.17.0 --rm -it --restart=Never -- curl -s api-bad/version
Clean up: kubectl delete svc api-bad -n shop

Lab 2-B: Wrong targetPort (#14)

kubectl patch svc api -n shop --type=json -p='[{"op":"replace","path":"/spec/ports/0/targetPort","value":8080}]'
kubectl run t -n shop --image=curlimages/curl:8.17.0 --rm -it --restart=Never -- curl -sS -m 3 api/version
curl: (7) Failed to connect to api port 80 after 2 ms: Couldn't connect to server
Restore the named port:
kubectl patch svc api -n shop --type=json -p='[{"op":"replace","path":"/spec/ports/0/targetPort","value":"http"}]'

Lab 2-C: default-deny leaves out DNS (#17)

Allow only egress to api, and leave out DNS:
cat <<'EOF' | kubectl apply -f -
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: {name: client-egress, namespace: shop}
spec:
  podSelector: {matchLabels: {role: client}}
  policyTypes: [Egress]
  egress:
  - to: [{podSelector: {matchLabels: {app: api}}}]
    ports: [{protocol: TCP, port: 9898}]
EOF
kubectl run c -n shop -l role=client --image=curlimages/curl:8.17.0 --rm -it --restart=Never -- curl -sS -m 5 api/version
curl: (6) Could not resolve host: api
Add allow-dns (the YAML from #17) and try again. It should return the version JSON.
Clean up: kubectl delete networkpolicy client-egress allow-dns -n shop --ignore-not-found

Lab 2-D: Observe ndots amplification (#16)

Compare the number of queries:
kubectl -n kube-system get cm coredns -o yaml > /tmp/coredns.bak.yaml
kubectl -n kube-system get cm coredns -o jsonpath='{.data.Corefile}' | sed 's/^\(\s*\)errors/\1errors\n\1log/' > /tmp/Corefile
kubectl -n kube-system create cm coredns --from-file=Corefile=/tmp/Corefile --dry-run=client -o yaml | kubectl apply -f -
sleep 30  # wait for the reload plugin to take effect
kubectl run d -n shop --image=registry.k8s.io/e2e-test-images/agnhost:2.53 --rm -it --restart=Never -- nslookup example.com
kubectl -n kube-system logs -l k8s-app=kube-dns --since=1m | grep -c example.com

Repeat with example.com. (with a trailing dot). The count drops noticeably.

Restore: kubectl apply -f /tmp/coredns.bak.yaml
Command question

1) List the IP and ready status of each endpoint behind the Service api.

Reference answer
kubectl get endpointslices -l kubernetes.io/service-name=api -o jsonpath='{range .items[*].endpoints[*]}{.addresses[0]}{" ready="}{.conditions.ready}{"\n"}{end}'

2) Without going into a Pod, determine whether the Gateway accepts the HTTPRoute web.

Reference answer
kubectl get httproute web -o jsonpath='{range .status.parents[*].conditions[*]}{.type}={.status} {.reason}{"\n"}{end}'
Scenario analysis question

After the security team applies default-deny (Ingress + Egress) in all namespaces, the frontend returns 502, the backend logs "cannot connect to database: lookup db: i/o timeout", and Prometheus cannot scrape metrics. Give the minimum set of policies you need to add.

Key points of the reference answer
  • Each namespace: allow-dns (UDP/TCP 53 to kube-system/kube-dns).
  • shop: allow ingress from the infra gateway Pods to web/api (AND form, using container ports). Allow egress from api to data/db, and ingress on db (allow both directions).
  • Allow Prometheus in the monitoring namespace to reach the metrics port on each Pod.
  • Verify: write a connectivity test for every "should pass / should be blocked" case.

Teaching videos (verified with oEmbed)

▶
How Kubernetes Services Really Work - iptables, kube-proxy, and Packet Flow Explained — MattOps | DevOps & SRE
English · covers #13, #14, #21, #23 · duration/date not verified
▶
Life of a Packet [I] - Michael Rubin, Google — CNCF [Cloud Native Computing Foundation]
English · Pod networking and cross-node routing (#22)
▶
Scale the Internet with DNS: A CoreDNS Deep Dive - Yong Tang, Ivanti — CNCF [Cloud Native Computing Foundation]
English · CoreDNS (#15, #16)
▶
Kubernetes Network Policy Deep Dive — Kubesimplify
English · NetworkPolicy (#17, #25)
▶
The Kubernetes Gateway API: Concepts — Google Open Source
English · Gateway / Route role model (#19, #20)

3-minute storyboard:

Shot 1 (0:00–0:45) Visual: the six-layer model lights up layer by layer. Narration: "Bisect with a direct Pod IP. If it works, check DNS, policy, Service, and endpoints. If it fails, check routing or the target Pod."
Shot 2 (0:45–1:30) Visual: Endpoints: <none> in describe svc, comparing the selector with the labels. Narration: "No endpoints? Nine times in ten, the labels don't match. The other time, nothing is ready."
Shot 3 (1:30–2:15) Visual: after default-deny, Could not resolve host. Adding allow-dns fixes it. Narration: "The first exception to default-deny is always DNS on port fifty-three, over UDP and TCP."
Shot 4 (2:15–3:00) Visual: HTTPRoute conditions: Accepted=False maps to 404, and ResolvedRefs=False maps to 503. Narration: "The Gateway status fields give you the answer directly."

Official docs

or quiz score ≥ 70%

Module 3 · Part A: Storage, Configuration, and Security (problems 26–38)

16:00 – 24:00 · PVCs, CSI mounts, permissions, hot config updates, Secrets, RBAC, PSA, admission webhooks, ServiceAccounts, quotas, namespace termination
8 minCSI · RBAC · PSA · VAP13 problems · ★★★★☆
Learning goals
  • Identify which stage a storage problem is stuck in: provision → bind → attach → mount.
  • Read the five parts of an RBAC Forbidden message (subject, verb, resource, API group, namespace), and reproduce it with kubectl auth can-i --as.
  • Know which controls can stop a Pod from being created at all (PSA, ValidatingAdmissionPolicy, webhooks, ResourceQuota), and where to find the rejection message.
Prerequisites: Hour 2 ConfigMap/Secret, Hour 4 storage, Hour 5 security. Importance: ★★★★☆

Type a keyword (such as Multi-Attach, permission denied, forbidden, PodSecurity, webhook, or quota) to filter. Click a row to jump to its details.

#26 PVC stuck in Pending: no persistent volumes available for this claim and no storage class is set / waiting for first consumer
Status:        Pending
StorageClass:
Events:
  Normal   FailedBinding  persistentvolume-controller  no persistent volumes available for this claim and no storage class is set
# or (this is normal)
  Normal   WaitForFirstConsumer  persistentvolume-controller  waiting for first consumer to be created before binding
# or (provisioning failed)
  Warning  ProvisioningFailed  disk.csi.azure.com_…  failed to provision volume with StorageClass "managed-premium": rpc error: …
Symptom

The PVC is Pending, and the Pods that use it are also Pending (#4).

Root cause
  • There is no default SC, and storageClassName is not set (or the class does not exist).
  • WaitForFirstConsumer: Pending with no consumer is expected behavior.
  • CSI provisioning fails: the driver is unhealthy, cloud quota or permissions are insufficient, or the SKU or size is not available in the region. For a static PV, the capacity, access mode, or class name does not match.
Diagnostic commands
kubectl get sc  # the default class is marked (default)
kubectl describe pvc data-db-0 | sed -n '/Events/,$p'
kubectl get csidrivers
kubectl -n kube-system get pods | grep -i csi
NAME                 PROVISIONER             RECLAIMPOLICY   VOLUMEBINDINGMODE      ALLOWVOLUMEEXPANSION   AGE
standard (default)   rancher.io/local-path   Delete          WaitForFirstConsumer   false                  3d
Fix

Set the correct SC, or set a default class (storageclass.kubernetes.io/is-default-class: "true", and only one). Fix the CSI driver and the cloud permissions or quota.

Prevention

Provide SCs with clear names (such as premium-zrs and standard-lrs), and have the chart expose storageClassName.

See Hour 4: PV · PVC · StorageClass.

#27 Multi-Attach error for volume "pvc-…" Volume is already used by pod(s) …
Warning  FailedAttachVolume  attachdetach-controller  Multi-Attach error for volume "pvc-3f2a…" Volume is already used by pod(s) db-0
Symptom

After a node failure or drain, new Pods stay stuck in ContainerCreating for several minutes.

Root cause

ReadWriteOnce block storage (Azure Disk, EBS) can attach to only one node. If the old node has not detached the volume (it is down, or kubelet lost contact), the VolumeAttachment still points to it. The AD controller forces detach only after about 6 minutes (this varies by version). Another cause: a Deployment that uses an RWO volume with RollingUpdate puts the old and new Pods on two different nodes.

Diagnostic commands
kubectl get volumeattachment | grep pvc-3f2a
kubectl get pod -o wide -l app=db
kubectl get node OLD_NODE -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}'
Fix
  • After you confirm the old node is powered off, add the node.kubernetes.io/out-of-service=nodeshutdown:NoExecute taint (GA in v1.28) to force detach immediately.
  • For a Deployment with an RWO volume, use strategy: Recreate or switch to a StatefulSet.
Prevention

For read-write across multiple nodes, use RWX (Azure Files, EFS). Databases should get high availability from their own replication, not from volumes moving between nodes.

See Hour 4: CSI Architecture and Access Modes.

#28 FailedMount / permission denied: initdb: could not change permissions of directory
Warning  FailedMount  kubelet  MountVolume.SetUp failed for volume "pvc-…" : rpc error: code = Internal desc = …
Warning  FailedMount  kubelet  Unable to attach or mount volumes: unmounted volumes=[data], …: timed out waiting for the condition
# container logs
initdb: error: could not change permissions of directory "/var/lib/postgresql/data": Operation not permitted
mkdir: cannot create directory '/data/cache': Permission denied
Symptom

The mount fails and the Pod stays in ContainerCreating, or the volume mounts but the container goes into CrashLoop because of permissions.

Root cause
  • The Pod runs as non-root (runAsUser: 999), but the volume root is owned by root. Either fsGroup is not set, or the storage does not support changing ownership (Azure Files SMB/NFS needs the uid/gid mount options).
  • Postgres requires 0700 and a directory that is not the volume root (the volume root contains lost+found). Use a PGDATA subdirectory.
  • A recursive chown on a large volume makes the mount time out. Use fsGroupChangePolicy: OnRootMismatch.
  • SELinux: in v1.37, SELinuxMount is GA and on by default. It sets the context at mount time, so Pods with different labels that share a volume will conflict.
Diagnostic commands
kubectl describe pod db-0 | grep -A3 FailedMount
kubectl get pod db-0 -o jsonpath='{.spec.securityContext}' | jq
kubectl debug -it db-0 --image=busybox:1.37 --target=db -- ls -ln /var/lib/postgresql/data
Fix
spec:
  securityContext:
    runAsUser: 999
    fsGroup: 999
    fsGroupChangePolicy: OnRootMismatch
  containers:
  - name: db
    env: [{name: PGDATA, value: /var/lib/postgresql/data/pgdata}]
Prevention

Pin a non-root UID in the image and document it. For databases, prefer an Operator (such as CloudNativePG).

See Hour 4: StatefulSet + PostgreSQL and Storage Troubleshooting, Hour 5: securityContext.

#29 PVC resize fails: only dynamically provisioned pvc can be resized and the storageclass that provisions the pvc must support resize
Error from server (Forbidden): persistentvolumeclaims "data-db-0" is forbidden: only dynamically provisioned pvc can be resized and the storageclass that provisions the pvc must support resize
Symptom

kubectl patch pvc resize is rejected. Or the PVC shows the new capacity, but the filesystem has not changed (FileSystemResizePending).

Root cause

The SC does not set allowVolumeExpansion: true. Or the driver does not support online expansion, so the Pod must restart to grow the filesystem. The volumeClaimTemplates of a StatefulSet cannot be changed, so you must edit each PVC one by one.

Diagnostic commands
kubectl get sc STORAGECLASS -o jsonpath='{.allowVolumeExpansion}'
kubectl get pvc data-db-0 -o jsonpath='{.status.conditions}' | jq
kubectl exec db-0 -- df -h /var/lib/postgresql/data
Fix
kubectl patch sc managed-csi-premium -p '{"allowVolumeExpansion":true}'  # cloud disk drivers usually support this
kubectl patch pvc data-db-0 -p '{"spec":{"resources":{"requests":{"storage":"64Gi"}}}}'
kubectl get pvc data-db-0 -w
Prevention

Enable expansion when you create the SC. Monitor kubelet_volume_stats_available_bytes and alert at 80%. Volumes can only grow, not shrink.

See Hour 4: Expansion · Snapshots · Cloning.

#30 ConfigMap changed, but the app config did not change
Symptom

After you apply the new ConfigMap, kubectl get cm shows the new value, but the app has not changed.

Root cause
  • Environment variables (env/envFrom) are injected only at startup.
  • Volume mounts are updated, but with a delay (the sync period plus the cache TTL, which can exceed one minute). The app must reread the file itself.
  • A single file mounted with subPath does not update.
  • With immutable: true, you can only create a new ConfigMap.
Diagnostic commands
kubectl get pod POD -o yaml | grep -B2 -A6 -E 'configMap|subPath|envFrom'
kubectl exec POD -- cat /etc/app/config.yaml
kubectl exec POD -- env | grep APP_
Fix

kubectl rollout restart deploy/api. Long term: write a config hash into a Pod template annotation (Helm checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}; or Kustomize configMapGenerator, which generates a hash suffix in the name). Then every config change triggers an automatic rollout.

Prevention

Treat every config change as a rollout that can be rolled back. Apps that need hot reload should watch the file, and you should avoid subPath.

See Hour 2: ConfigMap and Secret, Hour 6: Delivery Toolchain Overview, and the Helm course.

#31 Secret leak: base64 is not encryption · a Secret committed to Git · passwords appearing in logs
$ kubectl get secret db-cred -o jsonpath='{.data.password}' | base64 -d
S3cr3t!                       ← anyone with get secrets permission can see this
Symptom

gitleaks or GitHub secret scanning finds a Secret manifest in the repository. Or an audit finds that a ServiceAccount can list every Secret in the cluster.

Root cause
  • data is only base64. Without encryption at rest, it is also plaintext in etcd.
  • RBAC is too broad: list/watch secrets is enough to read them all. Anyone who can create a Pod can also mount and read any Secret in that namespace.
  • Environment variables get written to logs. describe does not show values, but -o yaml does.
Diagnostic commands
kubectl auth can-i list secrets --as=system:serviceaccount:shop:api -A
kubectl get clusterrolebinding -o json | jq -r '.items[]|select(.roleRef.name=="cluster-admin")|.metadata.name+" -> "+([.subjects[]?.name]|join(","))'
git log -p --all -S 'kind: Secret' | head
Fix
  1. Rotate the credentials first. Deleting Git history does not make a leaked password invalid.
  2. Tighten RBAC. Enable etcd encryption at rest (AKS: KMS + Key Vault; EKS encrypts Secrets with envelope encryption by default).
  3. Store only ciphertext in Git (SOPS, Sealed Secrets), or store references (External Secrets Operator, Secrets Store CSI Driver + Key Vault / Secrets Manager).
Prevention

Run secret scanning in pre-commit and CI. Use Workload Identity or Pod Identity to access cloud keys, and avoid long-lived static credentials.

See Hour 5: Secret Security and External Secrets.

#32 Error from server (Forbidden): pods is forbidden: User "system:serviceaccount:shop:api" cannot list resource "pods" in API group "" in the namespace "shop"
Error from server (Forbidden): pods is forbidden: User "system:serviceaccount:shop:api" cannot list resource "pods" in API group "" in the namespace "shop"
Error from server (Forbidden): deployments.apps "api" is forbidden: User "alice@contoso.com" cannot patch resource "deployments" in API group "apps" in the namespace "shop"
Symptom

Operators, CI bots, or services that call the API get 403 errors. People get Forbidden errors from kubectl.

Root cause

RBAC denies by default. The message has five parts: subject, verb, resource, API group ("" is the core group; Deployments are in apps), and namespace. Common mistakes: using apiGroups: [""] to grant access to deployments; creating the RoleBinding in the wrong namespace; a RoleBinding that references a ClusterRole only applies in its own namespace; subresources (pods/log, pods/exec, deployments/scale) must be granted separately. 401 is an authentication failure (#35/#45). 403 means the caller is authenticated but not authorized.

Diagnostic commands
kubectl auth can-i list pods -n shop --as=system:serviceaccount:shop:api
kubectl auth can-i --list -n shop --as=system:serviceaccount:shop:api
kubectl get rolebinding,clusterrolebinding -A -o wide | grep -w api
kubectl api-resources | grep -w deployments  # check the API group
no
Fix
kubectl create role pod-reader -n shop --verb=get,list,watch --resource=pods
kubectl create rolebinding api-pod-reader -n shop --role=pod-reader --serviceaccount=shop:api
kubectl auth can-i list pods -n shop --as=system:serviceaccount:shop:api  # yes
Prevention

Use least privilege, and prefer namespace-scoped Roles. Version RBAC manifests with the app. Audit regularly with kubectl auth can-i --list or rbac-tool.

See Hour 5: Authorization with RBAC.

#33 Error creating: pods "api-…" is forbidden: violates PodSecurity "restricted:latest"
Warning  FailedCreate  replicaset-controller  Error creating: pods "api-6c9f7d5b8-" is forbidden: violates PodSecurity "restricted:latest": allowPrivilegeEscalation != false (…), unrestricted capabilities (…), runAsNonRoot != true (…), seccompProfile (…)
Symptom

The apply succeeds, the Deployment shows 0/2, and there are no Pods at all. The error does not show up in kubectl get pods. It appears in the ReplicaSet events.

Root cause

The namespace sets pod-security.kubernetes.io/enforce=restricted (PSA, GA in v1.25), and the Pod template does not comply. When you create a Pod directly, kubectl reports the error right away. When a controller creates it, the error appears only in the controller's events (a Deployment only shows a warning).

Diagnostic commands
kubectl get ns shop --show-labels
kubectl describe rs -l app=api | grep -A2 FailedCreate
# Dry run: which existing workloads would violate the enforce label once it is added
kubectl label --dry-run=server --overwrite ns shop pod-security.kubernetes.io/enforce=restricted
Fix
spec:
  securityContext:
    runAsNonRoot: true
    seccompProfile: {type: RuntimeDefault}
  containers:
  - name: api
    securityContext:
      allowPrivilegeEscalation: false
      capabilities: {drop: ["ALL"]}
      readOnlyRootFilesystem: true
Prevention

Start with warn / audit, then move to enforce. Pin enforce-version=v1.37 so the standard does not change after an upgrade. Use the same standard in CI static checks.

See Hour 5: PSS, securityContext, and Container Hardening.

#34 Internal error occurred: failed calling webhook "…": failed to call webhook: Post "https://…": context deadline exceeded
Error from server (InternalError): error when creating "api.yaml": Internal error occurred: failed calling webhook "validate.kyverno.svc-fail": failed to call webhook: Post "https://kyverno-svc.kyverno.svc:443/validate/fail?timeout=10s": context deadline exceeded
Error from server (InternalError): … failed calling webhook "…": failed to call webhook: Post "https://…": no endpoints available for service "…"
… x509: certificate signed by unknown authority
Symptom

Every deployment fails to apply, including system components. After a node upgrade, Pods cannot be recreated, and the cluster "freezes."

Root cause

failurePolicy: Fail while the backend is unavailable (all Pods are down or scaled to 0, a NetworkPolicy blocks it, the certificate has expired, or caBundle does not match). If the rules match the webhook's own namespace or kube-system, you get a deadlock: the webhook is down, so its own Pods cannot be created. On a private cluster, if the control plane cannot reach the webhook port (EKS security groups, AKS firewall), requests also time out.

Diagnostic commands
kubectl get validatingwebhookconfigurations,mutatingwebhookconfigurations
kubectl get validatingwebhookconfiguration NAME -o jsonpath='{range .webhooks[*]}{.name}{" "}{.failurePolicy}{" "}{.timeoutSeconds}{" "}{.clientConfig.service.namespace}/{.clientConfig.service.name}{"\n"}{end}'
kubectl get endpointslices -n kyverno
Fix
  • Emergency: restore the backend. If that is not possible, temporarily change failurePolicy to Ignore or delete the configuration. Record the change and restore it afterward.
  • Use a namespaceSelector to exclude kube-system and the webhook's own namespace.
Prevention
  • Run multiple replicas with a PDB and anti-affinity, and set a short timeoutSeconds (for example, 5 seconds).
  • For simple validation, use an in-process ValidatingAdmissionPolicy (CEL, GA in v1.30) or MutatingAdmissionPolicy. In v1.37, manifest-based admission control is Beta, and it loads policies from files at startup.

See Hour 5: Admission Control: VAP · MAP · Webhook.

#35 ServiceAccount token problems: 401 Unauthorized · token Secret not found · AADSTS70021 / cannot get cloud credentials
Unauthorized                         ← the app uses an old token that has expired or been deleted
$ kubectl get secret -n ci | grep token   ← since v1.24, no token Secret is auto-generated for a ServiceAccount
AADSTS70021: No matching federated identity record found for presented assertion. Assertion Issuer: 'https://…oic.prod-aks.azure.com/…'. Assertion Subject: 'system:serviceaccount:shop:api'.
WebIdentityErr: failed to retrieve credentials … AccessDenied: Not authorized to perform sts:AssumeRoleWithWebIdentity
Symptom

CI outside the cluster uses a token copied from a Secret, and it stops working after an upgrade. Pods that access cloud resources report federated identity errors.

Root cause
  • Since v1.24, long-lived token Secrets are no longer auto-generated. Pods use projected tokens that kubelet rotates (time-limited and bound to the Pod). If a client caches the token and never rereads it, it gets a 401 once the token expires.
  • With automountServiceAccountToken: false, there is no token.
  • AKS Workload Identity: the federated credential issuer or subject (system:serviceaccount:NS:SA) does not match, the SA is missing the azure.workload.identity/client-id annotation, or the Pod is missing the azure.workload.identity/use: "true" label.
  • EKS: the IRSA trust policy's OIDC provider or sub does not match. Or the Pod Identity association points to the wrong namespace or SA, or the agent is not installed.
Diagnostic commands
kubectl get sa api -n shop -o yaml
kubectl exec POD -- cat /var/run/secrets/kubernetes.io/serviceaccount/token | cut -d. -f2 | base64 -d 2>/dev/null | jq '{iss,sub,exp,aud}'
# Create a short-lived token for CI (instead of a long-lived Secret)
kubectl create token ci-deployer -n ci --duration=1h
# AKS
az identity federated-credential list -g rg-k8s-lab --identity-name id-shop-api -o table
# EKS
aws eks list-pod-identity-associations --cluster-name eks-lab
Fix

Switch CI to OIDC federation (GitHub Actions → Entra ID / IAM) with kubelogin or aws eks get-token. If you really need a long-lived token, create a Secret of type kubernetes.io/service-account-token explicitly and rotate it. Fix the federated credential subject and the annotation.

Prevention

Turn off automatic token mounting for Pods that do not call the API. Use the official SDKs, which reload projected tokens automatically.

See Hour 5: ServiceAccounts and Workload Identity and Hour 7: Pod Identity / IRSA.

#36 forbidden: exceeded quota: compute-quota · must specify limits.cpu
Warning  FailedCreate  replicaset-controller  Error creating: pods "api-7c…" is forbidden: exceeded quota: compute-quota, requested: requests.cpu=500m, used: requests.cpu=3800m, limited: requests.cpu=4
Warning  FailedCreate  replicaset-controller  Error creating: pods "api-7c…" is forbidden: failed quota: compute-quota: must specify limits.cpu for: api; requests.cpu for: api
Symptom

During a scale-out or release, new Pods do not appear, the Deployment gets stuck (#10), and the HPA cannot scale up.

Root cause

ResourceQuota limits the total requests/limits or the number of objects. When the quota includes fields such as limits.cpu, every Pod must declare that field, or it is rejected. A LimitRange can supply default values. Extra replicas created by maxSurge also count toward the quota.

Diagnostic commands
kubectl describe resourcequota -n shop
kubectl get limitrange -n shop -o yaml
Name:            compute-quota
Resource         Used   Hard
--------         ----   ----
limits.memory    7Gi    8Gi
requests.cpu     3800m  4
Fix

Request a higher quota or lower the requests, and clean up idle workloads. Add LimitRange defaults. Lower maxSurge, or leave room in the quota for surge replicas.

Prevention

Plan quotas as "peak replicas × requests + surge." Monitor the used/hard ratio of kube_resourcequota.

See Hour 5: Multi-tenancy: Quota · LimitRange · Auditing.

#37 ImagePull 403 / Key Vault 403: the AKS managed identity or kubelet identity is missing a role assignment
Failed to pull image "acrlab.azurecr.io/shop/api:1.4.2": … failed to authorize: failed to fetch anonymous token: unexpected status: 401 Unauthorized
# Secrets Store CSI (Key Vault)
MountVolume.SetUp failed for volume "secrets-store" : rpc error: … StatusCode=403 … does not have secrets get permission on key vault
Symptom

AKS gets 401/403 when pulling images from ACR, or the Key Vault CSI mount gets 403. Locally, with a personal account, it works fine.

Root cause

AKS has three kinds of identity: the control plane (manages LBs, disks, and so on), the kubelet (pulls images from ACR and needs AcrPull), and workloads (access Key Vault and so on). Assigning a role to the wrong identity or scope, or using access policies on a Key Vault that is in RBAC mode (or the reverse), both cause 403s. Role assignments can take several minutes to propagate.

Diagnostic commands
az aks check-acr -g rg-k8s-lab -n aks-lab --acr acrlab.azurecr.io
az aks show -g rg-k8s-lab -n aks-lab --query identityProfile.kubeletidentity.objectId -o tsv
az role assignment list --assignee OBJECT_ID --all -o table
Fix
az aks update -g rg-k8s-lab -n aks-lab --attach-acr acrlab
az role assignment create --assignee CLIENT_ID --role "Key Vault Secrets User" --scope KEYVAULT_ID
Prevention

Manage identities and role assignments with IaC. Use Workload Identity for app secrets, not the kubelet identity. The EKS equivalents: the node IAM role is missing AmazonEC2ContainerRegistryReadOnly (or an equivalent), or the Pod Identity association is missing (#35).

See Hour 6: Managed Cluster Comparison, the AKS course, and Hour 5: Secret Security and External Secrets.

#38 Namespace stuck in Terminating: finalizers / unable to retrieve the complete list of server APIs
status:
  conditions:
  - type: NamespaceDeletionDiscoveryFailure
    status: "True"
    reason: DiscoveryFailed
    message: 'Discovery failed for some groups, 1 failing: unable to retrieve the complete list of server APIs: metrics.k8s.io/v1beta1: the server is currently unable to handle the request'
  - type: NamespaceContentRemaining
    status: "True"
    message: 'Some resources are remaining: certificates.cert-manager.io has 2 resource instances'
  phase: Terminating
Symptom

kubectl delete ns old-app hangs for hours. CI fails to recreate a namespace with the same name.

Root cause
  • Objects with a finalizer still exist, but the controller that removes the finalizer has already been uninstalled (the Operator or CRD controller was deleted first).
  • An aggregated APIService is unavailable (for example, metrics-server is down), so the full list of resource types cannot be enumerated.
Diagnostic commands
kubectl get ns old-app -o jsonpath='{.status.conditions}' | jq
kubectl get apiservice | grep -v True
kubectl api-resources --verbs=list --namespaced -o name | xargs -n1 kubectl get -n old-app --ignore-not-found --show-kind
Fix
  • Fix or delete the unavailable or deprecated APIService.
  • Reinstall the controller so it can finish the cleanup. Remove the finalizer only after you confirm the external resources (cloud disks, DNS records) are cleaned up: kubectl patch certificate X -n old-app --type=merge -p '{"metadata":{"finalizers":null}}'.
Warning: do not force-clear namespace finalizers with the /finalize subresource. It leaves orphaned objects and cloud resources that are still billed (LBs, disks).
Prevention

Uninstall in this order: delete the CR instances → wait for the controller to clean up → remove the controller and CRDs → delete the namespace. Orchestrate this explicitly in Argo CD or Helm.

See Hour 1: Namespace and Hour 6: Production Troubleshooting Master Decision Tree.

The four stages of storage: different components handle each one, and failures look different at each stage ① Provisionexternal-provisionerCSI CreateVolume → cloud disk ② BindPV controllerPVC ↔ PV (WaitForFirstConsumer) ③ Attachattach/detach controllerVolumeAttachment → node ④ Mountkubelet + CSI nodeformat · fsGroup · SELinux ProvisioningFailed#26 (quota / permissions / SKU) PVC Pending #26volume topology conflict #4 Multi-Attach #27FailedAttachVolume FailedMount #28resize: FileSystemResizePending #29 Check the From field of the event: persistentvolume-controller / CSI driver name / attachdetach-controller / kubelet. It tells you which stage failed.
Figure 3-1: Locating storage problems by stage (#4, #26–#29)
The security checkpoints an API request passes through (#32–#36) kubectl / controllerRS creates Pod AuthenticationFailure → 401 (#35/#45) Authorization (RBAC)Failure → 403 (#32) Mutating admissionMAP / Mutating webhook Validating admissionPSA #33 · Quota #36 · VAP · webhook #34 Write to etcd → scheduling When a request from a controller is rejected, the error appears only in the events of the controller object:kubectl describe rs / job / statefulset → FailedCreateThis is why "Deployment 0/2 but no Pods at all" happens.
Figure 3-2: Authentication → Authorization → Mutating admission → Validating admission → etcd

Storage and security troubleshooting decision tree

Start from one of four symptoms: the Pod does not exist / stuck in ContainerCreating / permission errors while running / kubectl is rejected.

Environment: kind cluster lab, default StorageClass standard (local-path, WaitForFirstConsumer, no expansion support). Temporary namespace lab3, deleted as a whole at the end.

Lab 3-A: PVC Pending and WaitForFirstConsumer (#26)

kubectl create ns lab3
cat <<'EOF' | kubectl apply -n lab3 -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata: {name: data-a}
spec: {accessModes: [ReadWriteOnce], resources: {requests: {storage: 1Gi}}}
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata: {name: data-b}
spec: {storageClassName: premium-does-not-exist, accessModes: [ReadWriteOnce], resources: {requests: {storage: 1Gi}}}
EOF
kubectl describe pvc -n lab3 | grep -E '^Name|Normal|Warning'
Name:          data-a
  Normal  WaitForFirstConsumer  …  waiting for first consumer to be created before binding
Name:          data-b
  Warning  ProvisioningFailed   …  storageclass.storage.k8s.io "premium-does-not-exist" not found
Give data-a a consumer and watch the binding:
kubectl run user -n lab3 --image=busybox:1.37 --overrides='{"spec":{"containers":[{"name":"user","image":"busybox:1.37","command":["sleep","3600"],"volumeMounts":[{"name":"d","mountPath":"/data"}]}],"volumes":[{"name":"d","persistentVolumeClaim":{"claimName":"data-a"}}]}}'
kubectl get pvc -n lab3 data-a -w

Lab 3-B: RBAC 403 and can-i (#32)

kubectl create sa reader -n lab3
kubectl auth can-i list pods -n lab3 --as=system:serviceaccount:lab3:reader
kubectl get pods -n lab3 --as=system:serviceaccount:lab3:reader
no
Error from server (Forbidden): pods is forbidden: User "system:serviceaccount:lab3:reader" cannot list resource "pods" in API group "" in the namespace "lab3"
kubectl create role pod-reader -n lab3 --verb=get,list,watch --resource=pods
kubectl create rolebinding reader -n lab3 --role=pod-reader --serviceaccount=lab3:reader
kubectl get pods -n lab3 --as=system:serviceaccount:lab3:reader
kubectl logs user -n lab3 --as=system:serviceaccount:lab3:reader  # still denied: pods/log is a subresource

Lab 3-C: PSA rejection and a "Deployment with no Pods" (#33)

kubectl label ns lab3 pod-security.kubernetes.io/enforce=restricted pod-security.kubernetes.io/enforce-version=v1.37
kubectl create deploy priv -n lab3 --image=nginx:1.29-alpine
kubectl get deploy,pods -n lab3 -l app=priv
kubectl describe rs -n lab3 -l app=priv | grep -m1 -A1 FailedCreate
Warning: would violate PodSecurity "restricted:v1.37": allowPrivilegeEscalation != false …
deployment.apps/priv   0/1   0   0   10s
Warning  FailedCreate  …  Error creating: pods "priv-…" is forbidden: violates PodSecurity "restricted:v1.37": …
Note: the official nginx image starts as root. To meet restricted, switch to a non-root variant (such as nginxinc/nginx-unprivileged) or build your own image. This is the most common PSA migration task.

Lab 3-D: Three outcomes of ConfigMap hot updates (#30)

kubectl label ns lab3 pod-security.kubernetes.io/enforce-
kubectl create cm app -n lab3 --from-literal=MSG=v1
cat <<'EOF' | kubectl apply -n lab3 -f -
apiVersion: v1
kind: Pod
metadata: {name: cfg}
spec:
  containers:
  - name: c
    image: busybox:1.37
    command: ["sh","-c","while true; do echo env=$MSG vol=$(cat /cfg/MSG) sub=$(cat /sub/MSG); sleep 5; done"]
    envFrom: [{configMapRef: {name: app}}]
    volumeMounts:
    - {name: v, mountPath: /cfg}
    - {name: v, mountPath: /sub/MSG, subPath: MSG}
  volumes: [{name: v, configMap: {name: app}}]
EOF
kubectl patch cm app -n lab3 -p '{"data":{"MSG":"v2"}}'
sleep 90; kubectl logs cfg -n lab3 --tail=1
env=v1 vol=v2 sub=v1
Clean up everything: kubectl delete ns lab3
Command question

1) Without switching identity, check whether the SA shop:api can patch deployments in shop, and list all of its permissions in that namespace.

Reference answer
kubectl auth can-i patch deployments.apps -n shop --as=system:serviceaccount:shop:api
kubectl auth can-i --list -n shop --as=system:serviceaccount:shop:api

2) Dry-run: which existing Pods would violate restricted if shop enabled it (without actually applying it).

Reference answer
kubectl label --dry-run=server --overwrite ns shop pod-security.kubernetes.io/enforce=restricted
Scenario analysis question

After the node pool auto-upgraded overnight, many Pods could not be recreated. kubectl apply reports failed calling webhook … context deadline exceeded, and the webhook's own Pods are Pending. Give a plan to stop the bleeding and a permanent fix.

Key points of the reference answer
  • Stop the bleeding: confirm the deadlock (the rules match the webhook's own namespace), then temporarily change failurePolicy to Ignore or delete the configuration (export a backup first). Recover the webhook and the workload Pods, then restore the configuration.
  • Permanent fix: use a namespaceSelector to exclude kube-system and the webhook's namespace. Run multiple replicas with a PDB, anti-affinity, and a priority class. Lower timeoutSeconds. Move simple rules to ValidatingAdmissionPolicy.
  • Process: before an upgrade, check the availability of every webhook that uses failurePolicy=Fail.

Teaching videos (verified with oEmbed)

▶
Kubernetes Volumes explained | Persistent Volume, Persistent Volume Claim & Storage Class — TechWorld with Nana
English · covers #26–#29 · duration/date not verified
▶
Kubernetes ConfigMap and Secret as Kubernetes Volumes | Demo — TechWorld with Nana
English · covers #30, #31
▶
Kubernetes Security Best Practices you need to know | THE Guide for securing your K8s cluster! — TechWorld with Nana
English · RBAC, Pod security, Secrets (#31–#35)
▶
Azure AD Workload Identity on AKS | KubeCon 2022 — Microsoft Azure
English · covers #35, #37 (2022 content; Azure AD is now called Entra ID)

3-minute storyboard:

Shot 1 (0:00–0:45) Visual: the four-stage storage diagram, with the event From field highlighted. Narration: "Provision, bind, attach, and mount each have their own component. Check the event source, and you know where it is stuck."
Shot 2 (0:45–1:30) Visual: Multi-Attach → add the out-of-service taint to the node → the volume moves immediately. Narration: "Block storage attaches to only one node. Force the detach only when the node is really powered off."
Shot 3 (1:30–2:15) Visual: the Forbidden message is split into five colored blocks; reproduce it with auth can-i --as. Narration: "A four-oh-three message is a list of what is missing."
Shot 4 (2:15–3:00) Visual: Deployment 0/2 with no Pods → the PodSecurity rejection in the ReplicaSet events. Narration: "If you can't see the Pod, look at the controller that created it."

Official docs

or quiz score ≥ 70%

Module 4 · Part A: Upgrades, Scaling, Nodes, and Cloud Platforms (problems 39–50)

24:00 – 30:00 · Nodes NotReady, eviction, PDBs, deprecated APIs, certificates, etcd, credentials, node scaling, cgroup v1, EKS IP exhaustion, AKS upgrade stuck, EKS upgrades
6 minkubelet · etcd · AKS · EKS12 problems · ★★★★☆
Learning goals
  • Read node Conditions (Ready / MemoryPressure / DiskPressure / PIDPressure / NetworkUnavailable) and the automatic taints that go with them.
  • Understand drain → Eviction API → PDB, and handle "upgrade stuck at drain."
  • Before an upgrade, find the landmines: deprecated APIs, expired certificates, etcd quota, cgroup v1. Learn the AKS and EKS specific issues.
Prerequisites: Hour 6 cluster upgrades and AKS, Hour 7 EKS. Importance: ★★★★☆

Type a keyword (such as NotReady, evict, disruption budget, x509, space exceeded, or IP) to filter. Click a row to jump to its details.

#39 Node NotReady: container runtime network not ready … cni plugin not initialized / Kubelet stopped posting node status
Conditions:
  Type    Status   Reason                    Message
  Ready   False    KubeletNotReady           container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:Network plugin returns error: cni plugin not initialized
# or
  Ready   Unknown  NodeStatusUnknown         Kubelet stopped posting node status.
Symptom

The node is NotReady. After about 5 minutes (the default tolerationSeconds: 300), the Pods are deleted and recreated elsewhere. DaemonSet Pods are unhealthy.

Root cause
  • False + KubeletNotReady: kubelet is running, but a dependency is broken. The CNI DaemonSet (kindnet / Calico / Cilium / aws-node / azure-cns) is not ready, containerd is down, or PLEG is unhealthy.
  • Unknown: kubelet cannot report. The process has stopped, the node is down, the network to the apiserver is cut, or the client certificate has expired (#43).
  • Memory or PID exhaustion gets kubelet OOM-killed.
Diagnostic commands
kubectl get nodes ; kubectl describe node NODE | sed -n '/Conditions/,/Addresses/p'
kubectl -n kube-system get pods -o wide --field-selector spec.nodeName=NODE
# Go into the node (kind nodes are containers; on cloud, use kubectl debug node or SSH/SSM/az vmss run-command)
docker exec -it lab-worker bash -c 'systemctl status kubelet containerd --no-pager | head -20; journalctl -u kubelet --since -10m --no-pager | tail -30'
Fix

Restore the CNI DaemonSet, containerd, and kubelet. If you can't fix them, run kubectl cordon → drain, and let the node pool replace the node (delete the VMSS instance or rebuild the EC2 instance).

Prevention

Turn on node auto-repair (AKS, EKS). Monitor kube_node_status_condition. Set system-reserved and kube-reserved.

See Hour 1: Cluster Architecture, Hour 3: Network Model and CNI, and Hour 6: Cluster Upgrades and Maintenance.

#40 Evicted · The node was low on resource: ephemeral-storage · node had condition: [DiskPressure]
NAME                   READY   STATUS    RESTARTS   AGE
api-7d9c6b8f5d-4kq2x   0/1     Evicted   0          2d
Message:  The node was low on resource: ephemeral-storage. Threshold quantity: 10%, available: 7.8%. Container api was using 18Gi, request is 0, has larger consumption of ephemeral-storage.
Warning  FailedScheduling  … 0/3 nodes are available: 3 node(s) had untolerated taint {node.kubernetes.io/disk-pressure: }.
Symptom

Many Pods show Evicted (Failed phase, with the objects kept). The node has the disk-pressure taint, so new Pods cannot be scheduled there.

Root cause

The kubelet eviction threshold is hit (defaults such as nodefs.available<10% and imagefs.available<15%, which can be configured). Common sources: logs or caches written locally, an emptyDir without a sizeLimit, leftover images, or oversized log rotation. kubelet runs image GC first. If that is not enough, it evicts Pods ranked by how far their usage exceeds requests.

Diagnostic commands
kubectl get pods -A --field-selector=status.phase=Failed | grep -c Evicted
kubectl describe node NODE | grep -E 'DiskPressure|ephemeral-storage'
kubectl get --raw "/api/v1/nodes/NODE/proxy/stats/summary" | jq '.pods[]|{pod:.podRef.name,eph:.["ephemeral-storage"].usedBytes}' | head -40
docker exec lab-worker crictl images | wc -l
Fix
  • Set resources.requests/limits.ephemeral-storage and an emptyDir sizeLimit. Write logs to stdout.
  • Clean up Evicted Pods: kubectl delete pods -A --field-selector=status.phase=Failed.
  • Increase the node OS disk size (AKS ephemeral OS disk, EKS root volume).
Prevention

Monitor node filesystem usage. Slim down images with multi-stage builds. Use a node agent to ship container logs to a central platform.

See Hour 2: Resources and QoS and Hour 6: Observability.

#41 error when evicting pods/"api-…" -n "shop" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget.
evicting pod shop/api-7d9c6b8f5d-x2kqp
error when evicting pods/"api-7d9c6b8f5d-x2kqp" -n "shop" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget.
…(repeats every 5 seconds, in an endless loop)
Symptom

kubectl drain retries forever. Node pool upgrades, scale-downs, and Karpenter replacements get stuck.

Root cause

drain deletes Pods through the Eviction API. When the PDB has ALLOWED DISRUPTIONS = 0, the API returns 429 (Too Many Requests). Typical mistakes: a single replica with minAvailable: 1; minAvailable equal to the replica count; maxUnavailable: 0; unhealthy replicas that still count against the budget (you can set unhealthyPodEvictionPolicy: AlwaysAllow, GA in v1.31).

Diagnostic commands
kubectl get pdb -A
kubectl get pdb api -n shop -o jsonpath='{.spec}{"\n"}{.status}' | jq -s .
NAMESPACE   NAME   MIN AVAILABLE   MAX UNAVAILABLE   ALLOWED DISRUPTIONS   AGE
shop        api    2               N/A               0                     30d
Fix
  • Temporarily scale up the replicas (kubectl scale deploy/api --replicas=3) so that ALLOWED DISRUPTIONS is at least 1.
  • Change the PDB to maxUnavailable: 1, which adjusts to the replica count.
  • As a last resort, bypass the PDB with kubectl drain --disable-eviction. This can cause downtime.
Prevention

Only add a PDB when you have at least 2 replicas, and prefer maxUnavailable. Use VAP or Kyverno to reject PDBs where minAvailable ≥ replicas. For AKS upgrades stuck, see #49.

See Hour 6: Cluster Upgrades and Maintenance.

#42 Deployment fails after an upgrade: no matches for kind "X" in version "Y" · ensure CRDs are installed first (deprecated / removed APIs)
error: resource mapping not found for name: "web" namespace: "shop" from "web.yaml": no matches for kind "Ingress" in version "extensions/v1beta1"
ensure CRDs are installed first
Error: UPGRADE FAILED: unable to build kubernetes objects from current release manifest: resource mapping not found for name: "web" namespace: "" from "": no matches for kind "PodSecurityPolicy" in version "policy/v1beta1"
Warning: … is deprecated in v1.xx+, unavailable in v1.yy+; use … instead
Symptom

After the control plane upgrade, CI deployments fail. Helm reports that the "current release manifest" contains removed APIs, and even the rollback fails.

Root cause

Old APIs are removed under the deprecation policy (several versions after a beta API is deprecated), but manifests, charts, and Operators still use them. When the last manifest in a Helm release Secret contains removed APIs, helm upgrade cannot compare differences. Stored object versions in etcd also need migration (Storage Version Migrator is GA in v1.37, storagemigration.k8s.io/v1).

Diagnostic commands
# Before the upgrade: which deprecated APIs are still being requested
kubectl get --raw /metrics | grep apiserver_requested_deprecated_apis
# Scan manifests and the cluster (third-party tools: pluto, kubent)
pluto detect-files -d ./manifests ; pluto detect-helm -o wide
kubectl api-versions | sort
apiserver_requested_deprecated_apis{group="…",removed_release="1.xx",resource="…",version="v1beta1"} 1
Fix
  • Migrate manifests to the current API (the kubectl convert plugin can help). Ingress can also move to the Gateway API.
  • If a Helm release still has old APIs, use helm-mapkubeapis to rewrite the release metadata, then upgrade.
Prevention

Before an upgrade, read the deprecated API migration guide, the AKS upgrade readiness checks, and EKS upgrade insights (#50). In CI, run kubeconform -kubernetes-version 1.37.0 against the target version.

See Hour 6: Cluster Upgrades and Maintenance, the Helm course, and Hour 1: kubectl and the API Object Model.

#43 x509: certificate has expired or is not yet valid (control plane / kubelet certificate expired)
Unable to connect to the server: x509: certificate has expired or is not yet valid: current time 2026-11-15T02:10:44Z is after 2026-11-14T08:31:02Z
# kubelet log
part of the existing bootstrap client certificate in /etc/kubernetes/kubelet.conf is expired
Symptom

On a kubeadm cluster that is a year old, every kubectl command suddenly fails and nodes go NotReady. Or the webhook or aggregated API certificate has expired (#34).

Root cause

kubeadm control plane certificates last 1 year by default (the CA lasts 10 years). kubeadm upgrade renews them automatically, so if you never upgrade, they will expire. kubelet client certificates rely on automatic rotation. If CSRs are not approved, or clocks drift, they expire. On AKS and EKS, the platform manages control plane certificates. For an AKS cluster CA, rotate with az aks rotate-certs (this causes a brief interruption).

Diagnostic commands
# kubeadm (also works inside a kind node)
docker exec lab-control-plane kubeadm certs check-expiration
kubectl get csr
echo | openssl s_client -connect APISERVER:6443 2>/dev/null | openssl x509 -noout -dates
CERTIFICATE                EXPIRES                  RESIDUAL TIME   CERTIFICATE AUTHORITY   EXTERNALLY MANAGED
admin.conf                 Nov 14, 2027 08:31 UTC   363d            ca                      no
apiserver                  Nov 14, 2027 08:31 UTC   363d            ca                      no
…
Fix
sudo kubeadm certs renew all  # run on every control plane node
# Restart the static Pods (move the manifests out and back, or restart kubelet), and update admin.conf / kubeconfig
sudo cp /etc/kubernetes/admin.conf ~/.kube/config
Prevention

Upgrade at least once a year. This also meets the support window requirement (v1.37 EOL 2027-10-28). Alert 30 days before expiry. Use cert-manager to manage webhook certificates.

See Hour 5: Authentication and Hour 6: Cluster Upgrades and Maintenance.

#44 etcdserver: mvcc: database space exceeded (etcd space quota exhausted, cluster is read-only)
Error from server: etcdserver: mvcc: database space exceeded
$ etcdctl endpoint status -w table
| ENDPOINT | … | DB SIZE | … | ERRORS                          |
| …:2379   | … | 2.1 GB  | … | memberID:… alarm:NOSPACE        |
Symptom

All write operations (create, update, delete) fail, but reads still work. Controllers cannot write status, and the cluster "freezes."

Root cause

The etcd backend quota defaults to 2 GiB (--quota-backend-bytes, adjustable, with a recommended ceiling of 8 GiB). Exceeding it triggers a NOSPACE alarm, and etcd goes read-only. Causes: no compaction or defrag, and objects growing rapidly: huge numbers of Events, very large ConfigMaps or Secrets (Helm release history), or an Operator leaking CRs.

Diagnostic commands
# In kubeadm and kind, etcd runs as a static Pod
kubectl -n kube-system exec etcd-lab-control-plane -- etcdctl \
  --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 \
  endpoint status -w table
kubectl get --raw /metrics | grep apiserver_storage_objects | sort -k2 -n -r | head
Fix
  1. Clean up the object growth (for example, set --history-max for helm, and delete leaked CRs).
  2. Compact to the current revision → run etcdctl defrag on each member → run etcdctl alarm disarm.
  3. First take a snapshot: etcdctl snapshot save.
Prevention

Monitor etcd_mvcc_db_total_size_in_bytes against the quota. On AKS and EKS, the platform maintains etcd. Too many objects show up as higher API latency or throttling. In v1.37, etcd RangeStream (etcd 3.7+) is Beta and reduces memory pressure on large LIST calls.

See Hour 1: Cluster Architecture: Control Plane and Nodes and Hour 4: Backup and Restore.

#45 error: You must be logged in to the server (Unauthorized): expired kubeconfig credentials / missing EKS access entry / AKS kubelogin
error: You must be logged in to the server (Unauthorized)
E1115 02:10:44 memcache.go:265] couldn't get current server API group list: the server has asked for the client to provide credentials
# AKS (Entra ID integration, kubeconfig not converted)
kubelogin is not installed which is required to connect to AAD enabled cluster.
Symptom

A kubectl that worked yesterday returns 401 today. A new teammate or a CI role gets 401 on a new EKS cluster. AKS asks for kubelogin.

Root cause
  • The upstream session for exec plugins (kubelogin, aws eks get-token) has expired (az login / AWS SSO), or the plugin is not on PATH.
  • EKS: the IAM principal has no access entry and no legacy aws-auth mapping, or the current identity is not the one that created the cluster. 401 = not mapped to a Kubernetes identity; mapped but without permissions is 403 (#32).
  • AKS: an Entra ID cluster needs kubelogin convert-kubeconfig -l azurecli; with --disable-local-accounts, --admin is not available.
  • The client certificate in a certificate-based kubeconfig has expired (#43).
Diagnostic commands
kubectl config current-context ; kubectl config view --minify -o jsonpath='{.users[0].user.exec}' | jq
kubectl auth whoami  # username and groups as the apiserver sees them (v1.28+)
# EKS
aws sts get-caller-identity ; aws eks list-access-entries --cluster-name eks-lab
# AKS
az account show -o table ; kubelogin --version
Fix
# EKS: create an access entry for the role and associate an access policy
aws eks create-access-entry --cluster-name eks-lab --principal-arn arn:aws:iam::111122223333:role/platform-admin
aws eks associate-access-policy --cluster-name eks-lab --principal-arn arn:aws:iam::111122223333:role/platform-admin \
  --policy-arn arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy --access-scope type=cluster
# AKS
az aks get-credentials -g rg-k8s-lab -n aks-lab --overwrite-existing && kubelogin convert-kubeconfig -l azurecli
Prevention

Write access control into IaC (EKS access entries, AKS Entra groups + Azure RBAC), and keep and audit the break-glass process.

See hour 5: Authentication, hour 6: Managed cluster comparison, AKS course, hour 7: Access entries.

#46 Pod Pending but the node group does not scale up: pod didn't trigger scale-up · max node group size reached / Karpenter cannot start nodes
Normal   NotTriggerScaleUp  cluster-autoscaler  pod didn't trigger scale-up: 1 max node group size reached, 2 node(s) had untolerated taint {…}
# Karpenter (wording varies by version)
Warning  FailedScheduling   karpenter  Failed to schedule pod, incompatible with nodepool "default", daemonset overhead={…}, no instance type satisfied resources {…} and requirements …
Symptom

The Insufficient cpu from #1 persists, and autoscaling does not react.

Root cause
  • The node group has reached its maximum size, or there is not enough vCPU quota or regional SKU capacity (AKS QuotaExceeded, AllocationFailed; EKS InsufficientInstanceCapacity).
  • New nodes still can't fit the pod: tolerations, affinity or zone do not match the node template; requests exceed the largest node size; a PV is bound to a zone (#4).
  • Karpenter: requirements are too narrow, limits are full, the EC2NodeClass subnet or security group selectors don't match, or the instance profile lacks permissions.
  • Not enough subnet IPs (EKS #48, AKS Azure CNI legacy mode).
Diagnostic commands
kubectl describe pod POD | grep -E 'TriggeredScaleUp|NotTriggerScaleUp|karpenter'
# AKS
az aks nodepool show -g rg-k8s-lab --cluster-name aks-lab -n user1 --query '{min:minCount,max:maxCount,count:count}'
az vm list-usage -l canadacentral -o table | grep -i 'Standard DSv5'
# EKS + Karpenter
kubectl get nodepools,nodeclaims ; kubectl -n kube-system logs deploy/karpenter --tail=50
Fix

Raise the max node count or quota, add SKUs and zones; correct the NodePool requirements and selectors; align the pod constraints with the node group template.

Prevention

Use multiple SKUs and zones; use low-priority placeholder pods (overprovisioning) to shorten scale-up waits; monitor and request quota early.

See hour 6: Autoscaling: node scaling, hour 7: Karpenter.

#47 After upgrading the node image, kubelet won't start: kubelet is configured to not run on a host using cgroup v1
"command failed" err="failed to run Kubelet: kubelet is configured to not run on a host using cgroup v1. cgroup v1 support is unsupported and will be removed in a future release"
Symptom

After kubelet is upgraded to v1.35+, old OS nodes on cgroup v1 cannot join and stay NotReady.

Root cause

Starting in v1.35, the kubelet setting failCgroupV1 defaults to true, so kubelet refuses to start on cgroup v1 hosts. cgroup v1 is being phased out, and features such as MemoryQoS (enabled by default in Beta in v1.37) also depend on cgroup v2.

Diagnostic commands
stat -fc %T /sys/fs/cgroup/  # cgroup2fs = v2; tmpfs = v1
journalctl -u kubelet --no-pager | grep -i cgroup | tail
grep -i failCgroupV1 /var/lib/kubelet/config.yaml
tmpfs
Fix
  • Move the node OS to cgroup v2 (Ubuntu 22.04+, RHEL 9, Azure Linux, Bottlerocket, AL2023 defaults to v2), or set the kernel parameter systemd.unified_cgroup_hierarchy=1.
  • Temporary workaround (not recommended): set failCgroupV1: false in the kubelet configuration.
  • Set SystemdCgroup = true in containerd to match cgroupDriver: systemd in kubelet.
Prevention

Read the “Urgent Upgrade Notes” in each release's notes, and validate in a pre-production node pool first. AKS and EKS supported node images already use cgroup v2; check custom images yourself.

See hour 6: Cluster upgrades and maintenance.

#48 EKS: failed to assign an IP address to container (VPC CNI subnet IPs exhausted / ENI limit)
Warning  FailedCreatePodSandBox  kubelet  Failed to create pod sandbox: … plugin type="aws-cni" name="aws-cni" failed (add): add cmd: failed to assign an IP address to container
Symptom

The EKS nodes have plenty of resources, but new pods are stuck in ContainerCreating, or are Pending with Too many pods.

Root cause
  • VPC CNI gives each pod a real IP from the subnet. Small subnets (such as /24) run out quickly, and WARM_ENI_TARGET preallocates IPs for a whole ENI by default, which uses up more.
  • The number of ENIs × IPs per ENI for the instance type sets max pods, which is especially limiting on small instances.
Diagnostic commands (explanation only, not reproducible in kind)
aws ec2 describe-subnets --subnet-ids subnet-0abc --query 'Subnets[].{id:SubnetId,cidr:CidrBlock,free:AvailableIpAddressCount}'
kubectl -n kube-system logs ds/aws-node -c aws-node --tail=50 | grep -i -E 'ipamd|insufficient|assign'
kubectl get node NODE -o jsonpath='{.status.allocatable.pods}'
Fix
  • Enable prefix delegation (each ENI slot gets a /28 prefix; requires Nitro instances): kubectl set env daemonset aws-node -n kube-system ENABLE_PREFIX_DELEGATION=true. AWS recommends creating a new node group rather than rolling-replacing.
  • Add a secondary CIDR to the VPC (such as 100.64.0.0/16) and use custom networking (ENIConfig), so pods get their own subnets.
  • Tune WARM_IP_TARGET/MINIMUM_IP_TARGET to warm fewer IPs, or use IPv6.
Prevention

Plan and monitor subnet IPs using “nodes × pods per node × redundancy”. On AKS, Azure CNI legacy mode also consumes VNet IPs, so Azure CNI Overlay is recommended.

See hour 7: Networking: VPC CNI and IP planning. Official: Assign more IP addresses to Amazon EKS nodes with prefixes.

#49 AKS: (UpgradeFailed) Drain node … failed when evicting pod … Cannot evict pod as it would violate the pod's disruption budget
(UpgradeFailed) Drain node aks-user1-12345678-vmss000002 failed when evicting pod api-7d9c6b8f5d-x2kqp failed with Too Many Requests error. This error is often caused by a restrictive Pod Disruption Budget (PDB) policy. See https://aka.ms/aks/debugdrainfailures. Original error: Cannot evict pod as it would violate the pod's disruption budget.. PDB debug info: shop/api-7d9c6b8f5d-x2kqp blocked by pdb api with 0 unready pods.
Symptom

The node pool upgrade fails after running for a long time; the node pool or cluster enters the Failed state, and nodes are left on a mix of old and new versions.

Root cause
  • The PDB allows zero disruptions (#41), and AKS gives up after retrying evictions (the drain timeout defaults to 30 minutes and can be set from 5 minutes to 24 hours).
  • Max surge needs extra vCPU quota and subnet IPs. When these are insufficient (node pool ≥ 1.35), it falls back to surge 1; if that still fails, the upgrade fails.
  • v1.37: when a Standard node pool is upgraded to 1.37, LocalDNS may be enabled if it was not explicitly configured. A custom VNet DNS must support both UDP and TCP 53 (test before upgrading).
Diagnostic commands (explanation only, not reproducible in kind)
kubectl get pdb -A
kubectl get events -A --field-selector reason=Drain | tail
az aks nodepool show -g rg-k8s-lab --cluster-name aks-lab -n user1 --query '{state:provisioningState,ver:orchestratorVersion,upgrade:upgradeSettings}'
Warning  Drain  node/aks-user1-…-vmss000002  Eviction blocked by Too Many Requests (usually a pdb): api-7d9c6b8f5d-x2kqp
Fix
# 1) Fix the PDB or temporarily scale up replicas so that ALLOWED DISRUPTIONS ≥ 1
kubectl scale deploy/api -n shop --replicas=3
# 2) Upgrade again to the same target version to trigger reconciliation
az aks nodepool upgrade -g rg-k8s-lab --cluster-name aks-lab -n user1 --kubernetes-version 1.37.1
# 3) Adjust upgrade settings (recommended for production: max surge 33%)
az aks nodepool update -g rg-k8s-lab --cluster-name aks-lab -n user1 --max-surge 33% --drain-timeout 45 --node-soak-duration 5

Use the actual output of az aks get-versions -l canadacentral for the patch version numbers.

Prevention

Run the “upgrade readiness check” before upgrading; plan maintenance windows; upgrade non-production pools first; separate system and user pools; keep an eye on the AKS version calendar (community support and LTS).

See hour 6: Cluster upgrades and maintenance, hour 6: Managed cluster comparison. Official: Troubleshoot UpgradeFailed errors due to PDB eviction failures, Configure rolling upgrades for AKS node pools (accessed 2026-11-15).

#50 EKS upgrade: upgrade insights report ERROR · managed add-on or node group versions are behind · kubelet version skew
{
  "insights": [
    {"name": "Deprecated APIs removed in Kubernetes v1.xx", "category": "UPGRADE_READINESS",
     "insightStatus": {"status": "ERROR", "reason": "Deprecated API usage detected within last 30 days"}},
    {"name": "Kubelet version skew", "category": "UPGRADE_READINESS", "insightStatus": {"status": "WARNING"}}
  ]
}
Symptom

After the EKS control plane is upgraded, the CoreDNS, kube-proxy and VPC CNI add-ons are still on old versions and misbehave; node group kubelets are too far behind; or insights report ERROR.

Root cause
  • A control plane upgrade does not upgrade node groups or add-ons. Upgrade the managed add-ons (compatible with the target version) and then the node groups or Karpenter nodes, in that order.
  • Upgrade only one minor version at a time; kubelet version skew is limited (see the version skew policy).
  • Still using APIs that are being removed (#42).
  • The requirement that “insights with problems need --force to upgrade” has been temporarily rolled back by AWS. The new version rollback feature (within 7 days after an upgrade) is blocked by rollback readiness insights in ERROR or UNKNOWN state, and can be bypassed with --force.
Diagnostic commands (explanation only, not reproducible in kind)
aws eks list-insights --cluster-name eks-lab --filter kubernetesVersions=1.37
aws eks describe-insight --cluster-name eks-lab --id INSIGHT_ID
aws eks describe-addon-versions --addon-name vpc-cni --kubernetes-version 1.37 --query 'addons[0].addonVersions[0].addonVersion'
kubectl get nodes -o custom-columns=NAME:.metadata.name,KUBELET:.status.nodeInfo.kubeletVersion
Fix

Fix the ERROR items in insights → upgrade the control plane → upgrade managed add-ons (aws eks update-addon) → upgrade node groups or replace Karpenter drifted nodes → verify.

Prevention

Declare add-on versions in both Terraform and eksctl; rehearse in non-production first; watch the EKS standard and extended support windows (extended support costs extra).

See hour 7: Upgrades and operations. Official: EKS cluster insights (accessed 2026-11-15).

Each step of a node upgrade (surge mode) and where it can get stuck ① Create surge nodeNeeds quota and subnet IPs ② Cordon old nodesspec.unschedulable=true ③ Drain: Eviction APIapiserver checks PDB ④ Pods are rebuilt on new nodesScheduling + volume attach + readiness ⑤ Reimage or delete old nodesAfter soak, move to the next batch QuotaExceeded #46IP exhaustion #48 PDB 429 #41 / #49Drain timeout Multi-Attach #27Webhook deadlock #34 cgroup v1 #47CNI not ready #39 Pre-upgrade checks: deprecated APIs #42 · certificates #43 · etcd capacity #44 · PDB budgets · webhook availability · quota and IPsOrder: control plane → add-ons (CNI, CoreDNS, kube-proxy) → node pools; one minor version at a time
Figure 4-1 Node upgrade pipeline and where problems 39–50 fit
Node condition → automatic taint → consequence Ready=False/Unknownnot-ready / unreachableNoExecutePods evicted after 300 seconds#39 DiskPressuredisk-pressureNoSchedulekubelet eviction + image GC#40 MemoryPressurememory-pressureNoScheduleEviction by QoS#6 unschedulablecordon / drainNoScheduleEviction API + PDB#41
Figure 4-2 Node conditions and node.kubernetes.io/* automatic taints

Node upgrade (drain) failure simulator

Choose a scenario to play. It steps through surge → cordon → eviction → rebuild → delete old node, with the matching API calls and events. When a PDB, quota or webhook problem occurs, it stops, and you must pick the right fix to continue.

Choose a scenario to start.
$ Waiting to start…
Environmentkind cluster lab. #48–#50 are EKS/AKS platform problems (they need cloud accounts and incur costs), so they are explained only in “Problem details”.

Lab 4-A: PDB blocks drain (#41)

Scale api down to 1 replica and configure a PDB that allows no disruptions:
kubectl scale deploy/api -n shop --replicas=1
kubectl create pdb api -n shop --selector=app=api --min-available=1
kubectl get pdb -n shop
NAME   MIN AVAILABLE   MAX UNAVAILABLE   ALLOWED DISRUPTIONS   AGE
api    1               N/A               0                     3s
Drain the node where api runs (add a timeout so it doesn't wait forever):
NODE=$(kubectl get pod -n shop -l app=api -o jsonpath='{.items[0].spec.nodeName}')
kubectl drain $NODE --ignore-daemonsets --delete-emptydir-data --timeout=30s
error when evicting pods/"api-…" -n "shop" (will retry after 5s): Cannot evict pod as it would violate the pod's disruption budget.
error: unable to drain node "lab-worker" due to error: … global timeout reached: 30s
Fix: scale up replicas and switch to maxUnavailable, then drain:
kubectl scale deploy/api -n shop --replicas=2
kubectl delete pdb api -n shop && kubectl create pdb api -n shop --selector=app=api --max-unavailable=1
kubectl drain $NODE --ignore-daemonsets --delete-emptydir-data --timeout=120s
kubectl uncordon $NODE

Lab 4-B: simulate a node NotReady (#39)

Stop kubelet on worker2 and watch the status change:
docker exec lab-worker2 systemctl stop kubelet
kubectl get nodes -w  # after about 40 seconds lab-worker2 becomes NotReady (default node-monitor-grace-period)
Check the conditions and automatic taints:
kubectl describe node lab-worker2 | grep -E 'Ready|Taints' -A1
Taints:             node.kubernetes.io/unreachable:NoExecute
                    node.kubernetes.io/unreachable:NoSchedule
  Ready            Unknown   …   NodeStatusUnknown   Kubelet stopped posting node status.
Recover: docker exec lab-worker2 systemctl start kubelet, then confirm the node returns to Ready.

Lab 4-C: certificate and etcd health check (#43, #44)

docker exec lab-control-plane kubeadm certs check-expiration | head -15
kubectl -n kube-system exec etcd-lab-control-plane -- etcdctl --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 \
  endpoint status -w table
kubectl get --raw /metrics | grep apiserver_requested_deprecated_apis || echo "no deprecated API request records"

Whether the etcd static pod image includes etcdctl depends on the image version. If it doesn't, use the etcdctl on the control plane node's host.

Cleanup for this module: kubectl delete pdb api -n shop
Command questions

1) List all PDBs and their currently allowed disruptions, and identify the ones that would block drain.

Reference answer
kubectl get pdb -A
kubectl get pdb -A -o json | jq -r '.items[]|select(.status.disruptionsAllowed==0)|.metadata.namespace+"/"+.metadata.name'

2) In a kubeadm cluster, check the expiration dates of all certificates.

Reference answer
sudo kubeadm certs check-expiration
Scenario analysis questions

You are responsible for upgrading the AKS production cluster from 1.36 to 1.37. Write the pre-upgrade checklist and sequence, and explain how to handle UpgradeFailed (PDB).

Key points of the reference answer
  • Checks: deprecated APIs (metrics + pluto), PDB budgets, webhook availability, vCPU quota and subnet IPs (max surge 33%), custom DNS support for TCP/UDP 53 (1.37 LocalDNS), backups (Velero), and the maintenance window.
  • Sequence: rehearse in a non-production cluster → control plane → system node pool → user node pools (you can create a new node pool first and then migrate).
  • UpgradeFailed: fix the PDB or scale up replicas → upgrade again to the same version to trigger reconciliation; add the root cause to the next checklist.

Teaching videos (oEmbed verified)

▶
Kubernetes Deconstructed: Understanding Kubernetes by Breaking It Down - Carson Anderson, DOMO — CNCF [Cloud Native Computing Foundation]
English · roles of the control plane, etcd and kubelet (#39, #43, #44) · duration and date not verified
▶
Kubernetes Architecture explained | Kubernetes Tutorial 15 — TechWorld with Nana
English · node component review

No verified AKS/EKS upgrade troubleshooting video was found. Storyboard and script:

Shot 1 (0:00–0:40) Visual: five-step animation of the upgrade pipeline. Narration: “A node upgrade is a batch drain, and anything that blocks pods from moving will stall the upgrade.”
Shot 2 (0:40–1:30) Visual: drain loop output “violate the pod's disruption budget”; in kubectl get pdb, ALLOWED DISRUPTIONS at zero is circled. Narration: “One replica with minAvailable 1 means you are never allowed to touch it.”
Shot 3 (1:30–2:20) Visual: AKS portal upgrade fails → fix the PDB → upgrade again to the same version. Narration: “After an AKS upgrade fails, upgrade to the same version once more to trigger reconciliation and let it finish.”
Shot 4 (2:20–3:00) Visual: EKS subnet available IPs drop to zero; after prefix delegation is enabled, pods recover. Narration: “EKS pods use real VPC IPs, so the subnet determines the cluster size.”

Official docs

or a quiz score ≥ 70%

Module 5 · Part B: Architecture and core objects (interview questions 1–13)

30:00 – 37:00 · Declarative model and control loops, control plane, node components, the full apply path, etcd, Pods, controllers, Services, SSA, CRD/Operator, API versions
7 minapiserver · etcd · watch13 questions
Learning goals
  • Explain Kubernetes using the “declarative API + etcd + watch + control loop” model, and draw the control plane on a whiteboard.
  • Walk through the full path from kubectl apply to a running container (authentication → authorization → admission → etcd → scheduling → kubelet → CRI/CNI/CSI).
  • Answer the common questions well: “Why isn't a Pod a container?”, “Deployment vs ReplicaSet”, “How Services are implemented”, “Operator”, and similar.
Prerequisite: hour 1. Answer framework: conclusion (one sentence) → principle → command/YAML → production experience.

Browse the questions, mark the ones you are unsure about, and click to jump to the detailed answer.

Q1. What is Kubernetes? What problem does it solve? What do “declarative” and “control loop” mean? Beginner
30-second answer

Kubernetes is a container orchestration platform. You submit a “desired state” as API objects (replica count, image, resources), and controllers continuously compare desired and actual state, handling scheduling, self-healing, scaling and rolling updates automatically. Declarative means describing what you want, not how to do it. A control loop means observe → diff → act.

Deeper answer
  • It solves multi-host scheduling and bin-packing, self-healing, service discovery and load balancing, releases and rollbacks, configuration and secret distribution, storage orchestration, and horizontal scaling.
  • All state lives in etcd, components don't call each other directly, and they respond to changes by watching the apiserver. This is level-triggered: if an event is lost, the next comparison still converges.
  • It is idempotent: re-applying the same manifest changes nothing, which is the foundation of GitOps.
kubectl scale deploy/api --replicas=3     # change the desired state
kubectl delete pod -l app=api --wait=false # break the actual state
kubectl get pods -w                        # watch the ReplicaSet controller bring the replicas back to 3
Common follow-ups
  • How is it different from Docker Compose or Swarm? Compose runs on a single host. Kubernetes has an extensible API (CRDs), stronger scheduling, and a larger ecosystem.
  • When should you not use Kubernetes? For a small team with a single application and no platform operations capability, use a managed PaaS (Azure Container Apps, App Service, ECS).
Bonus points

Distinguish level-triggered from edge-triggered. Kubernetes is essentially an extensible distributed state machine plus a controller framework, which is why Operators work.

Common wrong answers

“Kubernetes just runs Docker.” The runtime is already containerd or CRI-O (dockershim was removed in v1.24); the core is orchestration.

See hour 1, Module 1.

Q2. What components make up the control plane, and what is each one responsible for? Beginner
30-second answer

kube-apiserver: the only entry point that reads and writes etcd; handles authentication, authorization, admission, and REST and watch. etcd: a consistent key-value store. kube-scheduler: selects nodes for unscheduled Pods. kube-controller-manager: runs the built-in controllers (Deployment, ReplicaSet, Node, Job, EndpointSlice, and others). cloud-controller-manager: interacts with cloud APIs (load balancers, node lifecycle, routes).

Deeper answer
  • The apiserver is stateless and can scale horizontally. High availability comes from an etcd cluster (an odd number of members) and a load balancer in front.
  • When the scheduler and controller-manager run multiple instances, they use a Lease for leader election, so only one is active.
  • On managed clusters (AKS/EKS), the cloud provider operates the control plane, so you can't see these Pods. You can observe the control plane through API metrics and diagnostic logs.
kubectl get pods -n kube-system -l tier=control-plane   # kubeadm/kind
kubectl get lease -n kube-system                         # leader election
kubectl get --raw='/readyz?verbose' | tail -5
Common follow-ups
  • What happens to running Pods if the apiserver goes down? They keep running, because they don't depend on the apiserver, but nothing can be changed, self-healed or scheduled.
  • What if the scheduler goes down? New Pods stay Pending; running Pods are not affected.
Bonus points

API Priority and Fairness (APF) prevents a single client from overwhelming the apiserver. Components communicate only with the apiserver, a “star architecture”.

Common wrong answers

“The scheduler starts containers.” The kubelet starts them; the scheduler only writes spec.nodeName (Binding).

See hour 1: Cluster architecture: control plane and nodes.

Q3. Which components run on a node? How do the kubelet, container runtime, kube-proxy and CNI relate to each other? Beginner
30-second answer

kubelet watches the Pods on its node. Through the CRI, it has containerd create the sandbox and containers; through CNI, it sets up networking; through CSI, it mounts volumes. It also runs probes and reports status. kube-proxy programs Services into nftables or iptables rules (Cilium and others can replace it).

Deeper answer
  • containerd creates the sandbox (pause holds the network namespace) → CNI ADD allocates an IP → the image is pulled → the application container is created.
  • kube-proxy modes: nftables (GA in v1.33, recommended), iptables (the classic default mode), and ipvs (deprecated in v1.37).
  • The kubelet is also responsible for node pressure eviction, certificate rotation, and static Pods (the kubeadm control plane is one).
docker exec lab-worker crictl pods ; docker exec lab-worker crictl ps
kubectl get --raw "/api/v1/nodes/lab-worker/proxy/configz" | jq '.kubeletconfig.cgroupDriver'
kubectl -n kube-system get cm kube-proxy -o yaml | grep mode
Common follow-ups
  • Why was dockershim removed? Docker does not implement CRI and needed an adapter layer. OCI images built by Docker still run on containerd.
  • What happens if the kubelet loses its connection to the apiserver? Containers keep running and the node becomes Unknown. After about 5 minutes, the Pods are recreated elsewhere, which can cause duplicate runs.
Bonus points

Mention that starting in v1.35 the kubelet refuses cgroup v1 hosts by default (failCgroupV1), and mention the kubelet's PLEG.

Common wrong answers

“kube-proxy forwards all traffic.” In iptables or nftables mode it only writes rules, and the kernel forwards packets. It is not in the data path.

See hour 1: Cluster architecture, hour 3: Network model and CNI.

Q4. After running kubectl apply -f deploy.yaml, what happens before the container is running? Intermediate
30-second answer

kubectl → apiserver (authentication → authorization → mutating admission → validation → validating admission) → etcd → the Deployment controller creates the RS → the RS controller creates the Pod → the scheduler filters and scores, then writes the Binding → the kubelet sees it via watch → the CRI creates the sandbox → the CNI sets up networking → the CSI mounts volumes → the image is pulled and started → probes pass → EndpointSlice adds the Pod IP.

Deeper answer
  1. kubectl reads the kubeconfig, computes the patch (apply, or --server-side), and sends an HTTPS request.
  2. apiserver: authentication (certificate, OIDC token, or ServiceAccount token) → RBAC authorization → mutating admission (defaults, webhooks, MAP) → object schema validation → validating admission (PSA, Quota, VAP, webhooks) → write to etcd (committed by Raft majority).
  3. Each write produces a new resourceVersion, and watchers receive the event.
  4. scheduler: Filter (resources, taints, affinity, volume topology) → Score → Bind.
  5. kubelet: admission → RunPodSandbox → CNI ADD → pull image → CreateContainer/StartContainer → startup, readiness and liveness probes → report status.
kubectl apply -f deploy.yaml -v=6 2>&1 | grep -E 'GET|PATCH|POST'   # see the real HTTP requests
kubectl get events --sort-by=.metadata.creationTimestamp | tail -15   # Scheduled → Pulling → Created → Started
Common follow-ups
  • What do you see when a step fails? Authorization → 403 (#32); PSA → RS event FailedCreate (#33); scheduling → Pending (#1); image → ImagePullBackOff (#7).
  • How does Server-Side Apply differ from client-side apply? See Q11.
Bonus points

Map each step to a question number in Part A. Components only talk to the apiserver, and they are decoupled through etcd state.

Common wrong answers

“The apiserver tells the kubelet to start the container.” No, the kubelet watches actively. Only exec and logs have the apiserver connect to the kubelet.

See hour 1: The full journey of kubectl apply.

Q5. What role does etcd play in the cluster? Why is the member count odd? How do you back it up? Intermediate
30-second answer

etcd is a strongly consistent key-value store based on Raft, and it holds all state (objects, resourceVersions, leases). Writes need a majority: 3 members tolerate 1 failure and 5 tolerate 2. An even count adds voting cost without adding fault tolerance. Back up with etcdctl snapshot save, and rehearse restores regularly.

Deeper answer
  • Only the apiserver accesses etcd. Data is stored under /registry/<resource>/<ns>/<name>, and Secrets can be encrypted at rest.
  • It is extremely sensitive to fsync latency (use dedicated SSDs). The default backend quota is 2 GiB (#44).
  • MVCC: each change adds a new revision, so periodic compaction and defrag are required.
  • On managed clusters (AKS/EKS), etcd belongs to the platform. Users back up through Velero (resources and volumes) or the GitOps repository.
ETCDCTL_API=3 etcdctl --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 snapshot save /backup/etcd-$(date +%F).db
Common follow-ups
  • What happens if you lose the majority? The cluster can't accept writes. Recover from a snapshot or force a new cluster.
  • Can you use etcd as an application database? Not recommended. It is designed for small metadata.
Bonus points

In v1.37, etcd 3.7's RangeStream (Beta) reduces memory pressure on large LISTs, and the watch cache keeps most reads from hitting etcd.

Common wrong answers

“More etcd members is always safer, so run 6.” Six members tolerate the same failures as five, with higher write latency.

See hour 1: Cluster architecture, hour 4: Backup and restore.

Q6. What is a Pod? Why is the scheduling unit a Pod rather than a container? What does the pause container do? Beginner
30-second answer

A Pod is a group of containers that share a network namespace (the same IP, with localhost reachable between them) and volumes. It is the smallest unit for scheduling and scaling. Tightly coupled processes (a main container plus a sidecar) need to share network and storage on the same node. The pause (sandbox) container holds the network namespace, so the IP stays the same when application containers restart.

Deeper answer
  • Container types: init containers (run sequentially to completion), native sidecars (initContainers + restartPolicy: Always, GA in v1.33; they start before the main containers and stop after them), regular containers, and ephemeral debug containers (kubectl debug).
  • Pods are “cattle”: immutable and replaceable at any time. Manage them with controllers, and don't create bare Pods.
  • Starting in v1.35, in-place resize is GA, so resources can be adjusted without recreating the Pod.
spec:
  initContainers:
  - name: log-shipper
    image: fluent/fluent-bit:4.0
    restartPolicy: Always          # native sidecar
  containers:
  - name: api
    image: ghcr.io/stefanprodan/podinfo:6.17.0

The fluent-bit tag is only an example; use a version that actually exists.

Common follow-ups
  • Is it fine to put several applications in one Pod? Not recommended, because scaling and releases become coupled. Only include helper processes that must run together.
  • What is the difference between a Pod restart and a Pod rebuild? A container restart keeps the same Pod and IP (RESTARTS +1). A Pod rebuild creates a new name and a new IP.
Bonus points

Native sidecars solve the problem of Jobs that never complete (#11), and they also handle startup ordering.

Common wrong answers

“A Pod is just a container,” or “containers in a Pod can run on different nodes.”

See hour 1: Pod, the smallest scheduling unit.

Q7. How are Deployment, ReplicaSet and Pod related? How are rolling updates and rollbacks implemented? Beginner
30-second answer

A Deployment manages ReplicaSets, and an RS maintains the replica count. Changing the Pod template creates a new RS (distinguished by pod-template-hash), and the new RS is scaled up while the old one is scaled down according to maxSurge and maxUnavailable. A rollback sets the old RS's template back to the current one (revisionHistoryLimit controls how many revisions are kept).

Deeper answer
kubectl set image deploy/api api=ghcr.io/stefanprodan/podinfo:6.17.0
kubectl rollout status deploy/api
kubectl get rs -l app=api        # two RSes; the old one has DESIRED 0
kubectl rollout history deploy/api ; kubectl rollout undo deploy/api
  • Only changes to spec.template create a new revision. Changing the replica count does not.
  • A failed rollout is not rolled back automatically. It only sets ProgressDeadlineExceeded (#10).
  • strategy: Recreate deletes the old Pods first and then creates new ones. This causes downtime, and it is used for RWO volumes or versions that cannot run side by side.
Common follow-ups
  • How do you do a canary? Natively, run two Deployments behind one Service and split traffic by replica ratio. For precise ratios, use HTTPRoute weights or Argo Rollouts/Flagger.
  • Why not use a ReplicaSet directly? It has no rolling updates and no revision history.
Bonus points

minReadySeconds and readiness together determine “available”. Quota (#36) limits the surge.

Common wrong answers

“rollout undo restores ConfigMaps.” No. ConfigMaps are not part of revisions, unless you use hash-suffixed names.

See hour 1: Deployment and ReplicaSet, hour 2: Advanced release strategies.

Q8. What is the difference between labels, selectors and annotations? Where is each one used? Beginner
30-second answer

Labels are key-value pairs used for selection and grouping. Services, Deployments, NetworkPolicies and scheduling all rely on selector matching. Annotations are non-identifying metadata (tool configuration, build info, checksums). They cannot be used for selection, and their values can be long.

Deeper answer
  • Selectors come in two forms: equality-based (app=api) and set-based (env in (prod,stage), !canary).
  • Recommended labels: app.kubernetes.io/name, /instance, /version, /component, /part-of, /managed-by.
  • Common annotation uses: kubectl.kubernetes.io/restartedAt (rollout restart), Helm checksum/config, cloud load balancer settings, and Prometheus scraping.
kubectl get pods -l 'app=api,env in (prod,stage)' --show-labels
kubectl label pod POD canary=true ; kubectl annotate deploy api owner=team-shop
Common follow-ups
  • Can you change a Deployment's selector? In apps/v1 it is immutable, so you have to recreate the Deployment (to avoid overlapping Pods with other controllers).
  • What happens if you delete a label from a Pod? The Pod is detached from the RS and becomes an orphan, and the RS creates a new Pod to replace it. In production, this is a trick for pulling a faulty Pod out while keeping it for investigation.
Bonus points

Label values are limited to 63 characters; annotations have no limit.

Common wrong answers

Putting the version number into a Service selector, which cuts off all traffic during a release (#13).

See hour 1: Namespace · Label · Selector.

Q9. What is a Namespace for? Does it provide isolation? Which resources do not belong to a namespace? Beginner
30-second answer

A Namespace is a name scope and a policy boundary. RBAC, ResourceQuota, LimitRange, NetworkPolicy and PSA labels all apply per namespace. It does not provide network or security isolation. By default, namespaces can reach each other, so you need NetworkPolicy, RBAC and PSA to build soft multi-tenancy. Node, PV, StorageClass, ClusterRole, CRD and Namespace itself are cluster-scoped resources.

Deeper answer
kubectl api-resources --namespaced=false | head -20
kubectl get ns --show-labels      # kubernetes.io/metadata.name is set automatically as a label
  • DNS: svc.ns.svc.cluster.local. Cross-namespace access must include the namespace (#15).
  • Deleting a namespace cascades to delete the objects in it. For a namespace stuck in deletion, see #38.
Common follow-ups
  • Do you split namespaces by team or by environment? Separate production and non-production into different clusters. Within a cluster, split namespaces by team or application.
  • What about hard multi-tenancy? See Q37 (dedicated clusters, vCluster, node isolation).
Bonus points

ConfigMaps and Secrets cannot be referenced across namespaces, and ServiceAccounts are also namespace-scoped.

Common wrong answers

“Different namespaces are naturally network-isolated.”

See hour 1: Namespace, hour 5: Multi-tenancy.

Q10. What types of Service are there? When should you use ClusterIP, NodePort, LoadBalancer, ExternalName and Headless? Beginner
30-second answer

ClusterIP: a stable virtual IP inside the cluster (the default). NodePort: opens a port on every node (30000–32767), often used by external load balancers. LoadBalancer: the cloud controller creates an internal or external load balancer. ExternalName: a DNS CNAME to an external domain (no proxying). Headless (clusterIP: None): no VIP; DNS returns Pod IPs directly, used for StatefulSets and client-side load balancing.

Deeper answer
  • The types build on each other: LoadBalancer ⊃ NodePort ⊃ ClusterIP.
  • Implementation: selector → EndpointSlice → kube-proxy rules. A Service without a selector can have its EndpointSlice maintained manually to point to external IPs.
  • For hostname- or path-based HTTP routing, use the Gateway API (Q24).
kubectl expose deploy api --port=80 --target-port=9898 --type=ClusterIP
kubectl get svc,endpointslices -l app=api
kubectl run t --rm -it --image=registry.k8s.io/e2e-test-images/agnhost:2.53 --restart=Never -- nslookup db-headless
Common follow-ups
  • Can you ping a ClusterIP? Usually not. The virtual IP is only DNATed for the programmed ports and protocols.
  • What are externalTrafficPolicy and internalTrafficPolicy? See #21. internalTrafficPolicy: Local only forwards to endpoints on the same node.
Bonus points

Topology-aware routing, such as trafficDistribution: PreferClose, reduces cross-zone traffic costs (check the official docs for field names and their stage).

Common wrong answers

“Expose every service with a LoadBalancer.” This is costly and uses many IPs. Consolidate behind a gateway.

See hour 1: Service basics, hour 3: Services in depth.

Q11. What is the difference between kubectl create, replace and apply? What are Server-Side Apply and field management (managedFields)? Intermediate
30-second answer

create and replace are imperative. create fails if the object already exists, replace fails if it doesn't, and replace overwrites the whole object. apply is declarative and only changes the fields you declare. Client-side apply does a three-way merge using the last-applied-configuration annotation. Server-Side Apply (SSA) merges on the apiserver and records field owners in managedFields. When several parties change the same field, it reports a conflict instead of silently overwriting.

Deeper answer
kubectl apply --server-side --field-manager=ci -f deploy.yaml
kubectl get deploy api -o yaml --show-managed-fields | sed -n '/managedFields/,/^  name/p' | head -30
kubectl apply --server-side --force-conflicts -f deploy.yaml   # explicitly take over conflicting fields
  • A typical conflict: an HPA manages spec.replicas, and the manifest also sets replicas, so every apply resets the replica count. Fix: remove replicas from the manifest.
  • Argo CD and Flux support SSA, and Helm 4 also adopts SSA (check the Helm docs for details).
Common follow-ups
  • Which category does kubectl edit fall into? Imperative. Avoid it in production because it causes drift.
  • What is KYAML in v1.37? kubectl get -o kyaml outputs a stricter, unambiguous YAML dialect (GA).
Bonus points

Use kubectl diff in CI to preview changes.

Common wrong answers

“apply is create-or-update, that is, create if missing and update if present.” This ignores merge semantics and field ownership.

See hour 1: kubectl and the API object model.

Q12. What are CRDs, controllers and Operators? What should you watch out for when writing your own Operator? Advanced
30-second answer

A CRD registers a new resource type with the apiserver (such as PostgresCluster). A controller watches these objects and reconciles them. An Operator = CRD + a controller that encodes domain knowledge, putting operational experience (deployment, scaling, backup, upgrades, failover) into the reconciliation loop.

Deeper answer
  • Reconciliation must be idempotent and based on the current state (level-triggered), and it must handle duplicate events and partial failures.
  • Use the status subresource and conditions to report progress. Use ownerReferences for cascading deletion. Use a finalizer to clean up external resources (this prevents the hang described in #38).
  • Use the controller-runtime informer cache so you don't flood the apiserver with frequent LISTs. Configure concurrency, a rate-limited work queue and leader election.
  • Version evolution: multiple versions plus a conversion webhook. CEL rules (x-kubernetes-validations) can replace some webhooks.
kubectl get crd | head ; kubectl explain postgresclusters.spec --recursive | head
kubectl get postgresclusters -A -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.status.conditions[?(@.type=="Ready")].status}{"\n"}{end}'
Common follow-ups
  • What is the difference between an Operator and Helm? Helm is a one-time template render and release. An Operator runs continuously and handles day-two operations.
  • When should you not write an Operator? For stateless workloads with no need for continuous reconciliation, Helm or Kustomize is enough.
Bonus points

Operator maturity model (basic install → upgrades → lifecycle → insights → autopilot). Examples: CloudNativePG, cert-manager, Prometheus Operator.

Common wrong answers

“An Operator is just a scheduled script.” It is an event-driven reconciliation loop, not cron.

See hour 1: Why Kubernetes: declarative model and control loops, hour 4: StatefulSet + PostgreSQL in practice.

Q13. How do Kubernetes API versions (alpha, beta, GA) and the deprecation policy work? How do you handle API removal during an upgrade? Intermediate
30-second answer

APIs are organized by group and version (apps/v1, gateway.networking.k8s.io/v1). Alpha is off by default and can change at any time. Beta is pre-release, and new beta APIs are not enabled by default. GA (v1) is stable long-term. A deprecated API is removed after a set number of versions. Until then, the apiserver returns a warning and exposes the apiserver_requested_deprecated_apis metric. There are about 3 minor releases per year, and each is maintained for about 14 months.

Deeper answer
  • Currently maintained branches: 1.37 (1.37.1), 1.36 and 1.35. 1.34 reached EOL on 2026-10-27. 1.38 is expected in 2026-12.
  • Feature gates are separate from API versions. A feature can be Beta and enabled by default (for example, HPA scale-to-zero in v1.37).
  • Handling removals: use metrics + pluto or kubent to find users → migration checklist and Helm releases (#42) → Storage Version Migrator (GA in v1.37) to migrate the etcd storage version.
kubectl api-versions | grep -E 'autoscaling|gateway'
kubectl explain hpa --api-version=autoscaling/v2 | head -5
kubectl get --raw /metrics | grep apiserver_requested_deprecated_apis
Common follow-ups
  • How far can the kubectl version differ from the cluster version? ±1 minor version.
  • What about managed clusters? AKS and EKS each have their own version calendars and support windows (AKS LTS, EKS extended support).
Bonus points

In v1.37, kube-proxy's ipvs mode and kube-dns are deprecated, replaced by nftables and CoreDNS.

Common wrong answers

“Beta APIs can't be used in production.” Many Beta features are enabled by default and widely used. The key is to assess the risk and track the GA timeline.

See hour 1: kubectl and the API object model, hour 6: Cluster upgrades and maintenance.

Whiteboard diagram: control plane and nodes (Q2, Q3, Q4) kubectl / CIGitOps controller Control plane kube-apiserverAuthentication · authorization · admission · watch etcd (Raft)The only state store schedulerFilter/Score/Bind controller-managerDeploy/RS/Node/EPS cloud-controllerLB · routing · nodes Worker node kubelet (watches Pods on this node) containerd (CRI) → runc CNI CSI node kube-proxy (nftables rules) watch All components talk only to the apiserver (star topology), and they are decoupled from each other through object stateapply → etcd → Deployment controller → RS → Pod → scheduler Bind → kubelet → CRI/CNI/CSI→ probes → EndpointSlice → kube-proxy rules
Figure 5-1: draw and explain as you go, covering the five control plane components and four node components
Control loop (Q1, Q12) Observe (watch) Diff desired vs actual Act (call the API) Level-triggered: missing an event is fine, because the next comparison still converges. Operators use the same pattern to manage custom resources.
Figure 5-2 Observe → Diff → Act

Scenario 5-1: explain to management why you are moving from VMs and scripts to Kubernetes

30 microservices run on Azure VMs, and Ansible releases take 2 hours and often fail. The CTO asks: what are the benefits, costs and risks of moving to AKS? How many migration steps are there?

Key points of the reference answer
  • Benefits: minute-level declarative releases and rollbacks, self-healing, better utilization through bin-packing, a unified observability and security baseline, and GitOps audit trails.
  • Costs: the platform team and its skills, cluster spend, and the learning curve. At small scale, a PaaS such as Azure Container Apps may be more cost-effective.
  • Risks: migrating stateful workloads, networking and identity integration, and operational maturity. Mitigation: migrate stateless services first and keep databases on managed PaaS.
  • Phases: containerization and CI (Docker hour) → non-production cluster + GitOps → canary migration of stateless services → observability and SLOs → production cutover and VM shutdown.

Scenario 5-2: apiserver latency spikes

On Monday morning, kubectl takes over 10 seconds, and some controllers report 429 Too Many Requests. How do you diagnose it?

Key points of the reference answer
  • Metrics: the distribution of apiserver_request_duration_seconds by verb and resource, and apiserver_flowcontrol_rejected_requests_total (APF rejections).
  • Find the “bad client”: aggregate audit logs or APF metrics by user-agent or flow schema. The common culprits are an Operator or CI script that frequently does full LISTs.
  • Check for a surge in objects (Events, CRs) and for etcd capacity (#44).
  • Fix: have clients use informer caches and pagination, configure FlowSchema and PriorityLevel rate limits, and clean up objects. On managed clusters, enable control plane diagnostic logs (AKS resource logs, EKS control plane logs).

Teaching videos (oEmbed verified)

▶
Kubernetes Architecture explained | Kubernetes Tutorial 15 — TechWorld with Nana
English · Q2, Q3
▶
Kubernetes Deconstructed: Understanding Kubernetes by Breaking It Down - Carson Anderson, DOMO — CNCF [Cloud Native Computing Foundation]
English · the full path for Q4
▶
Kubernetes Explained in 100 Seconds — Fireship
English · reference for an opening “one-sentence introduction”
▶
Kubernetes: The Documentary [PART 1] — CultRepo
English · background story

Storyboard for a “2-minute answer to Q4”:

Shot 1 (0:00–0:20) Left: write kubectl; right: draw the control plane. Narration: “Answer in three parts: the apiserver, the controllers and scheduler, and the nodes.”
Shot 2 (0:20–0:55) Write in order: authentication, authorization, mutating admission, validating admission, etcd. Narration: “If any of these steps fails, the request is rejected right away, for example with a 403 or a PodSecurity denial.”
Shot 3 (0:55–1:30) Draw Deployment → ReplicaSet → Pod → Binding. Narration: “Controllers and the scheduler are both driven by watches, and they don't call each other directly.”
Shot 4 (1:30–2:00) Draw kubelet → CRI → CNI → CSI → probes → EndpointSlice. Narration: “A Pod only joins the Service endpoints once it is ready, and only then does traffic reach it.”

Official docs

or a quiz score ≥ 70%

Module 6 · Part B: Workloads, scheduling and networking (interview questions 14–25)

37:00 – 44:00 · QoS, probes, release strategies, StatefulSet, DaemonSet/Job, scheduler, high-availability spread, CNI, kube-proxy, DNS, Gateway, NetworkPolicy
7 minscheduler · nftables · Gateway API12 questions
Learning goals
  • Explain how requests and limits affect scheduling, QoS, eviction and throttling.
  • Compare the use cases of Deployment, StatefulSet, DaemonSet and Job, and design high-availability replica placement.
  • Cover everything from the network model through Services, DNS, the Gateway API and NetworkPolicy.
Prerequisites: hours 2 and 3.

Browse the questions, and click to jump to the detailed answers.

Q14. What is the difference between requests and limits? How are the three QoS classes defined? Should you set a CPU limit? Intermediate
30-second answer

requests are used for scheduling and resource guarantees (CPU shares, memory reclaim priority). limits are the ceiling: CPU over its limit is throttled, and memory over its limit gets an OOMKill. QoS: if all containers have requests equal to limits → Guaranteed; if at least one container has requests or limits → Burstable; if none do → BestEffort. Under memory pressure, eviction goes BestEffort → Burstable → Guaranteed.

Deeper answer
  • CPU is compressible, but memory is not. Latency-sensitive services often don't set a CPU limit, to avoid CFS throttling that inflates tail latency. They still need reasonable CPU requests and a memory limit.
  • v1.37: MemoryQoS (cgroup v2 memory.high) is enabled by default in Beta. In-place resize (GA in v1.35) adjusts resources without recreating the Pod.
  • For capacity planning, look at the sum of requests rather than actual usage (#1).
kubectl get pod POD -o jsonpath='{.status.qosClass}'
kubectl top pod --containers ; kubectl describe node NODE | grep -A6 'Allocated resources'
Common follow-ups
  • How do you determine requests? Use load testing, production P95 and VPA recommendations.
  • What about overcommit? The sum of limits can exceed node capacity. The sum of requests cannot.
Bonus points

CPU throttling metric: container_cpu_cfs_throttled_periods_total. LimitRange provides default values.

Common wrong answers

“Limits decide scheduling.” Scheduling only looks at requests. If only limits are set, requests default to the limits.

See hour 2: Resource requests/limits and QoS.

Q15. What is the difference between startupProbe, readinessProbe and livenessProbe? What pitfalls come with designing probes? Beginner
30-second answer

startup: protects the startup period, and the other two probes do not run until it succeeds. readiness: on failure, removes the Pod from endpoints without restarting it. liveness: on failure, restarts the container. Principles: liveness should only check whether the process is stuck and should not depend on external systems. Put dependency checks in readiness, and use startupProbe for slow starts.

Deeper answer
  • Probe types: httpGet, tcpSocket, exec, grpc.
  • Pitfalls: a liveness probe that depends on the database causes cascading restarts. The default timeoutSeconds of 1 second is too short. If readiness and liveness use the same endpoint and thresholds, “drain traffic first, then restart” does not work. A probe endpoint should not do heavy operations.
  • Graceful termination: SIGTERM → preStop → terminationGracePeriodSeconds → SIGKILL (#24).
startupProbe:  {httpGet: {path: /healthz, port: http}, failureThreshold: 30, periodSeconds: 5}
readinessProbe: {httpGet: {path: /readyz, port: http}, periodSeconds: 5}
livenessProbe:  {httpGet: {path: /healthz, port: http}, periodSeconds: 10, timeoutSeconds: 3}
Common follow-ups
  • What happens without probes? The Pod is considered ready as soon as it starts, so traffic may be sent to an application that is not initialized yet.
  • Does a failed readiness probe restart the container? No.
Bonus points

The cascading failure case from #9, and Pod readiness gates (tie Pod readiness to the health status of an external load balancer).

Common wrong answers

“The more thorough the liveness check, the better.”

See hour 2: Probes and graceful termination.

Q16. How do you achieve zero-downtime releases? How are rolling, blue-green and canary releases done on Kubernetes? Intermediate
30-second answer

Zero downtime = correct readiness + graceful termination (preStop) + maxUnavailable: 0 + PDB + backward-compatible changes (for databases, expand first, then contract). Blue-green: two Deployments, switched through the Service selector or an HTTPRoute. Canary: HTTPRoute weights, or Argo Rollouts/Flagger advancing based on metrics.

Deeper answer
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata: {name: api, namespace: shop}
spec:
  parentRefs: [{name: shop-gw, namespace: infra}]
  rules:
  - backendRefs:
    - {name: api-stable, port: 80, weight: 90}
    - {name: api-canary, port: 80, weight: 10}
  • Database schema: expand (add columns that both old and new versions can use) → release → contract (drop the old columns).
  • Automated analysis: roll back when the error rate, P99 latency or saturation exceeds its threshold.
Common follow-ups
  • What is the cost of blue-green? Double the resources, and state and sessions need to be handled.
  • How do you roll back a database? Only roll forward. Use backward compatibility so that a rollback is never needed.
Bonus points

The endpoint-removal race from #24. Use feature flags to decouple feature toggles from releases.

Common wrong answers

“Rolling updates are zero-downtime by nature.” This does not hold without readiness and graceful termination.

See hour 2: Advanced release strategies, hour 3: Gateway API.

Q17. How does a StatefulSet differ from a Deployment? When must you use a StatefulSet? Intermediate
30-second answer

A StatefulSet provides a stable network identity (db-0.db-headless), a dedicated persistent volume for each replica (volumeClaimTemplates; a rebuilt replica reattaches to the same PVC), and ordered create, delete and rolling updates. It suits databases, message queues and other software that needs member identity.

Deeper answer
  • Requires a Headless Service. podManagementPolicy: Parallel starts Pods in parallel. updateStrategy.rollingUpdate.partition updates in batches (canary).
  • Deleting a StatefulSet does not delete its PVCs by default (configurable through persistentVolumeClaimRetentionPolicy).
  • v1.37 Alpha: the Recreate update strategy for StatefulSets.
  • Data replication and failover are handled by the database or an Operator, not by the StatefulSet.
kubectl get sts db -o jsonpath='{.spec.updateStrategy}'
kubectl patch sts db -p '{"spec":{"updateStrategy":{"rollingUpdate":{"partition":2}}}}'
Common follow-ups
  • Should databases run on Kubernetes? See Q29.
  • What happens to data when you scale a StatefulSet? Scaling down does not delete PVCs. Rebalancing data is the application's job.
Bonus points

While a Pod is stuck terminating, the StatefulSet does not create a replacement with the same name (“at most one” semantics). For node failures, you need the out-of-service taint (#27).

Common wrong answers

“A StatefulSet backs up data automatically.”

See hour 2: StatefulSet, hour 4: StatefulSet + PostgreSQL in practice.

Q18. What are DaemonSets, Jobs and CronJobs used for? What are the key parameters of each? Beginner
30-second answer

DaemonSet: one replica per node (or per selected node), for log and monitoring agents, CNI, and CSI node plugins. Job: runs to completion, for migrations and batch processing. CronJob: creates Jobs on a cron schedule, for backups and reports.

Deeper answer
  • DaemonSet: updateStrategy (RollingUpdate with maxUnavailable and maxSurge), tolerations (system DaemonSets often tolerate all taints), and priorityClassName.
  • Job: completions, parallelism, backoffLimit, activeDeadlineSeconds, ttlSecondsAfterFinished, podFailurePolicy, and Indexed mode (each Pod has an index).
  • CronJob: schedule, timeZone, concurrencyPolicy (Allow, Forbid or Replace), startingDeadlineSeconds, and history limits.
  • v1.37 Beta: gang scheduling (batch and AI jobs are either all scheduled or none are).
kubectl create cronjob backup --image=postgres:17 --schedule="0 2 * * *" -- pg_dump -h db -U app app
kubectl create job --from=cronjob/backup backup-now
Common follow-ups
  • What do you do when a CronJob misses a run? Check startingDeadlineSeconds, the number of runs missed while the controller was down (scheduling stops after 100 missed runs), and the concurrency policy.
Bonus points

A native sidecar lets a Job complete normally (#11). Alert on lastSuccessfulTime.

Common wrong answers

Putting a one-time task in a Deployment. It keeps restarting after exiting with 0 (#5).

See hour 2: DaemonSet, Job and CronJob.

Q19. How does the scheduler choose a node? What problems do nodeSelector, affinity and anti-affinity, and taints and tolerations each solve? Intermediate
30-second answer

Scheduling framework: Filter removes infeasible nodes based on resources, taints, affinity, volumes and ports. Score ranks the rest by resource balance, topology spread, image locality and affinity preferences. Bind assigns the Pod. nodeSelector and node affinity attract Pods to nodes. Taints repel Pods from nodes, and tolerations allow Pods to be scheduled onto or stay on tainted nodes. Pod affinity and anti-affinity depend on where other Pods are.

Deeper answer
  • required is a hard constraint, and the Pod stays Pending if it is not met. preferred is a soft constraint that affects scoring.
  • Taint effects: NoSchedule, PreferNoSchedule, NoExecute (evicts running Pods that don't tolerate the taint; you can set tolerationSeconds).
  • A dedicated node pool = taint + label + toleration + affinity.
  • PriorityClass and preemption; multiple schedulers (schedulerName); v1.37 Alpha: scheduling preemption for in-place resize.
affinity:
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
      - matchExpressions: [{key: kubernetes.io/arch, operator: In, values: [arm64]}]
Common follow-ups
  • What does IgnoredDuringExecution mean? If labels change after the Pod is running, the Pod is not evicted.
  • What are the performance problems with anti-affinity? In large clusters, Pod-to-Pod affinity calculations are expensive, so prefer topologySpreadConstraints.
Bonus points

Read the FailedScheduling messages in #1–#3 and name the corresponding Filter plugin.

Common wrong answers

“Adding a toleration makes the Pod schedule onto that node.”

See hour 2: Scheduling: affinity · taints · topology spread.

Q20. How do you keep a service available through node failures, zone failures and cluster maintenance? Intermediate
30-second answer

Multiple replicas + topologySpreadConstraints (spread evenly across zones and nodes) + PDB (limits voluntary disruptions) + correct probes and graceful termination + node pools with headroom across zones + dependencies (databases, caches, gateways) that are highly available too.

Deeper answer
topologySpreadConstraints:
- {maxSkew: 1, topologyKey: topology.kubernetes.io/zone, whenUnsatisfiable: DoNotSchedule, labelSelector: {matchLabels: {app: api}}}
- {maxSkew: 1, topologyKey: kubernetes.io/hostname, whenUnsatisfiable: ScheduleAnyway, labelSelector: {matchLabels: {app: api}}}
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata: {name: api}
spec: {maxUnavailable: 1, selector: {matchLabels: {app: api}}}
  • A PDB only protects against voluntary disruptions (drain, upgrades, scale-down). It does not protect against node failures.
  • Keep the replica count at or above the number of zones, so that after one zone fails, the remaining capacity can handle peak load (N+1).
  • Control plane high availability: choose a tier with an SLA (AKS Standard or Premium, EKS multi-AZ control plane by default).
Common follow-ups
  • What happens if a PDB is misconfigured? It blocks upgrades (#41, #49).
  • What about cross-zone traffic costs? Topology-aware routing reduces cross-zone calls.
Bonus points

Blast radius and multi-cluster setups (for regional failures). Validate with chaos engineering, such as deleting nodes or simulating zone failures.

Common wrong answers

“Three replicas means high availability.” They may all be on the same node.

See hour 2: Scheduling, hour 6: Managed cluster comparison, AKS course.

Q21. What are the basic requirements of the Kubernetes network model? What does a CNI plugin do? How do overlay and native routing differ? Intermediate
30-second answer

Requirements: each Pod has its own IP; Pods can reach each other across nodes without NAT; nodes and Pods can reach each other. At Pod creation (CNI ADD), the CNI plugin creates the veth, allocates an IP (IPAM), and configures routes or encapsulation. Some plugins also implement NetworkPolicy and Services (via eBPF).

Deeper answer
Overlay (VXLAN/Geneve)Native routing / VPC-native
ExamplesCalico VXLAN, Flannel, Azure CNI OverlayAWS VPC CNI, Azure CNI (Pod subnet), Calico BGP
Pod IPSeparate address space; does not consume VNet IPsUses real VPC/VNet IPs (#48 IP exhaustion)
OverheadEncapsulation, reduced MTU (#22)No encapsulation; can be routed directly by the cloud network
kubectl get pods -o wide ; kubectl get nodes -o jsonpath='{range .items[*]}{.metadata.name}{" "}{.spec.podCIDR}{"\n"}{end}'
docker exec lab-worker ls /etc/cni/net.d/
Common follow-ups
  • What is different about Cilium? It is based on eBPF, can replace kube-proxy, and provides L7 policies and Hubble observability.
  • IPv6 and dual-stack? Dual-stack has been GA since v1.23, and Services can set ipFamilyPolicy.
Bonus points

On the cloud: AKS recommends Azure CNI Overlay (or Azure CNI powered by Cilium) to save VNet IPs. EKS uses prefix delegation or custom networking.

Common wrong answers

“Traffic between Pods has to go through kube-proxy.”

See Hour 3: Network Model and CNI, Hour 7: VPC CNI.

Q22. How does a Service's ClusterIP work? What are the differences between the iptables, nftables and ipvs modes of kube-proxy? Advanced
30-second answer

The EndpointSlice controller maintains the backend list based on the selector. kube-proxy watches Services and EndpointSlices, programs kernel rules on every node, DNATs packets sent to ClusterIP:port to a Pod IP:targetPort, and relies on conntrack to keep connections stable. iptables: rule chains are matched linearly, so updates are slow at large scale. nftables (GA in v1.33): set and map lookups, more efficient; switched to netlink in v1.37. ipvs: deprecated in v1.37 (expected to be disabled by default in v1.40 and removed in v1.43).

Deeper answer
  • Balancing is done per connection with probability, not per request. Long-lived connections (gRPC/HTTP2) stick to one backend, so you need client-side balancing or an L7 proxy for per-request balancing.
  • sessionAffinity: ClientIP provides stickiness based on the source IP.
  • eBPF (Cilium kube-proxy replacement) translates at the socket layer, bypassing conntrack.
kubectl -n kube-system get cm kube-proxy -o yaml | grep -E 'mode|nftables'
docker exec lab-worker nft list ruleset 2>/dev/null | grep -m5 -i 'api' || docker exec lab-worker iptables-save | grep -m5 'shop/api'
Common follow-up questions
  • Why is gRPC load uneven? See above.
  • conntrack table full? See #23.
Bonus points

Name the iptables chain KUBE-SERVICES → KUBE-SVC-xxx → KUBE-SEP-xxx, and explain why to move to nftables.

Common wrong answers

"ipvs has the best performance, so use it." It was deprecated in v1.37.

See Hour 3: Service in Depth: kube-proxy and EndpointSlice.

Q23. How does DNS resolution work inside a Pod? What is ndots:5? How do you optimize DNS? Intermediate
30-second answer

The kubelet writes /etc/resolv.conf for each Pod: the nameserver points to the kube-dns Service (CoreDNS), and search contains <ns>.svc.cluster.local svc.cluster.local cluster.local. ndots:5 means that names with fewer than 5 dots try the search domains first, in order. CoreDNS's kubernetes plugin watches Services and EndpointSlices to answer in-cluster names, and forwards everything else upstream.

Deeper answer
  • Records: svc.ns.svc.cluster.local → ClusterIP; headless Service → an A record for each Pod; StatefulSet pod-0.svc.ns.svc.cluster.local; SRV records for named ports.
  • Optimizations: use FQDNs (with a trailing dot) for external domains, or lower ndots (#16); NodeLocal DNSCache; CoreDNS replicas, resources and autoscaler; the cache plugin.
  • dnsPolicy: ClusterFirst (default), Default, ClusterFirstWithHostNet, None + dnsConfig.
kubectl exec POD -- cat /etc/resolv.conf
kubectl -n kube-system get cm coredns -o jsonpath='{.data.Corefile}'
Common follow-up questions
  • What causes 5-second DNS latency? A conntrack race plus UDP retries (#23).
  • Can kube-dns still be used? It was deprecated in v1.37; migrate to CoreDNS.
Bonus points

After a default-deny NetworkPolicy, you must explicitly allow DNS (#17).

Common wrong answers

"Services in other namespaces can be resolved by their short names."

See Hour 3: CoreDNS and Service Discovery.

Q24. What is the difference between Ingress and Gateway API? What should you do after ingress-nginx is retired? Intermediate
30-second answer

Ingress is a single resource with limited features that relies on controller-specific annotations. Gateway API splits responsibilities by role: GatewayClass (infrastructure provider), Gateway (platform operations), and HTTPRoute, GRPCRoute, TCPRoute and others (application teams). It natively supports weighted traffic splitting, header matching, cross-namespace grants (ReferenceGrant), multiple protocols and standardized status conditions. ingress-nginx was archived on 2026-03-24 (final version v1.15.1, no security patches). Use ingress2gateway 1.0 to convert Ingress resources and annotations, and migrate to a supported implementation (Envoy Gateway, Istio, Cilium, or a cloud provider's implementation).

Deeper answer
  • The Ingress API (networking.k8s.io/v1) is still GA and not deprecated, but it is frozen. New features only go into Gateway API.
  • Gateway API v1.6: TCPRoute and UDPRoute move to Standard; HTTPRoute and GRPCRoute are Standard/GA.
  • Migration steps: inventory the annotations → ingress2gateway print --providers=ingress-nginx → manually review annotations that cannot be converted → run both entry points in parallel → switch DNS → decommission the old controller.
ingress2gateway print --providers=ingress-nginx -A > gateway-resources.yaml
kubectl get gatewayclass,gateway,httproute -A
Common follow-up questions
  • What should you choose on AKS/EKS? AKS offers managed options such as Application Gateway for Containers; on EKS, the AWS Load Balancer Controller supports Gateway API (check the current docs; see hours 6 and 7).
Bonus points

Clarify that the controller is retired, not the API. Map 404/503 responses to Route conditions (#19/#20).

Common wrong answers

"The Ingress API has been deleted."

See Hour 3: Ingress and the ingress-nginx Retirement, Gateway API v1.6.

Q25. What is the semantics of NetworkPolicy? What is the default behavior, how do rules combine, and what prerequisites are needed? Intermediate
30-second answer

By default, all Pods can reach each other. Once a policy selects a Pod in a direction (Ingress or Egress), that direction switches to default deny plus an allow list. Multiple policies combine as a union (they only allow; there is no deny). Prerequisite: the CNI must implement NetworkPolicy (kindnet v0.24+, Calico, Cilium, Azure NPM/Cilium, VPC CNI network policy). Otherwise the object exists but has no effect.

Deeper answer
  • Selectors: podSelector, namespaceSelector (AND/OR pitfalls in #25), ipBlock (for CIDRs outside the cluster, not for Pod IPs).
  • ports refers to the target Pod's ports; endPort port ranges are supported since v1.25.
  • The standard policy has no L7 rules, no FQDN rules, no explicit deny, and no cluster-wide policies. When you need these, use CNI extensions (CiliumNetworkPolicy, Calico GlobalNetworkPolicy) or AdminNetworkPolicy (a SIG Network project; check the official docs for its current stage).
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: {name: default-deny, namespace: shop}
spec: {podSelector: {}, policyTypes: [Ingress, Egress]}
Common follow-up questions
  • Do I need to allow return traffic? No. Policies are stateful.
  • How do you test it? With a connectivity matrix (what should and should not be reachable).
Bonus points

Rollout order: default-deny first, then allow-dns (#17). It complements zero trust and service mesh mTLS.

Common wrong answers

"Write a deny rule to block a certain IP." Standard NetworkPolicy has no deny.

See Hour 3: NetworkPolicy.

Interview whiteboard diagram: scheduling framework (Q19, Q20) Scheduling queueSorted by priority Filter (feasibility)NodeResourcesFit · TaintTolerationNodeAffinity · VolumeBinding Score (preference)BalancedAllocation · PodTopologySpreadImageLocality · InterPodAffinity BindWrite spec.nodeName No feasible node → PostFilter preemptionStill no fit → Pending (#1–#4) Hard constraints go in Filter, soft constraints in Score; taints repel, affinity attracts
Figure 6-1 Filter → Score → Bind
Interview whiteboard diagram: ClusterIP data path (Q22) Client Podconnect 10.96.142.17:80 Node kernel nftables/iptablesDNAT → 10.244.2.4:9898conntrack records the connection Backend Podready=true EndpointSlice controllerselector → ready Pod IP kube-proxy (on each node)watch → write kernel rules kube-proxy is not on the data path: it only writes rules, and the kernel does the forwarding. ipvs mode was deprecated in v1.37; nftables is recommended.
Figure 6-2 The control plane (EndpointSlice + kube-proxy) and the data plane (kernel DNAT) are separate

Scenario question 6-1: design a production workload setup for the shop application

api (stateless, up to 20 replicas at peak), db (PostgreSQL), nightly backups, and a log agent; 3 availability zones. Give the controller, resources, probes, distribution and disruption policy for each component.

Key points of a reference answer
  • api: Deployment + HPA (min 3 / max 20) + zone topology spread with DoNotSchedule + PDB maxUnavailable 1 + startup/readiness/liveness probes + preStop; set requests based on load tests, set a memory limit, and leave the CPU limit unset or set it moderately.
  • db: prefer a managed database (Azure Database for PostgreSQL / RDS); inside the cluster, use an Operator (CloudNativePG) to manage a StatefulSet, with replicas across zones, synchronous replication and backups.
  • Backups: CronJob (timeZone, concurrencyPolicy: Forbid, alert on lastSuccessfulTime).
  • Log agent: DaemonSet, tolerates all taints, PriorityClass set to system-node-critical or another high priority.

Scenario question 6-2: uneven load on a gRPC service

orders has 6 replicas: 2 run at 90% CPU and the rest at 10%. The client calls it through a ClusterIP using gRPC. Why does this happen? How do you fix it?

Key points of a reference answer
  • Cause: ClusterIP balances per connection, and gRPC multiplexes requests over a few long-lived HTTP/2 connections.
  • Fix: client-side load balancing (headless Service + gRPC round_robin + periodic connection rebuilds); or an L7 proxy (Gateway GRPCRoute, a service mesh) for per-request balancing; set MaxConnectionAge on the server to make clients reconnect.

Teaching videos (oEmbed verified)

▶
Kubernetes StatefulSet simply explained | Deployment vs StatefulSet — TechWorld with Nana
English · Q17
▶
Kubernetes Services explained | ClusterIP vs NodePort vs LoadBalancer vs Headless Service — TechWorld with Nana
English · Q10, Q22
▶
Kubernetes kube-proxy Modes: iptables and ipvs, Deep Dive — The Learning Channel
English · Q22 (ipvs deprecated in v1.37)
▶
Gateway API Explained: The Future of Kubernetes Networking — KodeKloud
English · Q24
▶
Kubernetes Network Policies Explained — DevOps & AI Toolkit
English · Q25

Storyboard example for a "2-minute answer to Q22":

Shot 1 (0:00–0:30) Draw the Service, EndpointSlice and Pods. Narration: "A ClusterIP is a virtual IP, and the EndpointSlice records the Pods that are ready behind it."
Shot 2 (0:30–1:10) Draw kube-proxy writing rules, kernel DNAT and conntrack. Narration: "kube-proxy only writes the rules, the kernel forwards the traffic, and conntrack keeps each connection on the same backend."
Shot 3 (1:10–1:40) Compare iptables, nftables and ipvs. Narration: "Since v1.37, nftables is recommended and ipvs is deprecated."
Shot 4 (1:40–2:00) Diagram of a long-lived connection. Narration: "With per-connection balancing, gRPC needs client-side load balancing or a Layer 7 proxy."

Official docs

or a quiz score ≥ 70%

Module 7 · Part B: Storage, Security and Multi-tenancy (interview questions 26–38)

44:00 – 52:00 · PV/PVC/StorageClass, access modes, CSI, running databases on K8s, Secrets, authentication/authorization/admission, RBAC, Workload Identity, PSS, securityContext, admission policies, multi-tenancy, supply chain
8 minCSI · RBAC · PSA · VAP13 questions
Learning goals
  • Explain the full dynamic provisioning process and the trade-offs of running stateful applications on K8s.
  • Answer any security question with the layered framework of "authentication → authorization → admission → runtime", and back it up with concrete YAML and commands.
  • Design a soft multi-tenancy and supply chain security plan, and name the matching implementations on AKS/EKS.
Prerequisites: hours 4 and 5.

Browse the questions and what they test; click to jump to the full answer.

Q26. How are PV, PVC and StorageClass related? How does dynamic provisioning work? Beginner
30-second answer

A PVC is a claim (size, access mode, class); a PV is the actual volume; a StorageClass defines how PVs are created dynamically (provisioner, parameters, reclaim policy, binding mode, whether expansion is allowed). The flow: PVC → (with WaitForFirstConsumer, wait for Pod scheduling) → external-provisioner calls CSI CreateVolume → the PV is created and bound → attach → mount.

Deeper answer
  • WaitForFirstConsumer creates the volume in the Pod's zone, avoiding the topology conflicts in #4; it should be the default on cloud platforms.
  • PV and PVC have a one-to-one relationship; static provisioning requires matching capacity, modes and class.
  • v1.37 Beta: PVC last-used timestamp, which helps find idle volumes.
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata: {name: premium-zrs}
provisioner: disk.csi.azure.com
parameters: {skuName: Premium_ZRS}
reclaimPolicy: Retain
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true

For skuName and regional support, see the Azure Disk CSI docs.

Common follow-up questions
  • How do you troubleshoot a Pending PVC? See #26.
  • Does deleting a PVC lose data? It depends on reclaimPolicy (Delete/Retain).
Bonus points

Name the component responsible for each of the four stages: provisioning, binding, attaching and mounting.

Common wrong answers

"PVs belong to a namespace." PVs are cluster-scoped; only PVCs are namespaced.

See Hour 4: PV · PVC · StorageClass.

Q27. What are the differences between the access modes RWO, ROX, RWX and RWOP? When should you use the Delete and Retain reclaim policies? Beginner
30-second answer

RWO: read-write by a single node (Pods on the same node can share it); ROX: read-only across multiple nodes; RWX: read-write across multiple nodes (file storage such as Azure Files, EFS, NFS); RWOP: read-write by a single Pod (GA in v1.29, CSI volumes). Delete: deleting the PVC deletes the underlying volume (data can be rebuilt); Retain: keeps the volume and requires manual cleanup (recommended for production databases).

Deeper answer
  • Block storage (Azure Disk, EBS) usually supports only RWO/RWOP. Moving between nodes requires detach/attach, which can trigger Multi-Attach errors (#27).
  • RWX has different performance and consistency semantics than local disks, so databases should not run on NFS/SMB.
  • For an existing PV, you can run kubectl patch pv … persistentVolumeReclaimPolicy: Retain.
Common follow-up questions
  • Risk of a Deployment using an RWO volume? During a rolling update, the old and new Pods can land on different nodes and the rollout gets stuck; switch to Recreate or use a StatefulSet.
Bonus points

Access modes are a capability declaration plus a scheduling constraint; only RWOP guarantees a single Pod.

Common wrong answers

"RWO means only one Pod can use it."

See Hour 4: Access Modes · Reclaim Policies · Topology.

Q28. What is CSI? What components make up a CSI driver? Intermediate
30-second answer

Container Storage Interface is the standard gRPC interface between storage and orchestrators. Drivers ship independently of the Kubernetes core code (the in-tree cloud disk plugins have moved to CSI). Controller plugin (Deployment: CreateVolume, ControllerPublish = attach, snapshots, expansion) + Node plugin (DaemonSet: NodeStage/NodePublish = formatting and mounting), with sidecars: external-provisioner/attacher/resizer/snapshotter, node-driver-registrar, livenessprobe.

Deeper answer
kubectl get csidrivers ; kubectl get csinodes
kubectl -n kube-system get pods -l app=csi-azuredisk-controller -o jsonpath='{.items[0].spec.containers[*].name}'
kubectl get volumeattachment
  • Snapshots: VolumeSnapshotClass / VolumeSnapshot / VolumeSnapshotContent (snapshot.storage.k8s.io/v1).
  • The Secrets Store CSI Driver mounts keys from Key Vault or Secrets Manager as files.
Common follow-up questions
  • Where do you check logs for a FailedMount? The CSI node plugin logs on the node, plus the kubelet logs.
Bonus points

Map the four stages to CSI RPCs.

Common wrong answers

"CSI is a StorageClass."

See Hour 4: CSI Architecture and Azure Disk.

Q29. Should databases run on Kubernetes? If so, what should you consider? How do you back them up and restore them? Advanced
30-second answer

It depends on your team's skills and requirements. Managed databases (Azure Database for PostgreSQL, RDS/Aurora) hand backups, patching and HA to the cloud provider, so they are usually the default. Running in the cluster can make sense when you need portability, cost control or specific extensions, but use a mature Operator (CloudNativePG and similar) and do not hand-write a StatefulSet.

Deeper answer
  • Consider: storage performance (IOPS/latency, zone redundancy), replication and failover, backups (WAL archiving + base backups to object storage, PITR), upgrades, isolation (Guaranteed QoS, dedicated node pools), PDBs, and monitoring.
  • Application-consistent backups (pg_dump/WAL) take priority over volume snapshots; use Velero for resources and volumes; run regular restore drills to measure RTO/RPO.
kubectl cnpg status shop-db -n shop        # CloudNativePG plugin example (must be installed)
velero backup create shop-$(date +%F) --include-namespaces shop --snapshot-volumes
Common follow-up questions
  • What happens when a node fails? The Operator promotes a replica to primary; re-attaching the volume is affected by Multi-Attach timeouts (#27).
Bonus points

Give a decision matrix (skills, SLA, cost, compliance, data volume) instead of a yes-or-no answer.

Common wrong answers

"Having a PVC means you have backups."

See Hour 4: StatefulSet + PostgreSQL in Practice, Backup and Restore (Velero).

Q30. What is the difference between ConfigMap and Secret? Is Secret secure? How do you manage secrets in production? Intermediate
30-second answer

They have a similar structure. A Secret has its own RBAC, can be encrypted at rest in etcd, and kubelet mounts it on tmpfs. By default, though, it is only base64-encoded, so anyone who can read Secrets, or create Pods in that namespace, can get the values. In production: encrypt with KMS, use minimal RBAC, keep the source of secrets outside the cluster (Key Vault / Secrets Manager), sync them with External Secrets Operator or the Secrets Store CSI Driver, and authenticate workloads with Workload Identity / Pod Identity.

Deeper answer
  • GitOps should not store plaintext: use SOPS (age/KMS), Sealed Secrets, or store only ExternalSecret references.
  • Rotation: update the value externally → sync the Secret → reload the app (file mounts can update in place, but environment variables need a restart; #30).
  • v1.37 GA: ClusterTrustBundles and Pod Certificates, which issue short-lived certificates to Pods (mTLS).
Common follow-up questions
  • Secret leaked? Rotate first, then clean up (#31).
  • Immutable Secret? Prevents accidental changes and reduces kubelet watch load.
Bonus points

Point out the commonly overlooked fact that "being able to create a Pod means being able to read all Secrets in that namespace."

Common wrong answers

"Secrets are encrypted."

See Hour 2: ConfigMap and Secret, Hour 5: Secret Security and External Secrets.

Q31. What are authentication, authorization and admission control in Kubernetes? How do users differ from ServiceAccounts? Beginner
30-second answer

Authentication (who you are): X.509 certificates, OIDC tokens (Entra ID, IAM via an exec plugin), ServiceAccount tokens, webhooks; failures return 401. Authorization (what you can do): RBAC, the Node authorizer, webhooks (such as AKS Azure RBAC); failures return 403. Admission (whether a request complies or needs changes): mutating and validating phases, including PSA, Quota, VAP/MAP and webhooks. Kubernetes has no "user object": human users come from an external identity system; a ServiceAccount is an API object for workloads.

Deeper answer
kubectl auth whoami
kubectl auth can-i create deployments -n shop --as=alice@contoso.com --as-group=shop-devs
  • AKS: Entra ID + kubelogin; authorization uses Kubernetes RBAC or Azure RBAC.
  • EKS: IAM identities are mapped to Kubernetes users/groups through access entries, plus access policies or RBAC.
Common follow-up questions
  • 401 vs 403? See #45 and #32.
Bonus points

Draw the request pipeline (Figure 3-2) and explain where the error appears when admission rejects an object created by a controller.

Common wrong answers

"Create a user with kubectl create user."

See Hour 5: Authentication and RBAC Authorization.

Q32. Explain RBAC: how Role, ClusterRole, RoleBinding and ClusterRoleBinding combine, and least-privilege practices. Intermediate
30-second answer

A Role (within a namespace) and a ClusterRole (cluster-wide or reusable) define "which verbs on which resources." A RoleBinding grants access only within one namespace (it can reference a ClusterRole for reuse); a ClusterRoleBinding applies across the whole cluster. RBAC only allows and never denies, and permissions are combined as a union.

Deeper answer
  • Least privilege: prefer RoleBinding; avoid *; watch out for secrets get/list, pods/exec, creating Pods, escalate/bind/impersonate, changing RBAC, and nodes/proxy.
  • Aggregated ClusterRole (aggregationRule): CRD permissions are merged automatically into the built-in admin/edit/view roles.
  • Grant access by group, and audit regularly.
kubectl create rolebinding shop-devs-edit -n shop --clusterrole=edit --group=shop-devs
kubectl auth can-i --list -n shop --as=x --as-group=shop-devs | head
Common follow-up questions
  • Why is list secrets dangerous? It returns the full contents.
Bonus points

RBAC prevents privilege escalation: you cannot grant permissions you do not have, unless you have escalate or bind.

Common wrong answers

"Giving the CI service account cluster-admin is the easiest option."

See Hour 5: Authorization RBAC.

Q33. How can a Pod securely access cloud resources (Key Vault, S3)? How do AKS Workload Identity and EKS Pod Identity / IRSA work? Intermediate
30-second answer

Do not put cloud credentials in a Secret. Instead, exchange the projected ServiceAccount token for short-lived cloud credentials. AKS Workload Identity: the cluster OIDC issuer plus a federated credential on an Entra managed identity (subject = system:serviceaccount:ns:sa); the SDK uses the token to get an Entra token. EKS IRSA: an IAM OIDC provider plus a role trust policy. EKS Pod Identity: the Pod Identity Agent plus an association in the EKS API, with no per-cluster OIDC trust configuration needed.

Deeper answer
# AKS
apiVersion: v1
kind: ServiceAccount
metadata:
  name: api
  namespace: shop
  annotations: {azure.workload.identity/client-id: "00000000-0000-0000-0000-000000000000"}
---
# The Pod template needs the label: azure.workload.identity/use: "true"
# EKS Pod Identity
aws eks create-pod-identity-association --cluster-name eks-lab --namespace shop --service-account api \
  --role-arn arn:aws:iam::111122223333:role/shop-api
Common follow-up questions
  • Common errors? AADSTS70021 (subject mismatch), AssumeRoleWithWebIdentity AccessDenied (#35).
  • Use the node identity directly? Not recommended: every Pod on the node shares that identity, which breaks least privilege.
Bonus points

Compare IRSA and Pod Identity (limits on OIDC providers, cross-account access, session tags).

Common wrong answers

"Storing an access key in a Secret and rotating it regularly is enough."

See Hour 5: ServiceAccount and Workload Identity, Hour 7: Pod Identity / IRSA.

Q34. What are the three Pod Security Standards levels? How do you roll out Pod Security Admission? Intermediate
30-second answer

Privileged (no restrictions), Baseline (blocks known privilege escalations: hostNetwork, privileged, hostPath and so on), Restricted (non-root, no privilege escalation, drop ALL, seccomp RuntimeDefault). PSA (GA in v1.25, replacing the removed PSP) applies these through namespace labels in enforce, audit and warn modes.

Deeper answer
kubectl label ns shop \
  pod-security.kubernetes.io/enforce=baseline pod-security.kubernetes.io/enforce-version=v1.37 \
  pod-security.kubernetes.io/warn=restricted pod-security.kubernetes.io/audit=restricted
kubectl label --dry-run=server --overwrite ns shop pod-security.kubernetes.io/enforce=restricted
  • Rollout: set warn+audit restricted on all namespaces → fix violations → move to enforce gradually; exempt system namespaces or set them to privileged.
  • For finer-grained rules (image sources, labels, required resources), use VAP, Kyverno or Gatekeeper.
Common follow-up questions
  • A Deployment shows 0/N with no error? See #33.
Bonus points

Pin enforce-version so that a standards change during an upgrade does not cause rejections.

Common wrong answers

"Implement it with PodSecurityPolicy." PSP was removed in v1.25.

See Hour 5: Pod Security Standards.

Q35. How do you harden a container? What are the most important fields in securityContext? Intermediate
30-second answer

runAsNonRoot: true + a fixed runAsUser, allowPrivilegeEscalation: false, capabilities.drop: [ALL] (add back NET_BIND_SERVICE if needed), readOnlyRootFilesystem: true (use emptyDir for writable directories), seccompProfile: RuntimeDefault; avoid privileged, hostPath and hostNetwork; keep images minimal (distroless) and scan them regularly.

Deeper answer
  • Turn off ServiceAccount token auto-mounting when it is not needed (automountServiceAccountToken: false).
  • User namespaces (hostUsers: false) map container root to an unprivileged user on the host.
  • v1.37: SELinuxMount is enabled by default; use securityContext.appArmorProfile for AppArmor (GA in v1.30).
  • Runtime detection: Falco / Defender for Containers / GuardDuty EKS Runtime Monitoring.
Common follow-up questions
  • Errors caused by a read-only root filesystem? Mount emptyDir volumes for /tmp and cache directories.
Bonus points

Map each hardening item to the matching PSA restricted check.

Common wrong answers

"Containers are naturally isolated, so running as root is fine."

See Hour 5: securityContext and Container Hardening.

Q36. What are the ways to implement admission control? How do you choose between ValidatingAdmissionPolicy, webhooks and Kyverno/Gatekeeper? Advanced
30-second answer

Built-in plugins (NamespaceLifecycle, LimitRanger, ResourceQuota, PodSecurity, ...); ValidatingAdmissionPolicy (CEL, in-process, GA in v1.30) and MutatingAdmissionPolicy; dynamic webhooks (the most flexible, but they carry availability risk, #34); Kyverno and Gatekeeper are webhook-based policy engines that come with policy libraries, reports, mutation and generation. Use VAP for simple validation and a policy engine for complex cases.

Deeper answer
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingAdmissionPolicy
metadata: {name: require-requests}
spec:
  failurePolicy: Fail
  matchConstraints:
    resourceRules: [{apiGroups: ["apps"], apiVersions: ["v1"], operations: ["CREATE","UPDATE"], resources: ["deployments"]}]
  validations:
  - expression: "object.spec.template.spec.containers.all(c, has(c.resources.requests) && has(c.resources.requests.cpu))"
    message: "All containers must set CPU requests"
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingAdmissionPolicyBinding
metadata: {name: require-requests}
spec: {policyName: require-requests, validationActions: [Deny]}

The && operator in CEL is written directly as && in YAML (shown here HTML-escaped).

  • v1.37 Beta: manifest-based admission control, which loads policies from local files on the apiserver. Policies still take effect even if the policy objects in etcd are deleted (suitable for platform baselines).
  • Webhooks: run multiple replicas, exclude system namespaces, use short timeouts, and choose failurePolicy carefully.
Common follow-up questions
  • Observe without blocking first? VAP validationActions: [Warn, Audit]; Kyverno Audit mode.
Bonus points

Test and release "policy as code" (in CI: kyverno test / gator verify / kubectl --dry-run=server).

Common wrong answers

"A failed webhook automatically lets requests through." It depends on failurePolicy.

See Hour 5: Admission Control: VAP · MAP · Webhooks.

Q37. How do you support multiple teams in one cluster (multi-tenancy)? What is the difference between soft and hard multi-tenancy? Advanced
30-second answer

Soft multi-tenancy (teams trust each other to a degree): a namespace per team + RBAC group grants + ResourceQuota/LimitRange + NetworkPolicy default-deny + PSA + admission policies + cost labels, and dedicated node pools when needed (taints/affinity). Hard multi-tenancy (untrusted tenants): control-plane-level isolation: separate clusters, virtual control planes (such as vCluster), or sandboxed runtimes (Kata, gVisor) with node isolation.

Deeper answer
  • Tenant self-service: templates (Helm/Kustomize/Crossplane/Capsule and similar) that create a namespace and baseline policies in one step.
  • Shared risks: CRDs and cluster-scoped resources cannot be isolated per namespace; the kernel is shared; DNS and apiserver capacity are shared (use APF to set priorities for tenants).
  • Cost allocation: namespace labels + Kubecost/OpenCost, or AKS cost analysis or EKS split cost allocation.
Common follow-up questions
  • When should you split clusters? For compliance boundaries, blast radius, different upgrade cadences or regions, or when tenants do not trust each other.
Bonus points

Give a "cluster vs namespace" decision matrix and the platform's "golden path."

Common wrong answers

"A namespace is tenant isolation."

See Hour 5: Multi-tenancy: Quota · LimitRange · Auditing.

Q38. How do you ensure that images running in the cluster are trustworthy? Discuss container supply chain security. Advanced
30-second answer

Controlled base images → CI builds, generates an SBOM, scans for vulnerabilities, and signs (Sigstore cosign / Notation) with provenance attestation (SLSA provenance) → push to a private registry (ACR/ECR) and keep scanning → admission checks signatures, registry allow lists, bans latest, and requires digests → runtime detection and fast rebuild and patching.

Deeper answer
  • Admission verification: Kyverno verifyImages, Ratify + Gatekeeper (AKS image integrity), Sigstore policy-controller.
  • Deploy by digest to prevent tags from being overwritten; use workload or node identity for pull credentials instead of static passwords.
  • Base image updates automatically trigger rebuilds and releases (Renovate/Dependabot).
cosign sign --yes acrlab.azurecr.io/shop/api@sha256:…
cosign verify acrlab.azurecr.io/shop/api@sha256:… --certificate-identity-regexp '.*' --certificate-oidc-issuer https://token.actions.githubusercontent.com
Common follow-up questions
  • The scan finds 300 CVEs? Rank them by exploitability and whether they are on the running path, and fix the base image first; distroless reduces the attack surface.
Bonus points

An SBOM supports incident response (for example, quickly finding affected images in a log4j-style event).

Common wrong answers

"Using official images makes you secure."

See Hour 5: Admission Control, Docker course: Image Security.

Interview whiteboard diagram: four layers of defense in depth (Q31–Q38) ① IdentityEntra ID / IAM (people)ServiceAccount (workloads)Workload Identity / Pod IdentityShort-lived tokens, OIDC ② AuthorizationRBAC least privilegeGroup grants, no wildcardsAudit dangerous verbssecrets / exec / bind ③ AdmissionPSA restrictedVAP (CEL) / KyvernoImage signature verificationQuota / LimitRange ④ RuntimesecurityContext hardeningNetworkPolicy default-denyExternalized Secrets + KMSAudit logs + runtime detection Any security question can be answered with these four layers: who is accessing → what they are allowed to do → whether what they submit complies → how to limit and detect anomalies once it is running
Figure 7-1 Security answer framework
Workload Identity token exchange (Q33) Pod (SA: api)Projected token (rotated by kubelet) Entra ID / AWS STSCheck issuer + subject Cluster OIDC issuerPublish JWKS public keys Key Vault / S3Short-lived access token The subject in the federated credential / trust policy must be system:serviceaccount:shop:api
Figure 7-2 No long-term keys are stored in the cluster

Scenario question 7-1: a security audit finds 12 high-risk issues

Audit findings: the CI service account is cluster-admin; several Pods run as root and privileged; Secrets are stored in plaintext in Git; there is no NetworkPolicy; images use latest. Provide a 90-day remediation roadmap.

Key points of a reference answer
  • Weeks 1–2 (stop the bleeding): rotate and remove secrets leaked in Git; move CI to OIDC with namespace-level least privilege; turn on audit logging.
  • Weeks 3–6: PSA warn/audit restricted in all namespaces; fix privileged workloads; switch images to digests and use VAP to ban latest.
  • Weeks 7–10: default-deny + allow-dns + allow rules by dependency; External Secrets + Key Vault; KMS encryption.
  • Weeks 11–13: enforce restricted; signature verification; runtime detection; turn the baseline into a platform template and run continuous compliance scans.

Scenario question 7-2: choosing storage for stateful services

On AKS you need to run PostgreSQL (500 GB, RPO 5 minutes), a shared upload directory (read-write by multiple web replicas), and a Redis cache. Choose a storage option for each.

Key points of a reference answer
  • PostgreSQL: first choice is Azure Database for PostgreSQL Flexible Server (PITR, zone-redundant HA); inside the cluster, use CloudNativePG + Premium SSD/ZRS + WAL archiving to Blob to meet the RPO.
  • Shared directory: RWX (Azure Files Premium / NFS); better still, write directly to Blob (make the app stateless).
  • Redis cache: data can be lost → emptyDir or Azure Cache for Redis; if you need persistence, use a managed service.

Scenario question 7-3: one team's Pods exhaust cluster resources

Several teams share one cluster. A batch job from one team leaves other teams' Pods Pending, nodes scale up repeatedly, and the bill doubles. How do you prevent this?

Key points of a reference answer
  • ResourceQuota and LimitRange defaults per namespace; PriorityClass so that online services come first and batch jobs can be preempted.
  • A dedicated node pool for batch work (taints + Spot/low-priority VMs) with an upper limit (Karpenter/CA limits).
  • Make costs visible: allocate them per namespace and alert on them; admission requires requests and team labels.

Teaching videos (oEmbed verified)

▶
Kubernetes Volumes explained | Persistent Volume, Persistent Volume Claim & Storage Class — TechWorld with Nana
English · Q26, Q27 · duration/date not verified
▶
Project Lightning Talk: CloudNativePG: Running Postgres The Kubernetes Way - Gabriele Bartolini — CNCF [Cloud Native Computing Foundation]
English · Q29
▶
Kubernetes Security Best Practices you need to know | THE Guide for securing your K8s cluster! — TechWorld with Nana
English · Q30–Q38
▶
Azure AD Workload Identity on AKS | KubeCon 2022 — Microsoft Azure
English · Q33

Storyboard example for a "2-minute answer to Q37":

Shot 1 (0:00–0:30) Draw a spectrum from "same team" to "tenants that do not trust each other." Narration: "Start by asking how much trust there is; that decides how strong the isolation must be."
Shot 2 (0:30–1:10) List the namespace baseline: RBAC, quotas, defaults, default deny, Pod security, admission. Narration: "Soft multi-tenancy relies on a namespace baseline that is applied automatically."
Shot 3 (1:10–1:40) Draw separate clusters and virtual control planes. Narration: "Untrusted tenants need control-plane and kernel-level isolation."
Shot 4 (1:40–2:00) Cost allocation dashboard. Narration: "Cost visibility decides whether multi-tenancy can be run over the long term."

Official docs

or a quiz score ≥ 70%

Module 8 · Part B: Production Operations, Cloud Platforms and Scenario Design (interview questions 39–50)

52:00 – 60:00 · Scaling systems, observability, upgrade strategy, Helm/Kustomize, GitOps, AKS vs EKS, high availability, cost, disaster recovery, end-to-end design, incident postmortems, troubleshooting methodology
8 minAKS · EKS · GitOps12 questions · includes open-ended ones
Learning goals
  • When answering questions about production experience, give specific tools, numbers and trade-offs, not just lists of concepts.
  • Compare AKS and EKS, and give practical plans for upgrades, GitOps, disaster recovery and cost.
  • Use STAR (Situation, Task, Action, Result) to describe an incident postmortem, and answer open-ended troubleshooting and design questions with a structured approach.
Prerequisites: hours 6 and 7, plus Part A of this hour.

Browse the questions and what they test; click to jump to the full answer. Q48–Q50 are open-ended, so outline your answer on paper first.

Q39. What problems do HPA, VPA, Cluster Autoscaler, Karpenter and KEDA each solve? How do they work together? Intermediate
30-second answer

HPA adjusts the replica count; VPA adjusts requests/limits (as recommendations or automatically); Cluster Autoscaler adds node groups when Pods are Pending for resources, and scales down at low utilization; Karpenter does not depend on fixed node groups, and launches nodes by choosing instance types based on Pod needs (common on EKS; AKS Node Auto Provisioning is based on it); KEDA drives HPA from event sources (such as queue length) and can scale to zero.

Deeper answer
  • Chain: load rises → HPA adds replicas → Pods Pending → CA/Karpenter adds nodes → scheduling. Latency = metric collection + HPA period + node startup + image pull.
  • v1.37: HPA scale-to-zero Beta is enabled by default (it needs external or object metrics to wake up); configurable tolerance is GA.
  • Do not apply HPA and VPA to the same workload on CPU/memory at the same time; run VPA in Off mode to get requests recommendations.
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata: {name: api}
spec:
  scaleTargetRef: {apiVersion: apps/v1, kind: Deployment, name: api}
  minReplicas: 3
  maxReplicas: 20
  metrics: [{type: Resource, resource: {name: cpu, target: {type: Utilization, averageUtilization: 70}}}]
  behavior:
    scaleDown: {stabilizationWindowSeconds: 300}
Common follow-up questions
  • HPA does not scale? See #12; for nodes that do not scale, see #46.
Bonus points

Predictive scaling and warm-up, overprovisioning placeholder Pods, handling Spot interruptions.

Common wrong answers

"HPA automatically adds nodes."

See Hour 6: Autoscaling, Hour 7: Karpenter.

Q40. How do you build observability for a Kubernetes cluster and its applications? What are the key metrics? Intermediate
30-second answer

Three pillars plus events: metrics (Prometheus / Azure or Amazon Managed Prometheus + Grafana), logs (node agents collect stdout into Log Analytics / CloudWatch / Loki), traces (OpenTelemetry), plus Kubernetes events and audit logs. Drive alerts from SLOs (error rate, latency) instead of alerting on every individual metric.

Deeper answer
  • Cluster: node CPU/memory/disk/conntrack, Pod restarts and OOMs, Pending count, apiserver latency and 5xx, etcd size, CoreDNS error rate.
  • Workloads: RED (Rate, Errors, Duration), USE (Utilization, Saturation, Errors), CPU throttling.
  • Sources: kube-state-metrics (object state), cAdvisor/kubelet (container resources), node-exporter, application /metrics (podinfo exposes its own).
sum(rate(http_requests_total{namespace="shop",status=~"5.."}[5m])) / sum(rate(http_requests_total{namespace="shop"}[5m]))
increase(kube_pod_container_status_restarts_total{namespace="shop"}[1h]) > 3
kube_pod_container_status_last_terminated_reason{reason="OOMKilled"} == 1
Common follow-up questions
  • Alert fatigue? Use SLO error-budget burn-rate alerts; symptom-based alerts take priority over cause-based ones.
  • Logs too expensive? Sample them, keep them in tiers, and collect only the namespaces you need.
Bonus points

kubectl debug ephemeral containers, and Hubble/Retina for network observability; observability is the data foundation for Q50 troubleshooting.

Common wrong answers

"Installing Prometheus means you have observability."

See Hour 6: Observability and kubectl debug.

Q41. How would you plan and carry out a Kubernetes version upgrade for a production cluster? Intermediate
30-second answer

Preparation (release notes, scanning for deprecated APIs, a plugin compatibility matrix, PDB/webhook/quota checks, backups) → rehearse in non-production → control plane (one minor version at a time) → add-ons → node pools (rolling surge, or blue-green migration to a new node pool) → verification (SLOs, smoke tests) → postmortem review. The community supports each minor version for about 14 months, and managed platforms publish their own calendars.

Deeper answer
  • In-place rolling upgrade vs blue-green clusters: the latter has the lowest risk (a new cluster + GitOps replay + DNS/traffic cutover), but requires state migration and double the cost.
  • AKS: auto-upgrade channels + planned maintenance windows, max surge 33%, drain timeout, soak time; in 1.37, watch out for LocalDNS. EKS: insights → control plane → managed add-ons → node groups/Karpenter drift.
  • v1.37 notes: kube-proxy ipvs and kube-dns are deprecated; cgroup v1 has been rejected by default since v1.35.
az aks get-upgrades -g rg-k8s-lab -n aks-lab -o table
aws eks list-insights --cluster-name eks-lab --filter kubernetesVersions=1.37
Common follow-up questions
  • How do you roll back a failed upgrade? The control plane usually cannot be downgraded (EKS's rollback capability has time windows and prerequisites); you can switch workloads back to the old node pool; so rehearsals and blue-green are more important.
Bonus points

Combine Part A #41–#50 to talk about upgrade pitfalls you have actually hit.

Common wrong answers

"Jump two versions at once." The control plane can only be upgraded one minor version at a time.

See Hour 6: Cluster Upgrades and Maintenance, Hour 7: Upgrades and Operations.

Q42. What is the difference between Helm and Kustomize? What is each one best suited for? Beginner
30-second answer

Helm is a package manager: Go templates + values, versioned charts, release history and rollback, and dependency management; it suits distributing third-party software. Kustomize is template-free overlays (base + overlays + patches), built into kubectl (kubectl apply -k), and suits per-environment differences. A common combination: Helm for third-party components and Kustomize for your own applications, or Kustomize rendering a Helm chart and then applying patches.

Deeper answer
  • Helm 4 (released 2025-11, current 4.3.x); the last feature release of Helm 3 is 3.22, with security fixes until 2027-02-10.
  • Helm risks: templates are hard to review, release records keep removed APIs (#42), and without --history-max Secrets pile up (#44).
  • For both, render in CI and run kubectl diff / policy checks.
helm upgrade --install api ./chart -n shop -f values-prod.yaml --atomic --history-max 10
kubectl kustomize overlays/prod | kubectl diff -f -
Common follow-up questions
  • Which one for GitOps? Argo CD and Flux both support both.
Bonus points

configMapGenerator hash suffixes and the Helm checksum annotation solve config hot-reload (#30).

Common wrong answers

"Kustomize replaces Helm, so pick one."

See Hour 6: Overview of the Delivery Toolchain, Helm course.

Q43. What is GitOps? How do Argo CD and Flux work? What problems does it solve, and what problems does it create? Intermediate
30-second answer

Git is the single source of truth for the desired state. An in-cluster agent (Argo CD, Flux) pulls from Git, compares it with the actual state, and keeps reconciling. Changes go through PRs, so they are auditable and easy to roll back (git revert). Compared with CI pushing changes, cluster credentials are not exposed externally, and drift is corrected automatically.

Deeper answer
  • Separate the application repository (code + images) from the environment repository (manifests). CI only builds images and updates image tags in the environment repository (or uses Image Updater / Flux image automation).
  • Argo CD: Application / ApplicationSet, sync waves, health checks, auto-sync + self-heal + prune; Flux: GitRepository/OCIRepository + Kustomization/HelmRelease.
  • Challenges: secrets (SOPS/ESO), multi-cluster expansion, emergency fixes (break-glass, then write the change back to Git), performance with many applications, and permissions (AppProject).
argocd app get shop-prod ; argocd app diff shop-prod
flux get kustomizations -A ; flux reconcile kustomization shop-prod --with-source
Common follow-up questions
  • What about a manual kubectl edit? With self-heal on, the change is reverted: that is the value of drift prevention.
Bonus points

Use GitOps for cluster blue-green upgrades (a new cluster points at the same repository) and for disaster recovery rebuilds.

Common wrong answers

"GitOps just means putting YAML in Git."

See Hour 6: Overview of the Delivery Toolchain, GitOps and Argo CD course.

Q44. What are the key differences between AKS and EKS? If you had to choose, what would you consider? Intermediate
30-second answer

Both offer a managed control plane and upstream-conformant Kubernetes. The differences are in identity, networking, node management, billing and ecosystem integration. The choice usually follows the organization's main cloud and identity system.

Deeper answer
DimensionAKSEKS
Control plane billingFree / Standard / Premium tiers (different SLAs and LTS)Billed per cluster-hour; extended support costs extra
Identity (people)Entra ID + kubelogin, K8s RBAC or Azure RBACIAM + access entries + access policies/RBAC
Identity (Pods)Workload Identity (federated credentials)Pod Identity / IRSA
NetworkingAzure CNI Overlay / Pod subnet / powered by Cilium; kubenet is being phased outVPC CNI (Pods use VPC IPs), prefix delegation, custom networking
NodesVMSS node pools, system/user pools, Node Auto Provisioning, auto-upgrade channelsManaged node groups, Fargate, Karpenter, Auto Mode
IngressApplication Gateway for Containers and othersAWS Load Balancer Controller (ALB/NLB)
Upgrade toolsUpgrade readiness checks, planned maintenanceCluster insights, managed add-ons

Features, SKUs and pricing change quickly; check learn.microsoft.com and docs.aws.amazon.com for the latest.

Common follow-up questions
  • Use the same setup across multiple clouds? Unify the upper layers (GitOps, policy, observability) and accept differences in the lower layers (identity, networking).
Bonus points

Share pitfalls you have hit: an AKS PDB blocking an upgrade (#49), EKS IP exhaustion (#48), EKS access entries (#45).

Common wrong answers

Comparing only prices and ignoring the cost of identity and networking integration.

See Hour 6: Managed Cluster Comparison, AKS course, Hour 7: EKS Architecture and Selection.

Q45. How do you design a highly available Kubernetes platform (at the cluster level and the regional level)? Advanced
30-second answer

Application layer (multiple replicas, topology spread, PDBs, probes, graceful termination) → cluster layer (control-plane SLA tier, node pools spread across 3 availability zones, an isolated system pool, high availability for CoreDNS, ingress and key add-ons) → regional layer (multi-region clusters + global traffic: Azure Front Door / Traffic Manager, Route 53; cross-region data replication). Verify each layer with failure drills.

Deeper answer
  • Active-active vs active-passive depends on consistency needs and cost: stateless services run active-active; databases are usually primary-standby.
  • Multi-cluster: GitOps (ApplicationSet generates per cluster), unified policy and observability, certificate and secret sync.
  • Dependencies must also be highly available: image registries (geo-replication), DNS, secret services, CI.
Common follow-up questions
  • What if one availability zone goes down? Nodes become NotReady → after 5 minutes, Pods are rescheduled to other zones (headroom required) → volumes bound to that zone become unavailable (#4).
Bonus points

Start with quantified targets (SLO 99.95%, RTO/RPO) before choosing an architecture, instead of "the more the better."

Common wrong answers

"A managed control plane is automatically highly available." You are still responsible for workload and node distribution.

See Hour 6: Managed Cluster Comparison, AKS course.

Q46. Where would you start with Kubernetes cost optimization? Intermediate
30-second answer

Make costs visible first (allocate them by namespace/team), then optimize: right-sizing (bring requests close to actual use; VPA recommendations) → bin packing (VM sizes, Karpenter consolidation, CA scale-down settings) → purchasing (Spot/low-priority for interruptible workloads, reserved instances/savings plans) → idle cleanup (scale non-production to zero overnight, remove idle PVCs and load balancers, log retention) → network costs (cross-zone/cross-region traffic, NAT gateways).

Deeper answer
  • Two ratios: requests utilization (requests/allocatable) and actual utilization (usage/requests).
  • v1.37 Beta: PVC last-used timestamps to find idle volumes; HPA scale-to-zero suits event-driven services.
  • Spot: use PDBs, several instance types, and handle interruption notices (Karpenter / node termination handler).
kubectl top pods -A --sort-by=cpu | head
kubectl get pvc -A -o custom-columns=NS:.metadata.namespace,NAME:.metadata.name,SIZE:.spec.resources.requests.storage
Common follow-up questions
  • Team won't lower requests? Use data + a pilot + LimitRange caps + a cost feedback mechanism.
Bonus points

Give concrete numbers (for example, "nodes went from 40 to 26, monthly cost down 30%").

Common wrong answers

"Switch everything to Spot."

See Hour 6: Autoscaling, Hour 7: Autoscaling and Cost.

Q47. How do you do disaster recovery for Kubernetes? What needs to be backed up? How do you guarantee RPO/RTO? Advanced
30-second answer

Three categories: cluster configuration and resources (the GitOps repository is the best backup; Velero adds resource backups), persistent data (application-consistent database backups or replication + volume snapshots, stored across regions), and external dependencies (secrets, certificates, DNS, image registries, IAM/identity, managed with IaC). Self-managed clusters also need etcd snapshots. Verify RTO/RPO with regular recovery drills.

Deeper answer
  • Recovery runbook: create the cluster with IaC → install platform components → GitOps syncs applications → restore data → switch traffic → verify.
  • Velero: velero schedule create daily --schedule="0 3 * * *" --include-namespaces shop --ttl 720h; CSI snapshots are only usable within the same region, so cross-region recovery requires migration or replication.
  • AKS has Azure Backup for AKS; EKS can use AWS Backup.
Common follow-up questions
  • Most common reasons DR fails? Never rehearsed, inconsistent backups, and dependencies (DNS, secrets) left out of scope.
Bonus points

Distinguish high availability (preventing failures) from disaster recovery (recovering after a failure), and give drill frequency and metrics.

Common wrong answers

"We have etcd snapshots." You cannot access etcd on managed clusters, and snapshots do not include volume data.

See Hour 4: Backup and Restore (Velero), Hour 6: Overview of the Delivery Toolchain, GitOps and Argo CD course.

Q48. (Open-ended) Design an end-to-end production deployment plan for the shop application, from code to users. Advanced
30-second answer

Walk through it in order: code → image → delivery → runtime → observability → security. GitHub Actions builds and signs the image and pushes it to ACR/ECR → GitOps (Argo CD) syncs Helm/Kustomize to AKS/EKS → Gateway API entry + WAF → api Deployment (HPA, topology spread, PDB) → managed PostgreSQL → Workload Identity to access Key Vault → Prometheus/Grafana/OTel + SLO alerts → PSA restricted, NetworkPolicy, VAP.

Deeper answer (answer structure)
  1. Requirements: QPS, SLOs, data volume, compliance, team size, budget, regions.
  2. Cluster: separate production and non-production; 3 zones; system pool + user pool (+ a Spot pool for batch work); Azure CNI Overlay / VPC CNI with prefix delegation; private API endpoint.
  3. Delivery: trunk-based development → PR checks (tests, scanning, rendering + policy checks) → write digests to the environment repository → canary (HTTPRoute weights + automated analysis).
  4. Runtime: resources and probes, graceful termination, PDBs, HPA + node scaling.
  5. Data: managed database HA + PITR; managed cache.
  6. Security: the four-layer framework (Figure 7-1).
  7. Operations: observability, runbooks (Part A), upgrade calendar, DR drills, cost dashboard.
Common follow-up questions
  • Budget cut in half? Merge non-production into one cluster with multiple namespaces, use Spot, shut down environments overnight, and replace some components with managed PaaS services.
Bonus points

Talk through trade-offs and an evolution path (MVP → scale), and draw a diagram.

Common wrong answers

Just listing tool names without clarifying requirements or discussing trade-offs.

See Hour 6, Hour 7, and all modules in this course.

Q49. (Open-ended) Describe a production incident you handled, and how you ran the postmortem. Advanced
30-second answer

STAR: Situation (scope of impact, duration, business loss) → Task (your role) → Action (in timeline order: detection, stopping the bleeding, diagnosis, fix) → Result (recovery time, improvements and metrics). Run blameless postmortems focused on systems and processes, and give each improvement item an owner and a due date.

Deeper answer (example: combining #34 + #41)
  • Situation: early on a Sunday, AKS auto-upgraded the user node pool; from 04:10, order failures on shop reached 35% and lasted 48 minutes.
  • Action: an SLO burn-rate alert → new Pods could not be created, with failed calling webhook … context deadline exceeded → the webhook had only 1 replica, was on a node being drained, and a PDB blocked eviction → temporarily changed failurePolicy to Ignore to stop the bleeding → business recovered → fixed the webhook and reverted the configuration.
  • Root cause: a single-replica policy webhook + a rule that matched its own namespace + an unattended auto-upgrade window.
  • Improvements: 3 webhook replicas + PDB + exclude system namespaces; move simple rules to VAP; move the maintenance window to working hours and add pre-upgrade checks; add a "Pod creation failure rate" alert; run drills.
  • Metrics: MTTD 6 minutes, MTTR 48 minutes → target MTTR < 15 minutes.
Common follow-up questions
  • Would it be faster next time? Talk about runbook and alert improvements.
  • How do you keep postmortems from becoming a formality? Track improvement items and the completion rate in quarterly reviews.
Bonus points

Quantify the impact and the improvements; show communication (status page, stakeholder updates).

Common wrong answers

Blaming individuals ("a colleague made a mistake") or only describing technical details without the outcome.

See Part A #34, #41, #49 in this hour and Hour 6: Production Troubleshooting Decision Tree.

Q50. (Open-ended) Users report that "the site is slow / occasionally errors." How would you systematically troubleshoot a service running on Kubernetes? Advanced
30-second answer

First confirm the scope and timeline (SLO dashboard: which service, which requests, when it started, whether it is related to a change), then work from the outside in: entry point (DNS/CDN/LB/Gateway) → Service/endpoints → Pods (restarts, OOMs, probes, CPU throttling) → nodes (pressure, conntrack, network) → dependencies (database, cache, external APIs, DNS) → platform (apiserver, autoscaling, cloud events). Stop the bleeding first (roll back, scale out, shift traffic), then find the root cause.

Deeper answer
# 1. Recent changes
kubectl rollout history deploy/api -n shop ; argocd app history shop-prod
# 2. Workload status
kubectl get pods -n shop -o wide ; kubectl get events -n shop --sort-by=.lastTimestamp | tail -20
kubectl top pods -n shop --containers
# 3. Endpoints and entry point
kubectl get endpointslices -n shop -l kubernetes.io/service-name=api
kubectl get httproute -n shop -o yaml | grep -A4 conditions
# 4. Nodes and dependencies
kubectl describe node NODE | grep -A5 Conditions
kubectl exec deploy/api -n shop -- nslookup db.data.svc.cluster.local
  • For "intermittent" issues, suspect first: rolling-update races (#24), DNS ndots/conntrack (#16/#23), CPU throttling, bad nodes, uneven gRPC load, HPA flapping.
  • Use traces to find which hop is slow; use kubectl debug ephemeral containers to capture packets or measure latency.
Common follow-up questions
  • Only one Pod is slow? Remove it from the Service by changing its labels to keep the evidence (Q8), then compare it with other nodes.
Bonus points

Say "stop the bleeding first, then the root cause," "a change is the first suspect," and "use data, not guesses," and map each point to the question numbers in Part A.

Common wrong answers

Restarting or scaling out right away, without preserving evidence or confirming the scope of impact.

See Hour 6: Production Troubleshooting Decision Tree, Hour 3: Network Troubleshooting.

Interview whiteboard diagram: from code to users (Q43, Q48) Application repositoryPR + tests CIBuild · scan · sign ACR / ECRImage digest Environment repositoryHelm/Kustomize AKS / EKS clustersArgo CD pulls and reconcilesAdmission: PSA · VAP · signature verificationGateway → api (HPA/PDB)Workload Identity → Key VaultManaged PostgreSQL pull Cross-cutting concernsObservability: Prometheus · Grafana · OTel · logs · SLO alertsOperations: upgrade calendar · Velero/DR drills · cost dashboard · runbooks (50 Part A cases)IaC: Terraform manages clusters, networking, identity and role assignments
Figure 8-1 End-to-end delivery and runtime
Troubleshooting method (Q50): stop the bleeding first, then work from the outside in 1 Scope of impactSLOs · timeline · changes 2 Stop the bleedingRoll back · scale out · shift traffic 3 Locate by layerEntry → endpoints → Pod → node 4 Root cause and fixEvidence-driven 5 Postmortem and preventionImprovement items · alerts · drills The first suspect is a change; preserve the evidence (labels, debug containers, log snapshots); use the 50 Part A cases as a layered checklist
Figure 8-2 Five-step troubleshooting method

Scenario question 8-1: from a single cluster to multiple regions

shop is expanding to North America and Europe. A single-region failure must be recovered within 30 minutes (RTO 30 minutes, RPO 5 minutes), and EU data residency must be met. Give the architecture.

Key points of a reference answer
  • Each geographic region gets its own cluster (Canada Central + a European region), with a GitOps ApplicationSet for unified rollout; European user data stays in Europe (data partitioning, not global replication).
  • Primary and standby regions within the same geography: cross-region read replicas or geo-replication for the database to meet the RPO of 5 minutes; a hot-standby cluster in the standby region (small scale + autoscaling).
  • Global traffic: Azure Front Door / Route 53 health checks to switch traffic; rehearse the failover and measure the RTO.
  • Geo-replicate the image registry; secrets and certificates are independent per region.

Scenario question 8-2: the platform team's first quarter

You are the new platform lead, taking over 6 manually created AKS/EKS clusters on different versions (1.34–1.36). What do you do in the first quarter?

Key points of a reference answer
  • Month 1: inventory (versions, add-ons, workloads, permissions, costs); 1.34 is already EOL, so upgrade first; set up an upgrade calendar and checklist (Part A #41–#50).
  • Month 2: put clusters under IaC (Terraform), have GitOps take over platform components, unify observability and alerting, and consolidate access (Entra/IAM groups).
  • Month 3: security baseline (PSA, NetworkPolicy, VAP), a cost dashboard, DR drills; publish a "golden path" template to application teams.

Scenario question 8-3: emergency fixes under GitOps

At night, the production api has a memory leak. You need to raise the memory limit and restart right away, but Argo CD has self-heal on, so manual changes get reverted. What do you do?

Key points of a reference answer
  • Preferred: a fast-track PR (pre-agreed emergency approval); after merging, run argocd app sync, which takes effect within minutes.
  • Break-glass: temporarily turn off automatic sync for this application (record it in the audit log), stop the bleeding manually, and afterward write the change back to Git and re-enable automatic sync.
  • Postmortem: the root cause of the leak, alert thresholds, and whether an in-place resize process is needed.

Teaching videos (oEmbed verified)

▶
What is GitOps, How GitOps works and Why it's so useful — TechWorld with Nana
English · Q43 · duration/date not verified
▶
ArgoCD Tutorial for Beginners | GitOps CD for Kubernetes — TechWorld with Nana
English · Q43
▶
What is Helm in Kubernetes? Helm and Helm Charts explained | Kubernetes Tutorial 23 — TechWorld with Nana
English · Q42 (video is based on Helm 3)
▶
How Prometheus Monitoring works | Prometheus Architecture explained — TechWorld with Nana
English · Q40

No verified video on "AKS vs EKS comparison" or "Kubernetes interview" topics was found. Storyboard example for a "3-minute answer to Q49 (incident postmortem)":

Shot 1 (0:00–0:30) Caption: the situation. Narration: "At 4:10 on a Sunday morning, the order failure rate hit thirty-five percent and lasted forty-eight minutes."
Shot 2 (0:30–1:30) Timeline animation: alert → webhook timeout found → failurePolicy changed temporarily → recovery. Narration: "We stopped the bleeding before looking for the root cause, and every step was logged in the incident channel."
Shot 3 (1:30–2:30) Root-cause fishbone diagram: a single-replica webhook, matching its own namespace, an unattended upgrade window. Narration: "The root cause is in the system, not in a person."
Shot 4 (2:30–3:00) Improvement table and MTTR target. Narration: "Every improvement item has an owner, a due date and a way to verify it."

Official docs

or a quiz score ≥ 70%

Question cheat sheet + interview flashcards

50 "error → first diagnostic command → common fix" entries · 50 key-point cards · printable
After classSearchable · printable

A · Quick reference for 50 production problems

Type a keyword to filter (for example Pending, OOM, DNS, 403, PDB, EKS). Click a number to jump to its detailed explanation.

B · Flashcards for 50 interview questions

Try to recall first, then expand to check the one-line key point. For details, see “Interview question details” in this module.

General command cards

Pods and events

kubectl get pods -A --field-selector=status.phase!=Running,status.phase!=Succeeded
kubectl get events -A --field-selector type=Warning --sort-by=.lastTimestamp
kubectl describe pod POD -n NS
kubectl logs POD -c C --previous
kubectl get pod POD -o jsonpath='{.status.containerStatuses[*].lastState}'
kubectl debug POD -it --copy-to=dbg --container=C -- sh

Scheduling and nodes

kubectl describe nodes | grep -A8 'Allocated resources'
kubectl get nodes -o custom-columns=N:.metadata.name,T:.spec.taints
kubectl get nodes -L topology.kubernetes.io/zone
kubectl top nodes ; kubectl top pods -A --sort-by=memory
kubectl cordon N ; kubectl drain N --ignore-daemonsets --delete-emptydir-data
kubectl get pdb -A

Networking and DNS

kubectl get svc,endpointslices -n NS
kubectl get endpointslices -l kubernetes.io/service-name=SVC -o wide
kubectl exec POD -- cat /etc/resolv.conf
kubectl run t --rm -it --restart=Never --image=nicolaka/netshoot -- bash
kubectl get networkpolicy -A
kubectl get httproute -A -o wide

Storage

kubectl get sc ; kubectl get pvc,pv -A
kubectl describe pvc PVC -n NS
kubectl get volumeattachment
kubectl get csidrivers ; kubectl get csinodes
kubectl patch pvc PVC -p '{"spec":{"resources":{"requests":{"storage":"64Gi"}}}}'

Security

kubectl auth whoami
kubectl auth can-i VERB RESOURCE -n NS --as=system:serviceaccount:NS:SA
kubectl auth can-i --list -n NS --as=...
kubectl get ns --show-labels | grep pod-security
kubectl describe rs -l app=APP | grep FailedCreate
kubectl get validatingwebhookconfigurations,validatingadmissionpolicies

Controllers and rollouts

kubectl rollout status deploy/D --timeout=5m
kubectl rollout history deploy/D ; kubectl rollout undo deploy/D
kubectl get rs -l app=APP
kubectl describe hpa H
kubectl get jobs,cronjobs ; kubectl create job --from=cronjob/CJ manual-1
kubectl describe resourcequota -n NS

Control plane check

kubectl get --raw='/readyz?verbose'
kubectl get apiservice | grep -v True
kubectl get --raw /metrics | grep apiserver_requested_deprecated_apis
kubeadm certs check-expiration
etcdctl endpoint status -w table
kubectl get lease -n kube-system

AKS / EKS

az aks get-upgrades -g RG -n AKS -o table
az aks nodepool update -g RG --cluster-name AKS -n POOL --max-surge 33% --drain-timeout 45
az aks check-acr -g RG -n AKS --acr ACR.azurecr.io
aws eks list-insights --cluster-name EKS
aws eks list-access-entries --cluster-name EKS
kubectl set env ds aws-node -n kube-system ENABLE_PREFIX_DELEGATION=true

Quick troubleshooting table: STATUS → first step

When you seeFirst stepProblem numbers
Pendingdescribe pod: check FailedScheduling and read the rejection reasons one by one#1–#4, #26, #46
ContainerCreating for a long timeFailedMount / FailedAttachVolume / FailedCreatePodSandBox in events#27, #28, #48
ImagePullBackOffnot found / 401 / 429 / timeout in events#7, #37
CreateContainerConfigErrorWhether the referenced ConfigMap/Secret/key exists#8
CrashLoopBackOfflogs --previous + Exit Code#5, #6, #9
Running 0/1Unhealthy event (readiness)#9, #13
Deployment shows 0/N with no Podsdescribe rs → FailedCreate#33, #34, #36
EvictedNode Conditions (DiskPressure/MemoryPressure)#40, #6
Node NotReadyReason in describe node Conditions#39, #43, #47
kubectl 401 / 403kubectl auth whoami / auth can-i#45 / #32

Recommended config snippet: production Deployment baseline

spec:
  replicas: 3
  strategy: {rollingUpdate: {maxUnavailable: 0, maxSurge: 25%}}
  template:
    spec:
      automountServiceAccountToken: false
      terminationGracePeriodSeconds: 45
      securityContext: {runAsNonRoot: true, seccompProfile: {type: RuntimeDefault}}
      topologySpreadConstraints:
      - {maxSkew: 1, topologyKey: topology.kubernetes.io/zone, whenUnsatisfiable: DoNotSchedule, labelSelector: {matchLabels: {app: api}}}
      containers:
      - name: api
        image: ghcr.io/stefanprodan/podinfo:6.17.0
        ports: [{name: http, containerPort: 9898}]
        resources: {requests: {cpu: 100m, memory: 64Mi}, limits: {memory: 128Mi}}
        startupProbe:  {httpGet: {path: /healthz, port: http}, failureThreshold: 30, periodSeconds: 5}
        readinessProbe: {httpGet: {path: /readyz, port: http}, periodSeconds: 5}
        livenessProbe:  {httpGet: {path: /healthz, port: http}, periodSeconds: 10, timeoutSeconds: 3}
        lifecycle: {preStop: {sleep: {seconds: 10}}}
        securityContext: {allowPrivilegeEscalation: false, readOnlyRootFilesystem: true, capabilities: {drop: ["ALL"]}}

Capstone drill + mock interview

8 mixed failure scenarios (decide first, then expand the answers) · full mock interview with 10 questions drawn at random from 50 · final quiz with 12 questions
After class 30–60 minkind labFinal

1. Capstone failure drill (kind cluster lab)

Scenario: the shop app (web + api) has several overlapping failures after a “Friday release”. Create and fix them step by step on kind, and write down the first diagnostic command at each step.

Prepare the “bad version”: introduce three failures at once: a wrong image tag, a missing ConfigMap, and a wrong Service selector.
kubectl create ns final
kubectl create deploy web -n final --image=nginx:1.29-alpine --replicas=2
kubectl create deploy api -n final --image=ghcr.io/stefanprodan/podinfo:6.17.1-typo --replicas=2
kubectl create cm api-config -n final --from-literal=X=1
kubectl set env deploy/api -n final --from=configmap/api-config
kubectl delete cm api-config -n final
kubectl create service clusterip api -n final --tcp=80:9898
kubectl patch svc api -n final -p '{"spec":{"selector":{"app":"api-v2"}}}'
Observe and locate:
kubectl get pods -n final
kubectl get events -n final --field-selector type=Warning --sort-by=.lastTimestamp | tail
kubectl get endpointslices -n final
Reference diagnosis

ImagePullBackOff (#7, tag does not exist); after the image is fixed, CreateContainerConfigError appears (#8, ConfigMap missing); the Service has no endpoints (#13, wrong selector). Note that the faults surface in layers: you only see the next layer after fixing the one above it.

Fix layer by layer:
kubectl set image deploy/api -n final podinfo=ghcr.io/stefanprodan/podinfo:6.17.0
kubectl create cm api-config -n final --from-literal=X=1
kubectl patch svc api -n final -p '{"spec":{"selector":{"app":"api"}}}'
kubectl rollout status deploy/api -n final
Add a network policy fault (#17):
cat <<'EOF' | kubectl apply -n final -f -
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata: {name: default-deny}
spec: {podSelector: {}, policyTypes: [Ingress, Egress]}
EOF
kubectl exec -n final deploy/web -- wget -qO- -T 3 http://api/version || echo FAIL
Reference fix

Add allow-dns (the YAML from #17, with the namespace changed to final), allow egress from web → api:9898 and the matching ingress on api (note that ports is the container port 9898).

Resource and rollout faults (#1, #10):
kubectl patch deploy api -n final -p '{"spec":{"progressDeadlineSeconds":30}}'
kubectl set resources deploy/api -n final --requests=cpu=64
kubectl rollout status deploy/api -n final --timeout=60s || kubectl rollout undo deploy/api -n final
Maintenance fault (#41): add a PDB with minAvailable: 2 to api, drain the node it runs on, then observe and fix the problem (change maxUnavailable to 1 or scale out the replicas), and finally uncordon.
Cleanup: kubectl delete ns final; if any node is still cordoned: kubectl uncordon lab-worker lab-worker2.
Acceptance checklist

2. Mixed scenario judgment (no hands-on work, answer verbally)

Scenario 1: After upgrading the AKS node pool, some services are Pending, the events show had volume node affinity conflict, and the drain is stuck

#4 + #41/#49: the PV is in zone 1, and during the upgrade zone 1 only has the old node that was cordoned; a PDB with a budget of 0 blocks eviction. Fix: confirm that the surge node in zone 1 is available (quota, subnet IPs), correct the PDB, and temporarily scale out the zone 1 node pool if needed; long term, use WaitForFirstConsumer and keep spare nodes in every zone.

Scenario 2: After default-deny is enabled, the frontend returns 502, Prometheus scraping fails, and the backend reports lookup db: i/o timeout

#17 + #25: allow-dns is missing, there is no ingress from monitoring to the Pods, and cross-namespace api → db needs rules in both directions. Fill the gaps in the order DNS → ingress → east-west → monitoring, and write a connectivity test.

Scenario 3: On EKS, the newly added nodes are Ready, but new Pods are stuck in ContainerCreating, and node CPU usage is only 10%

#48: subnet IPs are exhausted (failed to assign an IP address). Short term: scale down extra replicas and clear pre-warmed IPs. Long term: prefix delegation (new node group), or a secondary CIDR with custom networking.

Scenario 4: On Monday morning, every kubectl command reports x509: certificate has expired, and the self-managed cluster has been running for 13 months

#43: the kubeadm certificates expired after 1 year. Run kubeadm certs renew all on each control plane node, restart the static Pods, and update the kubeconfig. Check kubelet client certificate rotation, upgrade every year, and set expiry alerts.

Scenario 5: After a release, the Deployment shows 0/3, and kubectl get pods shows nothing

#33/#34/#36: the error is in the ReplicaSet's FailedCreate event: PSA rejection, webhook timeout, or quota exceeded. Run kubectl describe rs -l app=….

Scenario 6: The HPA shows <unknown>/70%, the replica count does not change during a big sale, and OOMKilled failures keep happening one after another

#12 + #6: the new sidecar has no CPU requests, so the HPA cannot calculate utilization; with too few replicas, memory pressure on each Pod rises and they get OOM-killed. Add requests, pre-scale, raise the memory limit, and fix the memory usage.

Scenario 7: Every release causes about 0.5% of requests to return 502, lasting 5–10 seconds

#24: a race between termination and endpoint removal. Use a preStop sleep, graceful shutdown, maxUnavailable 0, and fail readiness at shutdown. Retry idempotent requests at the gateway.

Scenario 8: The namespace of an old app has been stuck in Terminating for two days, and the cloud bill shows unknown load balancers and disks

#38: the controller was uninstalled first, so nothing handles the finalizers on the custom resources. Restore the controller to finish the cleanup (or clean up the cloud resources by hand and then remove the finalizer). From now on, follow this order: delete the custom resources first, then the controller, and finally the namespace.

3. Open-ended self-check (6 questions)

1. In 60 seconds, explain which components a Pod goes through from apply to receiving traffic.

See Q4: apiserver (authentication/authorization/admission) → etcd → controllers → scheduler → kubelet → CRI/CNI/CSI → probes → EndpointSlice → kube-proxy/gateway.

2. Why are neither “CrashLoopBackOff” nor “ProgressDeadlineExceeded” the root cause?

Both are summary or result signals. The root cause is in the exit code and logs (#5), or in the Pods and events of the new ReplicaSet (#10).

3. Design a namespace “factory baseline” with at least 6 items.

RBAC group bindings, ResourceQuota, LimitRange, default-deny + allow-dns, PSA labels (enforce baseline / warn restricted), cost and owner labels, admission policy (requests required, latest tag forbidden).

4. Before upgrading to 1.37, which version-specific changes would you check?

ipvs mode deprecation, kube-dns deprecation, cgroup v1 (rejected by default since 1.35), use of deprecated APIs, TCP/UDP 53 for AKS LocalDNS and custom DNS, and compatible add-on versions.

5. Compare the configuration steps for AKS Workload Identity and EKS Pod Identity.

AKS: enable the OIDC issuer and Workload Identity → create a managed identity → federated credential (issuer + subject) → set the client-id annotation on the SA → add the Pod label. EKS Pod Identity: install the Pod Identity Agent add-on → IAM role (trusting pods.eks.amazonaws.com) → create-pod-identity-association (namespace + SA).

6. Write out your “five-step troubleshooting method” and give one example from this hour.

Blast radius → stop the bleeding → locate layer by layer → fix the root cause → review and prevent (Q50, figure 8-2). For example, scenario 5: roll back to stop the bleeding → find the PSA rejection in the RS events → fix the securityContext → add server-side dry-run to CI.

4. Full mock interview (10 questions drawn at random from 50)

2 minutes per question. At the end, the score for this round and the questions to review are shown. Cumulative mastery is tracked by module (stored in this browser).

5. Final quiz

Sources and versions

Version facts, sources of the exact error text, video verification, and known limitations
Verified on 2026-11-15

Version and fact sources

TopicVerified conclusionSource (accessed date)
Kubernetes supported branches1.37 (1.37.1, 2026-09-15, EOL 2027-10-28), 1.36, 1.35; 1.34 reached EOL on 2026-10-27; 1.38 planned for 2026-12kubernetes.io/releases (2026-11-15)
Changes in v1.37metrics.k8s.io GA, KYAML GA, SELinuxMount enabled by default, Storage Version Migrator GA, HPA tolerance GA; HPA scale-to-zero, MemoryQoS, Manifest-based admission, Gang scheduling, PVC last-used, and etcd RangeStream are Beta; StatefulSet Recreate is Alpha; ipvs and kube-dns are deprecatedv1.37 release blog (2026-08-26)
Earlier GA featuresNative sidecars v1.33, in-place resize v1.35, VAP v1.30, PSA v1.25, nftables v1.33; cgroup v1: since v1.35, failCgroupV1 defaults to trueOfficial release notes summarized in the course specification; kubernetes.io/docs
kindv0.33.0, default node image kindest/node:v1.37.0; kindnet supports NetworkPolicy since v0.24.0kind.sigs.k8s.io; Hour 3
Gateway API / ingress-nginxGateway API v1.6 (TCPRoute/UDPRoute moved to Standard); ingress-nginx archived on 2026-03-24, final version v1.15.1; ingress2gateway 1.0Gateway API v1.6 blog; Hour 3 sources table
HelmHelm 4 (2025-11), current 4.3.x; Helm 3.22 is the last feature release, with security fixes until 2027-02-10helm.sh; Hour 6
AKS node pool rolling upgrademax surge (33% recommended for production), drain timeout default 30 minutes (5 minutes–24 hours), soak 0–30 minutes; when the agent pool is ≥ 1.35, a failed surge can fall back to 1; upgrading a standard node pool to 1.37 may enable LocalDNS, so TCP/UDP 53 for custom DNS must be verifiedConfigure rolling upgrades for AKS node pools (2026-11-15, page updated 2026-09)
AKS UpgradeFailed (PDB)The original error text, the event Eviction blocked by Too Many Requests (usually a pdb), and re-upgrading the same version after the fixTroubleshoot UpgradeFailed errors due to PDBs (2026-11-15)
EKS cluster insightsTypes: configuration / upgrade / rollback readiness. The requirement that “upgrading when insights report problems needs --force” has been temporarily withdrawn. Rollback readiness insights showing ERROR/UNKNOWN block rollback (--force can override this).EKS cluster insights (2026-11-15)
EKS prefix delegationAssign IPs by prefix instead of individually to increase Pod density; creating a new node group is recommended over a rolling replacement; WARM_IP_TARGET / MINIMUM_IP_TARGET / WARM_PREFIX_TARGETAssign more IP addresses with prefixes (2026-11-15)
Original error textThe kubectl / kube-scheduler / kubelet / controller messages come from the Kubernetes source code and typical output in the official debugging docs. Wording may differ between versions, and this is marked where it applies.Monitoring, Logging, and Debugging

Video verification notes

All YouTube videos were verified on 2026-11-15 through the oEmbed endpoint (https://www.youtube.com/oembed?url=…&format=json) for titles and channels. oEmbed does not return duration or publish date, so the cards note “duration/date not verified”. Some videos predate v1.37 (for example, those covering ipvs or Helm 3), and the cards note the differences. No verified videos were found for “50 Kubernetes production troubleshooting cases”, “AKS vs EKS comparison”, or “Kubernetes interview”, so storyboard scripts are provided in their place.

Video IDTitleChannelWhere used
xjpHggHKm78Setting Resource Requests and Limits in KubernetesGoogle Cloud TechModule 1
mxEvAPQRwhwKubernetes Health Checks with Readiness and Liveness ProbesGoogle Cloud TechModule 1
azuwXALfyRgKubectl Basic Commands - Create and Debug Pod in a Minikube cluster | Kubernetes Tutorial 18TechWorld with NanaModule 1
-CQLSXpvM_QHow Kubernetes Services Really Work - iptables, kube-proxy, and Packet Flow ExplainedMattOps | DevOps & SREModule 2
0Omvgd7Hg1ILife of a Packet [I] - Michael Rubin, GoogleCNCFModule 2
bfUzLOFwns8Scale the Internet with DNS: A CoreDNS Deep Dive - Yong Tang, IvantiCNCFModule 2
Fr-6oDHbobMKubernetes Network Policy Deep DiveKubesimplifyModule 2
hqkPbW9RfD8The Kubernetes Gateway API: ConceptsGoogle Open SourceModule 2
0swOh5C3OVMKubernetes Volumes explained | Persistent Volume, Persistent Volume Claim & Storage ClassTechWorld with NanaModules 3, 7
FAnQTgr04mUKubernetes ConfigMap and Secret as Kubernetes Volumes | DemoTechWorld with NanaModule 3
oBf5lrmquYIKubernetes Security Best Practices you need to know | THE Guide for securing your K8s cluster!TechWorld with NanaModules 3, 7
5WUP8KAzwCoAzure AD Workload Identity on AKS | KubeCon 2022Microsoft AzureModules 3, 7
90kZRyPcRZwKubernetes Deconstructed: Understanding Kubernetes by Breaking It Down - Carson Anderson, DOMOCNCFModules 4, 5
umXEmn3cMWYKubernetes Architecture explained | Kubernetes Tutorial 15TechWorld with NanaModules 4, 5
PziYflu8cB8Kubernetes Explained in 100 SecondsFireshipModule 5
BE77h7dmoQUKubernetes: The Documentary [PART 1]CultRepoModule 5
pPQKAR1pA9UKubernetes StatefulSet simply explained | Deployment vs StatefulSetTechWorld with NanaModule 6
T4Z7visMM4EKubernetes Services explained | ClusterIP vs NodePort vs LoadBalancer vs Headless ServiceTechWorld with NanaModule 6
lkXLsD6-4jAKubernetes kube-proxy Modes: iptables and ipvs, Deep DiveThe Learning ChannelModule 6
xaZ87iSvMAIGateway API Explained: The Future of Kubernetes NetworkingKodeKloudModule 6
18FEA5xXBGYKubernetes Network Policies ExplainedDevOps & AI ToolkitModule 6
pYwYwehQX3UProject Lightning Talk: CloudNativePG: Running Postgres The Kubernetes Way - Gabriele BartoliniCNCFModule 7
f5EpcWp0THwWhat is GitOps, How GitOps works and Why it's so usefulTechWorld with NanaModule 8
MeU5_k9ssrsArgoCD Tutorial for Beginners | GitOps CD for KubernetesTechWorld with NanaModule 8
-ykwb1d0DXUWhat is Helm in Kubernetes? Helm and Helm Charts explained | Kubernetes Tutorial 23TechWorld with NanaModule 8
h4Sl21AKiDgHow Prometheus Monitoring works | Prometheus Architecture explainedTechWorld with NanaModule 8

Voice narration notes

The “Voice” tab reads the narration script aloud with the browser's Web Speech API (speechSynthesis), using an en-US English voice. This courseware is a single offline file, so MP3s cannot be embedded or videos generated directly. The narration script and storyboard can be given to a TTS or video tool. If no en-US English voice is installed, the page shows how to install one.

Known limitations

  • The IPs, UIDs, hashes, times, node names, and AKS/EKS resource IDs in the expected output are sample values. The error texts are typical forms, and their wording varies with the Kubernetes, containerd, CSI driver, and cloud platform versions.
  • The reproduction lab commands are written for kind v0.33.0 + Kubernetes v1.37.0 and were not actually run when this courseware was produced. For the tags of third-party images (curlimages/curl, nicolaka/netshoot, polinux/stress, agnhost, pause), use the versions currently available in each repository.
  • The AKS / EKS problems (the cloud parts of #18, the cloud parts of #35, #37, #45, the cloud parts of #46, #48, #49, #50) only include explanations and commands and were not reproduced on a cloud. Cloud platform features, defaults, and prices change quickly, so use learn.microsoft.com and docs.aws.amazon.com as the reference.
  • The behavior of Beta/Alpha features (HPA scale-to-zero, MemoryQoS, Manifest-based admission, etc.) may change. For details such as the preStop sleep action, the ReferenceGrant API version, and the MutatingAdmissionPolicy stages, use the official docs.
  • For third-party tools (pluto, kubent, helm-mapkubeapis, Kyverno, CloudNativePG, Velero, cosign), use each project's current docs for commands.
  • Mock interview self-assessments and learning progress are stored in the browser's localStorage. Clearing browser data erases them, and private/incognito mode may not save them.