# CNCF Certified Kubernetes Administrator (CKA) & Application Developer (CKAD) — Cluster Architecture, Networking, Storage & Troubleshooting

> High-yield CKA and CKAD flashcards covering the 2-hour hands-on exam blueprint, kubeadm upgrades, etcd backup/restore, RBAC, Taints/Tolerations, NodeAffinity, TopologySpreadConstraints, PV/PVC/StorageClass, NetworkPolicies, Gateway API, Probes, SecurityContexts, Kustomize/Helm, and CLI troubleshooting.

- **Canonical URL:** https://flashcards.world/flashcards/sets/67fbf47a-72c4-44b5-ade7-ab37eba9d23f/
- **Markdown URL:** https://flashcards.world/flashcards/sets/67fbf47a-72c4-44b5-ade7-ab37eba9d23f.md
- **Category:** Multi-Cloud & DevOps Architecture — Microsoft Azure (AZ-104 & AZ-305), Google Cloud (PCA & PDE), Kubernetes (CKA / CKAD) & HashiCorp Terraform Associate
- **Level:** advanced
- **Languages:** en → en
- **Total Cards:** 32

## Flashcards (32 Cards)

| # | Front (Term / Prompt) | Back (Definition / Answer) | Example | Multiple-Choice Options |
| :--- | :--- | :--- | :--- | :--- |
| 1 | How do you safely drain a Kubernetes node for kernel maintenance on the CKA exam, and what flags are typically required? | Run `kubectl drain <node> --ignore-daemonsets --delete-emptydir-data` to cordon the node and evict Pods while respecting `PodDisruptionBudgets`, then `kubectl uncordon <node>` afterward. | Unlike `kubectl cordon` (which only marks the node `SchedulingDisabled` for new Pods), `kubectl drain` both cordons the node and evicts existing Pods so ReplicaSets reschedule them onto healthy nodes. | A) `kubectl cordon <node>` blocks new Pods only; `kubectl drain <node> --ignore-daemonsets --delete-emptydir-data` cordons AND evicts existing Pods; `kubectl uncordon <node>` restores scheduling.; B) Run `kubectl drain <node> --ignore-daemonsets --delete-emptydir-data` to cordon the node and evict Pods while respecting `PodDisruptionBudgets`, then `kubectl uncordon <node>` afterward. ✓; C) If a `PodDisruptionBudget` (`minAvailable` / `maxUnavailable`) would be violated, `kubectl drain` waits until enough replacement Pods become Ready. |
| 2 | How do `HorizontalPodAutoscaler` (HPA), `ResourceQuota`, and `LimitRange` work together in a multi-tenant Kubernetes namespace? | `ResourceQuota` caps aggregate namespace CPU/memory/objects; `LimitRange` injects default per-Pod requests/limits and min/max bounds; `HPA` scales replicas based on target utilization. | Once a `ResourceQuota` for `requests.cpu` or `limits.memory` is active in a namespace, every Pod created in that namespace MUST specify those resource values—or a `LimitRange` with defaults must exist. | A) ResourceQuota = namespace total cap; LimitRange = per-pod/container default/min/max bounds; HPA = scales replicas via `ceil[currentReplicas * (currentMetricValue / desiredMetricValue)]`.; B) `ResourceQuota` caps aggregate namespace CPU/memory/objects; `LimitRange` injects default per-Pod requests/limits and min/max bounds; `HPA` scales replicas based on target utilization. ✓; C) HPA requires the `metrics-server` deployment running in `kube-system` and `resources.requests` defined on the target Pods. |
| 3 | What fast imperative `kubectl` commands and flags save critical time on the CKA and CKAD exams? | Use `--dry-run=client -o yaml > file.yaml` with `kubectl run` and `kubectl create`, plus `kubectl explain <resource>.spec --recursive` for built-in schema documentation. | Running `kubectl create rolebinding dev-view --clusterrole=view --serviceaccount=dev:app-sa -n dev --dry-run=client -o yaml` generates error-free RBAC YAML in 3 seconds, and `kubectl replace --force -f pod.yaml` rapidly recreates an immutable Pod. | A) Use `--dry-run=client -o yaml > file.yaml` with `kubectl run` and `kubectl create`, plus `kubectl explain <resource>.spec --recursive` for built-in schema documentation. ✓; B) Combine `--dry-run=client -o yaml` to scaffold manifests, `kubectl explain pod.spec.securityContext` to check field names offline, and `-o jsonpath='{.items[*].metadata.name}'` for scripted queries.; C) `kubectl expose pod/deploy <name> --port=80 --target-port=8080 --name=<svc>` creates a matching Service selector automatically. |
| 4 | Compare the four Kubernetes PersistentVolume Access Modes (`ReadWriteOnce`, `ReadOnlyMany`, `ReadWriteMany`, `ReadWriteOncePod`) and the three Reclaim Policies (`Retain`, `Delete`, `Recycle`). | `RWO` mounts read-write on one node, `ROX` read-only on many, `RWX` read-write on many, `RWOP` on one Pod; `Retain` keeps volumes while `Delete` removes them. | Cloud block storage (AWS EBS, Azure Disk, GCP Persistent Disk) typically supports `ReadWriteOnce` (`RWO`) and `ReadWriteOncePod` (`RWOP`), whereas shared NFS/Azure Files/Filestore CSI drivers support `ReadWriteMany` (`RWX`). | A) `RWO` mounts read-write on one node, `ROX` read-only on many, `RWX` read-write on many, `RWOP` on one Pod; `Retain` keeps volumes while `Delete` removes them. ✓; B) Access Modes: RWO (1 node), ROX (N nodes read-only), RWX (N nodes read-write), RWOP (1 single pod); Reclaim Policies: Retain (manual cleanup) vs. Delete (dynamic CSI default).; C) If a PV is in `Released` state (`Retain` policy after PVC deletion), remove `spec.claimRef` to make it `Available` for re-binding. |
| 5 | What is the exact sequence of steps to upgrade a Kubernetes cluster by one minor version (e.g., 1.30 to 1.31) using `kubeadm`? | Drain control plane, upgrade `kubeadm`, run `kubeadm upgrade apply`, upgrade `kubelet`/`kubectl`, uncordon, then drain and upgrade workers using `kubeadm upgrade node`. | On the control plane, after `apt-get install -y --allow-change-held-packages kubeadm=1.31.x-*` and `kubeadm upgrade apply v1.31.x`, always run `systemctl daemon-reload && systemctl restart kubelet` after upgrading `kubelet`. | A) Control plane: drain -> upgrade kubeadm -> `kubeadm upgrade apply` -> upgrade kubelet/kubectl -> restart kubelet -> uncordon; Workers: drain -> upgrade kubeadm -> `kubeadm upgrade node` -> upgrade kubelet -> uncordon.; B) Never skip minor versions during a `kubeadm` upgrade (e.g., 1.29 -> 1.31 directly is unsupported).; C) Drain control plane, upgrade `kubeadm`, run `kubeadm upgrade apply`, upgrade `kubelet`/`kubectl`, uncordon, then drain and upgrade workers using `kubeadm upgrade node`. ✓ |
| 6 | How do you back up and restore an `etcd` cluster on the CKA exam using `etcdctl` and `etcdutl`? | Save with `ETCDCTL_API=3 etcdctl snapshot save <file>` passing `--endpoints`, `--cacert`, `--cert`, and `--key`; restore with `etcdutl snapshot restore <file> --data-dir=/var/lib/etcd-from-backup`. | After restoring the snapshot to a new directory `/var/lib/etcd-restore`, update the `hostPath.path` volume in `/etc/kubernetes/manifests/etcd.yaml` so the static etcd Pod mounts the restored data directory. | A) Save with `ETCDCTL_API=3 etcdctl snapshot save <file>` passing `--endpoints`, `--cacert`, `--cert`, and `--key`; restore with `etcdutl snapshot restore <file> --data-dir=/var/lib/etcd-from-backup`. ✓; B) Backup requires TLS flags (`--cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=... --key=...`); restore creates a clean `--data-dir` without needing TLS certificates.; C) Inspect `/etc/kubernetes/manifests/etcd.yaml` to copy the exact `--trusted-ca-file`, `--cert-file`, and `--key-file` paths. |
| 7 | In Kubernetes `nodeAffinity`, what is the difference between `requiredDuringSchedulingIgnoredDuringExecution` and `preferredDuringSchedulingIgnoredDuringExecution`? | `requiredDuringScheduling...` is a hard scheduling filter (Pod stays Pending without match); `preferredDuringScheduling...` scores nodes by weight (1–100); `IgnoredDuringExecution` never evicts running pods. | Note that Kubernetes 1.31+ also supports `requiredDuringSchedulingRequiredDuringExecution` (or taint `NoExecute`) when pods must be evicted if a node loses its required label. | A) Required = hard filter during scheduling; Preferred = soft weighted scoring during scheduling; IgnoredDuringExecution = no eviction after placement.; B) Multiple `nodeSelectorTerms` under `requiredDuringScheduling` are evaluated with logical OR, while multiple `matchExpressions` inside a single term use logical AND.; C) `requiredDuringScheduling...` is a hard scheduling filter (Pod stays Pending without match); `preferredDuringScheduling...` scores nodes by weight (1–100); `IgnoredDuringExecution` never evicts running pods. ✓ |
| 8 | How do Init Containers (`spec.initContainers`) and native Sidecar Containers (`initContainers` with `restartPolicy: Always` in K8s 1.28+) differ in Pod startup behavior? | Standard Init Containers run sequentially to completion before app containers start; an Init Container with `restartPolicy: Always` stays running alongside main containers. | An Envoy service-mesh proxy or log-shipping agent defined in `initContainers` with `restartPolicy: Always` is guaranteed to be ready before the main application container starts and terminates after main Jobs finish. | A) Standard Init Containers must exit 0 before the next init/app container starts; `restartPolicy: Always` creates a persistent native sidecar container.; B) Standard Init Containers run sequentially to completion before app containers start; an Init Container with `restartPolicy: Always` stays running alongside main containers. ✓; C) If any standard Init Container fails repeatedly, Kubernetes restarts the Pod according to `spec.restartPolicy`. |
| 9 | Why was `docker` (dockershim) removed from Kubernetes, and which CLI tool replaces `docker ps` / `docker logs` on nodes running `containerd` or `CRI-O` when `kube-apiserver` is down? | Kubernetes uses the Container Runtime Interface (`containerd` or `CRI-O`), and `crictl` (`crictl ps`, `crictl logs`) is the CRI CLI for debugging node containers. | When a syntax error in `/etc/kubernetes/manifests/kube-apiserver.yaml` crashes the API server so `kubectl` cannot connect, an administrator runs `crictl ps -a` and `crictl logs <container-id>` (or checks `/var/log/pods/`) on the control plane node. | A) Use `crictl ps -a` and `crictl logs <id>` (or inspect `/var/log/pods/` and `/var/log/containers/`) when `kube-apiserver` is unreachable.; B) `crictl` communicates with the CRI socket (`unix:///run/containerd/containerd.sock`) configured in `/etc/crictl.yaml`.; C) Kubernetes uses the Container Runtime Interface (`containerd` or `CRI-O`), and `crictl` (`crictl ps`, `crictl logs`) is the CRI CLI for debugging node containers. ✓ |
| 10 | When a Kubernetes worker node shows status `NotReady` in `kubectl get nodes`, what is the systematic CLI troubleshooting sequence? | Run `kubectl describe node <name>`, SSH to the node to check `systemctl status kubelet` and `journalctl -u kubelet -xe`, and verify `containerd` (`crictl ps`). | On the CKA exam, `NotReady` worker nodes are frequently caused by a stopped `kubelet` service (`systemctl enable --now kubelet`), a wrong binary path in `10-kubeadm.conf`, expired certs, or a stopped `containerd` daemon. | A) Run `kubectl describe node <name>`, SSH to the node to check `systemctl status kubelet` and `journalctl -u kubelet -xe`, and verify `containerd` (`crictl ps`). ✓; B) Check `kubectl describe node`, then on the node run `systemctl status kubelet`, `journalctl -u kubelet`, `systemctl status containerd`, and `df -h` / `free -m`.; C) If `kubelet` config (`/var/lib/kubelet/config.yaml`) or CA cert path is broken, `journalctl -u kubelet` reveals the exact syntax or file-not-found error. |
| 11 | Compare `DaemonSet` and `StatefulSet` in Kubernetes regarding Pod identity, scheduling, and storage. | `DaemonSet` runs one Pod per node (for CNI/CSI/logging agents); `StatefulSet` maintains sticky ordinal identities (`web-0`, `web-1`), ordered rollouts, and per-Pod `volumeClaimTemplates`. | Deleting `web-1` in a `StatefulSet` does not delete its dynamically provisioned PVC (`data-web-1`); when Kubernetes recreates `web-1`, it reattaches the exact same `data-web-1` volume. | A) `DaemonSet` runs one Pod per node (for CNI/CSI/logging agents); `StatefulSet` maintains sticky ordinal identities (`web-0`, `web-1`), ordered rollouts, and per-Pod `volumeClaimTemplates`. ✓; B) DaemonSet = 1 Pod per Node; StatefulSet = ordered ordinal naming (`0..N-1`), stable headless DNS, and per-replica `volumeClaimTemplates`.; C) StatefulSets require a Headless Service (`clusterIP: None`) specified in `spec.serviceName`. |
| 12 | How does the Kubernetes scheduler vs. the `kubelet` handle Pod `resources.requests` and `resources.limits` for CPU and Memory? | The scheduler uses `requests` to place Pods; `kubelet` enforces `limits` via cgroups by throttling CPU or `OOMKilling` (Exit Code 137) containers exceeding memory. | A Pod becomes `Guaranteed` QoS class only when every container sets both CPU and Memory `requests` and `limits` to identical values; `Burstable` has requests < limits; `BestEffort` has neither. | A) Requests = scheduling reservation; CPU Limit = compressible cgroup throttling; Memory Limit = incompressible (`OOMKilled` exit code 137 when exceeded).; B) The scheduler uses `requests` to place Pods; `kubelet` enforces `limits` via cgroups by throttling CPU or `OOMKilling` (Exit Code 137) containers exceeding memory. ✓; C) Three Pod QoS classes: `Guaranteed` (requests == limits for CPU & memory), `Burstable` (at least one request/limit set), and `BestEffort` (no requests or limits). |
| 13 | What is the Container Network Interface (CNI) in Kubernetes, where are CNI plugin binaries and configuration files located on Linux nodes, and what happens if no CNI plugin is installed? | CNI plugins (Calico, Cilium, Flannel) assign Pod IPs; configs live in `/etc/cni/net.d/` and binaries in `/opt/cni/bin/`; without CNI, nodes stay `NotReady`. | The Kubernetes networking model requires that every Pod can communicate with every other Pod on any node without NAT; installing Cilium or Calico creates the CNI config in `/etc/cni/net.d/` and transitions nodes to `Ready`. | A) CNI configs: `/etc/cni/net.d/`; CNI binaries: `/opt/cni/bin/`; Note that Flannel does not enforce Kubernetes `NetworkPolicy` resources, whereas Calico and Cilium do!; B) CNI plugins (Calico, Cilium, Flannel) assign Pod IPs; configs live in `/etc/cni/net.d/` and binaries in `/opt/cni/bin/`; without CNI, nodes stay `NotReady`. ✓; C) On the CKA exam, if asked to install a CNI that supports NetworkPolicy Enforcement, choose Calico or Cilium over pure Flannel. |
| 14 | In a Kubernetes `StorageClass`, why is `volumeBindingMode: WaitForFirstConsumer` strongly preferred over `Immediate` for zonal cloud block volumes? | `WaitForFirstConsumer` delays dynamic provisioning and binding of the PersistentVolume until a Pod using the PVC is scheduled onto a specific node and zone. | With `Immediate`, a zonal EBS/Persistent Disk might be provisioned in `zone-a` while the Pod's `nodeAffinity` or CPU capacity forces the Pod onto `zone-b`, leaving the Pod permanently stuck in `ContainerCreating`. | A) Prevents zone mismatch deadlocks by waiting for the scheduler to pick the Pod's target node before creating the zonal storage volume.; B) Setting `allowVolumeExpansion: true` on the StorageClass also enables online PVC resizing.; C) `WaitForFirstConsumer` delays dynamic provisioning and binding of the PersistentVolume until a Pod using the PVC is scheduled onto a specific node and zone. ✓ |
| 15 | In Kubernetes RBAC, what are the four matrix combinations of `Role`/`ClusterRole` and `RoleBinding`/`ClusterRoleBinding`, and what happens when a `RoleBinding` references a `ClusterRole`? | A `RoleBinding` referencing a `ClusterRole` reuses the cluster-wide role definition but restricts the granted permissions strictly to the `RoleBinding`'s single namespace. | Binding the built-in `view` or `admin` `ClusterRole` via a namespaced `RoleBinding` in `namespace: finance` grants read/admin access only inside `finance` without duplicating Role definitions across 50 namespaces. | A) Role + RoleBinding = single namespace; ClusterRole + ClusterRoleBinding = all namespaces + cluster-scoped resources; ClusterRole + RoleBinding = reusable role scoped to one namespace.; B) A `RoleBinding` referencing a `ClusterRole` reuses the cluster-wide role definition but restricts the granted permissions strictly to the `RoleBinding`'s single namespace. ✓; C) Verify any RBAC configuration immediately with `kubectl auth can-i <verb> <resource> --as=system:serviceaccount:<ns>:<sa> -n <ns>`. |
| 16 | What is the exam format, duration, passing score, and domain weight distribution of the CNCF Certified Kubernetes Administrator (CKA) exam? | A 2-hour performance-based hands-on CLI exam requiring a 66% passing score across five domains led by Troubleshooting (30%) and Cluster Architecture (25%). | Candidates solve 15–20 live tasks in a remote Linux terminal across Troubleshooting (30%), Cluster Architecture/Installation/Configuration (25%), Services & Networking (20%), Workloads & Scheduling (15%), and Storage (10%). | A) 120-minute hands-on terminal exam with 66% passing score; Troubleshooting (30%) is the heaviest domain.; B) CKAD is also 2 hours with a 66% passing score, focusing on Application Design/Build, Deployment, Observability, Environment/Security, and Services/Networking.; C) A 2-hour performance-based hands-on CLI exam requiring a 66% passing score across five domains led by Troubleshooting (30%) and Cluster Architecture (25%). ✓ |
| 17 | Compare the four Kubernetes Service types: `ClusterIP`, `NodePort`, `LoadBalancer`, and `ExternalName` (plus Headless Services `clusterIP: None`). | `ClusterIP` exposes an internal VIP; `NodePort` opens port 30000–32767 on nodes; `LoadBalancer` provisions a cloud LB; `Headless` (`clusterIP: None`) returns direct Pod DNS records. | StatefulSets require a Headless Service (`clusterIP: None`) so each Pod gets a deterministic, stable DNS record `<pod-name>.<service-name>.<namespace>.svc.cluster.local`. | A) ClusterIP = internal VIP; NodePort = ClusterIP + port 30000-32767 on nodes; LoadBalancer = NodePort + cloud LB; ExternalName = DNS CNAME alias.; B) Headless services skip `kube-proxy` VIP translation and return direct Pod IPs via CoreDNS.; C) `ClusterIP` exposes an internal VIP; `NodePort` opens port 30000–32767 on nodes; `LoadBalancer` provisions a cloud LB; `Headless` (`clusterIP: None`) returns direct Pod DNS records. ✓ |
| 18 | What are the three Pod Security Standards (PSS) profiles enforced by the built-in Pod Security Admission (PSA) controller via Namespace labels? | `privileged` (unrestricted), `baseline` (blocks hostNetwork/privileged pods), and `restricted` (hardened: requires `runAsNonRoot: true`, seccomp `RuntimeDefault`, and dropping `ALL` capabilities). | Labeling a namespace with `pod-security.kubernetes.io/enforce=restricted` and `pod-security.kubernetes.io/warn=restricted` immediately rejects any Pod admission request that omits `runAsNonRoot: true`. | A) Profiles: `privileged`, `baseline`, and `restricted`; Modes: `enforce` (rejects pod), `audit` (logs annotation), and `warn` (prints user warning).; B) `privileged` (unrestricted), `baseline` (blocks hostNetwork/privileged pods), and `restricted` (hardened: requires `runAsNonRoot: true`, seccomp `RuntimeDefault`, and dropping `ALL` capabilities). ✓; C) Replaced the removed `PodSecurityPolicy` (PSP) API starting in Kubernetes 1.25. |
| 19 | How do Kubernetes `NetworkPolicy` rules work by default, and what is the difference between stacked `to`/`from` array items vs. combined properties inside a single list item? | Pods allow all traffic until selected by a `NetworkPolicy`; separate `-` list items use OR logic, while properties inside one `-` item use AND logic. | Writing `- namespaceSelector: ...` followed on the next line (without a second `-`) by `podSelector: ...` allows traffic ONLY from matching Pods inside matching Namespaces (AND); adding a second `-` uses logical OR. | A) Single list item (`- namespaceSelector: ... \n podSelector: ...`) = logical AND; separate list items (`- namespaceSelector: ... \n - podSelector: ...`) = logical OR.; B) A default-deny-all policy uses `podSelector: {}` with `policyTypes: ["Ingress", "Egress"]` and no `ingress`/`egress` allow rules.; C) Pods allow all traffic until selected by a `NetworkPolicy`; separate `-` list items use OR logic, while properties inside one `-` item use AND logic. ✓ |
| 20 | Compare Kubernetes `Deployment` strategies (`RollingUpdate` vs. `Recreate`) and explain how `maxSurge` and `maxUnavailable` control rollout velocity. | `Recreate` kills all old Pods before creating new ones; `RollingUpdate` replaces Pods gradually using `maxSurge` (extra Pods allowed) and `maxUnavailable` (max unavailable Pods). | For a 4-replica Deployment with `maxSurge: 25%` (1 Pod) and `maxUnavailable: 25%` (1 Pod), Kubernetes immediately scales the new ReplicaSet to 2 Pods while terminating 1 old Pod, maintaining 3 available Pods. | A) Use `kubectl rollout status deploy/<name>`, `kubectl rollout history deploy/<name>`, and `kubectl rollout undo deploy/<name> --to-revision=N` to manage and revert rollouts.; B) `Recreate` kills all old Pods before creating new ones; `RollingUpdate` replaces Pods gradually using `maxSurge` (extra Pods allowed) and `maxUnavailable` (max unavailable Pods). ✓; C) Setting `maxSurge: 1` and `maxUnavailable: 0` ensures full capacity is maintained throughout the update by starting each new Pod before terminating an old one. |
| 21 | In a Kubernetes `Job` and `CronJob`, what do `completions`, `parallelism`, `backoffLimit`, `activeDeadlineSeconds`, and `concurrencyPolicy` control? | `completions` sets required successes; `parallelism` sets concurrent Pods; `backoffLimit` caps retries; `activeDeadlineSeconds` caps runtime; `concurrencyPolicy` (`Allow`/`Forbid`/`Replace`) governs overlapping CronJobs. | A `CronJob` running every 5 minutes (`*/5 * * * *`) with `concurrencyPolicy: Forbid` skips launching a new Job run if the previous Job is still actively executing. | A) CronJob `concurrencyPolicy` options: `Allow` (default, runs concurrently), `Forbid` (skips next run if current is still active), and `Replace` (cancels active run and starts new one).; B) `completions` sets required successes; `parallelism` sets concurrent Pods; `backoffLimit` caps retries; `activeDeadlineSeconds` caps runtime; `concurrencyPolicy` (`Allow`/`Forbid`/`Replace`) governs overlapping CronJobs. ✓; C) `ttlSecondsAfterFinished` automatically cleans up completed Jobs and their Pods after the specified TTL. |
| 22 | When applying a Default Deny Egress `NetworkPolicy` to a namespace, what critical rule must you remember to add so Pods can still resolve service names? | Explicitly allow Egress on UDP and TCP port 53 to `kube-system` (CoreDNS pods), or DNS resolution inside isolated Pods will fail completely. | Allow egress to `namespaceSelector: {matchLabels: {kubernetes.io/metadata.name: kube-system}}` and `podSelector: {matchLabels: {k8s-app: kube-dns}}` on `ports: [{protocol: UDP, port: 53}, {protocol: TCP, port: 53}]`. | A) Allow UDP/TCP port 53 egress to CoreDNS in the `kube-system` namespace.; B) Without port 53 egress allowed, Pods can reach raw IP addresses allowed by the policy but cannot resolve any DNS hostnames.; C) Explicitly allow Egress on UDP and TCP port 53 to `kube-system` (CoreDNS pods), or DNS resolution inside isolated Pods will fail completely. ✓ |
| 23 | Compare `Helm` and `Kustomize` for managing multi-environment Kubernetes manifests. | Helm is a package manager using Go templates (`Chart.yaml`, `values.yaml`) and release tracking; Kustomize (`kubectl -k`) uses template-free `base` and `overlays` patches. | To deploy a Kustomize staging overlay without modifying base YAML files, run `kubectl apply -k overlays/staging/`; to upgrade a Helm release with custom values, run `helm upgrade --install my-app bitnami/nginx -f prod-values.yaml`. | A) Helm is a package manager using Go templates (`Chart.yaml`, `values.yaml`) and release tracking; Kustomize (`kubectl -k`) uses template-free `base` and `overlays` patches. ✓; B) Helm = parameterized charts + release lifecycle (`helm install/upgrade/rollback/list`); Kustomize = declarative YAML patching (`patchesStrategicMerge` / JSON6902) integrated into `kubectl apply -k`.; C) Use `kubectl kustomize <dir>` or `helm template <release> <chart>` to preview rendered manifests before applying. |
| 24 | If a Pod is running and Ready (`1/1`), and a Service exists, but `curl <service-name>` fails or times out, what are the four most common causes to verify? | Verify that: 1) Service `selector` matches Pod labels (`kubectl get ep`), 2) `targetPort` matches container port, 3) `NetworkPolicy` allows traffic, and 4) CoreDNS is running. | Running `kubectl get endpoints <svc>` (or `kubectl get endpointslices -l kubernetes.io/service-name=<svc>`) immediately shows whether the Service matched any Pod IPs: if `<none>` is listed, fix the Service's `spec.selector`. | A) Verify that: 1) Service `selector` matches Pod labels (`kubectl get ep`), 2) `targetPort` matches container port, 3) `NetworkPolicy` allows traffic, and 4) CoreDNS is running. ✓; B) Check `kubectl get ep <svc>` (empty = selector mismatch or failing readinessProbe), verify `port` vs `targetPort`, check `NetworkPolicy`, and test `nslookup` against CoreDNS.; C) Also verify `kube-proxy` DaemonSet pods are healthy in `kube-system`. |
| 25 | How do `topologySpreadConstraints` distribute Pods evenly across failure domains (zones or nodes), and what do `maxSkew` and `whenUnsatisfiable` control? | `maxSkew` defines the maximum allowed Pod count difference between any two topology domains (`topologyKey`); `whenUnsatisfiable` sets `DoNotSchedule` (hard) or `ScheduleAnyway` (soft). | Setting `topologyKey: topology.kubernetes.io/zone`, `maxSkew: 1`, and `whenUnsatisfiable: DoNotSchedule` guarantees that a 6-replica Deployment places exactly 2 Pods in each of 3 Availability Zones. | A) Controls even Pod distribution across `topology.kubernetes.io/zone` or `kubernetes.io/hostname` using `maxSkew` (>=1) and `DoNotSchedule` / `ScheduleAnyway`.; B) `maxSkew` defines the maximum allowed Pod count difference between any two topology domains (`topologyKey`); `whenUnsatisfiable` sets `DoNotSchedule` (hard) or `ScheduleAnyway` (soft). ✓; C) More flexible than binary `podAntiAffinity` because it supports multi-pod skew budgets per zone. |
| 26 | In a Pod or Container `securityContext`, what happens if both the Pod-level `spec.securityContext` and Container-level `spec.containers[*].securityContext` define `runAsUser`? | Container-level `securityContext` settings override Pod-level `spec.securityContext` settings for that container; `fsGroup` and `supplementalGroups` exist only at the Pod level. | Linux capabilities (`securityContext.capabilities.add: ["NET_ADMIN"]` or `drop: ["ALL"]`), `allowPrivilegeEscalation: false`, and `readOnlyRootFilesystem: true` are configured at the Container level (`spec.containers[*].securityContext`). | A) Container-level `securityContext` settings override Pod-level `spec.securityContext` settings for that container; `fsGroup` and `supplementalGroups` exist only at the Pod level. ✓; B) Container `securityContext` overrides Pod `securityContext`; `capabilities`, `privileged`, `readOnlyRootFilesystem`, and `allowPrivilegeEscalation` are container-level fields only.; C) `fsGroup` is a Pod-level field (`spec.securityContext.fsGroup`) that sets group ownership on mounted volumes. |
| 27 | Compare Kubernetes `startupProbe`, `livenessProbe`, and `readinessProbe` regarding failure actions and lifecycle execution order. | `startupProbe` disables other probes until startup succeeds; `livenessProbe` restarts deadlocked containers; `readinessProbe` removes unhealthy Pods from Service `EndpointSlices` without restarting them. | For a legacy Java application taking 90 seconds to boot, configuring a `startupProbe` (`failureThreshold: 30, periodSeconds: 5`) prevents the `livenessProbe` from killing the container before initialization finishes. | A) Startup = protects slow-starting apps (restarts on failure); Liveness = detects deadlocks (restarts container); Readiness = controls Service traffic routing (removes IP from endpoints, no restart).; B) `startupProbe` disables other probes until startup succeeds; `livenessProbe` restarts deadlocked containers; `readinessProbe` removes unhealthy Pods from Service `EndpointSlices` without restarting them. ✓; C) All three support `httpGet`, `tcpSocket`, `grpc`, and `exec` command checks. |
| 28 | Compare the three Kubernetes Taint effects (`NoSchedule`, `PreferNoSchedule`, `NoExecute`) and explain how a Pod's `tolerationSeconds` interacts with `NoExecute`. | `NoSchedule` blocks new un-tolerated pods; `PreferNoSchedule` is soft; `NoExecute` blocks new pods AND immediately evicts running pods lacking a matching toleration. | If a running Pod has a `NoExecute` toleration with `tolerationSeconds: 300`, when the node is tainted `kubectl taint nodes node1 hardware=gpu:NoExecute`, the Pod continues running for 300 seconds before eviction. | A) NoSchedule = hard block on scheduling; PreferNoSchedule = soft block; NoExecute = hard block + evicts existing pods.; B) `NoSchedule` blocks new un-tolerated pods; `PreferNoSchedule` is soft; `NoExecute` blocks new pods AND immediately evicts running pods lacking a matching toleration. ✓; C) To remove a taint from a node, append a minus sign at the end: `kubectl taint nodes node1 key=value:NoSchedule-`. |
| 29 | Where do Static Pods live on a Kubernetes node, which component manages them directly, and how can you identify a Static Pod in `kubectl get pods`? | Static Pod manifests reside in `/etc/kubernetes/manifests` (via `staticPodPath` in `/var/lib/kubelet/config.yaml`), are managed by `kubelet`, and append `-<node-name>` to the Pod name. | The control plane components (`kube-apiserver`, `kube-controller-manager`, `kube-scheduler`, `etcd`) run as Static Pods; deleting them via `kubectl delete pod` fails because `kubelet` immediately recreates them until the file in `/etc/kubernetes/manifests` is moved. | A) Managed by `kubelet` without the scheduler; mirror pods appear in the API server with a `-<nodename>` suffix.; B) Static Pod manifests reside in `/etc/kubernetes/manifests` (via `staticPodPath` in `/var/lib/kubelet/config.yaml`), are managed by `kubelet`, and append `-<node-name>` to the Pod name. ✓; C) Check `/var/lib/kubelet/config.yaml` (`staticPodPath`) if `/etc/kubernetes/manifests` is non-standard. |
| 30 | In the Kubernetes Gateway API (the modern successor to `Ingress`), how do `GatewayClass`, `Gateway`, and `HTTPRoute` separate role responsibilities? | `GatewayClass` defines the controller template; `Gateway` defines network listeners and TLS ports; `HTTPRoute` defines application HTTP routing, headers, and weighted traffic splitting. | An `HTTPRoute` attaches to a parent `Gateway` via `parentRefs` and splits canary traffic (`weight: 90` to `svc-v1` and `weight: 10` to `svc-v2`) natively without vendor-specific Ingress annotations. | A) Three-tier role-oriented API: `GatewayClass` (cluster-scoped) -> `Gateway` (listeners/IPs/TLS) -> `HTTPRoute`/`GRPCRoute`/`TLSRoute` (application routing rules).; B) Cross-namespace attachment between a `Gateway` and an `HTTPRoute` or backend Service is securely governed by a `ReferenceGrant`.; C) `GatewayClass` defines the controller template; `Gateway` defines network listeners and TLS ports; `HTTPRoute` defines application HTTP routing, headers, and weighted traffic splitting. ✓ |
| 31 | How do you enable Encryption at Rest for Kubernetes `Secret` resources stored in `etcd`? | Pass `--encryption-provider-config` to `kube-apiserver` with an `EncryptionConfiguration` manifest listing `aescbc` (or `kms`) before `identity: {}`, then re-encrypt existing secrets. | The provider order in `EncryptionConfiguration` matters: the FIRST provider (`aescbc`) encrypts all new writes to `etcd`; running `kubectl get secrets -A -o json \| kubectl replace -f -` re-encrypts all pre-existing plaintext secrets. | A) Pass `--encryption-provider-config` to `kube-apiserver` with an `EncryptionConfiguration` manifest listing `aescbc` (or `kms`) before `identity: {}`, then re-encrypt existing secrets. ✓; B) In `EncryptionConfiguration`, place `aescbc`/`kms` first (encrypts writes) and `identity: {}` last (allows reading legacy unencrypted secrets), mount the file into `kube-apiserver.yaml`, and re-write secrets.; C) Remember to add both a `volumeMount` and a `hostPath` `volume` in `/etc/kubernetes/manifests/kube-apiserver.yaml` so the static Pod can read the config file! |
| 32 | When a `ConfigMap` or `Secret` is updated in Kubernetes, does a running Pod consuming it automatically receive the updated values? | Mounted `ConfigMap`/`Secret` volumes (without `subPath`) update automatically within ~60–90 seconds, whereas environment variables (`env`/`envFrom`) and `subPath` mounts require a Pod restart. | If an application reads `DB_PASSWORD` via `env.valueFrom.secretKeyRef` or mounts a single config file using `volumeMounts.subPath`, engineers must trigger `kubectl rollout restart deployment/<name>` after updating the Secret or ConfigMap. | A) Mounted `ConfigMap`/`Secret` volumes (without `subPath`) update automatically within ~60–90 seconds, whereas environment variables (`env`/`envFrom`) and `subPath` mounts require a Pod restart. ✓; B) Standard volume mounts auto-update asynchronously; `env`, `envFrom`, and `subPath` volume mounts stay frozen until the Pod is recreated.; C) Setting `immutable: true` on a ConfigMap/Secret improves cluster performance by stopping `kubelet` from polling the API server for changes. |

---
Study this deck interactively with FSRS-6 spaced repetition, audio review, and multiple-choice mode at [Flashcards World](https://flashcards.world/flashcards/sets/67fbf47a-72c4-44b5-ade7-ab37eba9d23f/).
