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.

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
Cards
32
Markdown
CNCF Certified Kubernetes Administrator (CKA) & Application Developer (CKAD) — Cluster Architecture, Networking, Storage & Troubleshooting (.md)

Flashcards (32)

#Front (Term / Question)Back (Definition / Answer)ExampleMultiple-Choice Options
1How 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.
  • `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.
  • Run `kubectl drain <node> --ignore-daemonsets --delete-emptydir-data` to cordon the node and evict Pods while respecting `PodDisruptionBudgets`, then `kubectl uncordon <node>` afterward.
  • If a `PodDisruptionBudget` (`minAvailable` / `maxUnavailable`) would be violated, `kubectl drain` waits until enough replacement Pods become Ready.
2How 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.
  • ResourceQuota = namespace total cap; LimitRange = per-pod/container default/min/max bounds; HPA = scales replicas via `ceil[currentReplicas * (currentMetricValue / desiredMetricValue)]`.
  • `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.
  • HPA requires the `metrics-server` deployment running in `kube-system` and `resources.requests` defined on the target Pods.
3What 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.
  • 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.
  • 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.
  • `kubectl expose pod/deploy <name> --port=80 --target-port=8080 --name=<svc>` creates a matching Service selector automatically.
4Compare 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`).
  • `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.
  • 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).
  • If a PV is in `Released` state (`Retain` policy after PVC deletion), remove `spec.claimRef` to make it `Available` for re-binding.
5What 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`.
  • Control plane: drain -> upgrade kubeadm -> `kubeadm upgrade apply` -> upgrade kubelet/kubectl -> restart kubelet -> uncordon; Workers: drain -> upgrade kubeadm -> `kubeadm upgrade node` -> upgrade kubelet -> uncordon.
  • Never skip minor versions during a `kubeadm` upgrade (e.g., 1.29 -> 1.31 directly is unsupported).
  • Drain control plane, upgrade `kubeadm`, run `kubeadm upgrade apply`, upgrade `kubelet`/`kubectl`, uncordon, then drain and upgrade workers using `kubeadm upgrade node`.
6How 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.
  • 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`.
  • Backup requires TLS flags (`--cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=... --key=...`); restore creates a clean `--data-dir` without needing TLS certificates.
  • Inspect `/etc/kubernetes/manifests/etcd.yaml` to copy the exact `--trusted-ca-file`, `--cert-file`, and `--key-file` paths.
7In 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.
  • Required = hard filter during scheduling; Preferred = soft weighted scoring during scheduling; IgnoredDuringExecution = no eviction after placement.
  • Multiple `nodeSelectorTerms` under `requiredDuringScheduling` are evaluated with logical OR, while multiple `matchExpressions` inside a single term use logical AND.
  • `requiredDuringScheduling...` is a hard scheduling filter (Pod stays Pending without match); `preferredDuringScheduling...` scores nodes by weight (1–100); `IgnoredDuringExecution` never evicts running pods.
8How 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.
  • Standard Init Containers must exit 0 before the next init/app container starts; `restartPolicy: Always` creates a persistent native sidecar container.
  • Standard Init Containers run sequentially to completion before app containers start; an Init Container with `restartPolicy: Always` stays running alongside main containers.
  • If any standard Init Container fails repeatedly, Kubernetes restarts the Pod according to `spec.restartPolicy`.
9Why 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.
  • Use `crictl ps -a` and `crictl logs <id>` (or inspect `/var/log/pods/` and `/var/log/containers/`) when `kube-apiserver` is unreachable.
  • `crictl` communicates with the CRI socket (`unix:///run/containerd/containerd.sock`) configured in `/etc/crictl.yaml`.
  • Kubernetes uses the Container Runtime Interface (`containerd` or `CRI-O`), and `crictl` (`crictl ps`, `crictl logs`) is the CRI CLI for debugging node containers.
10When 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.
  • Run `kubectl describe node <name>`, SSH to the node to check `systemctl status kubelet` and `journalctl -u kubelet -xe`, and verify `containerd` (`crictl ps`).
  • Check `kubectl describe node`, then on the node run `systemctl status kubelet`, `journalctl -u kubelet`, `systemctl status containerd`, and `df -h` / `free -m`.
  • 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.
11Compare `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.
  • `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`.
  • DaemonSet = 1 Pod per Node; StatefulSet = ordered ordinal naming (`0..N-1`), stable headless DNS, and per-replica `volumeClaimTemplates`.
  • StatefulSets require a Headless Service (`clusterIP: None`) specified in `spec.serviceName`.
12How 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.
  • Requests = scheduling reservation; CPU Limit = compressible cgroup throttling; Memory Limit = incompressible (`OOMKilled` exit code 137 when exceeded).
  • The scheduler uses `requests` to place Pods; `kubelet` enforces `limits` via cgroups by throttling CPU or `OOMKilling` (Exit Code 137) containers exceeding memory.
  • Three Pod QoS classes: `Guaranteed` (requests == limits for CPU & memory), `Burstable` (at least one request/limit set), and `BestEffort` (no requests or limits).
13What 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`.
  • 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!
  • 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`.
  • On the CKA exam, if asked to install a CNI that supports NetworkPolicy Enforcement, choose Calico or Cilium over pure Flannel.
14In 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`.
  • Prevents zone mismatch deadlocks by waiting for the scheduler to pick the Pod's target node before creating the zonal storage volume.
  • Setting `allowVolumeExpansion: true` on the StorageClass also enables online PVC resizing.
  • `WaitForFirstConsumer` delays dynamic provisioning and binding of the PersistentVolume until a Pod using the PVC is scheduled onto a specific node and zone.
15In 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.
  • Role + RoleBinding = single namespace; ClusterRole + ClusterRoleBinding = all namespaces + cluster-scoped resources; ClusterRole + RoleBinding = reusable role scoped to one namespace.
  • A `RoleBinding` referencing a `ClusterRole` reuses the cluster-wide role definition but restricts the granted permissions strictly to the `RoleBinding`'s single namespace.
  • Verify any RBAC configuration immediately with `kubectl auth can-i <verb> <resource> --as=system:serviceaccount:<ns>:<sa> -n <ns>`.
16What 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%).
  • 120-minute hands-on terminal exam with 66% passing score; Troubleshooting (30%) is the heaviest domain.
  • CKAD is also 2 hours with a 66% passing score, focusing on Application Design/Build, Deployment, Observability, Environment/Security, and Services/Networking.
  • 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%).
17Compare 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`.
  • ClusterIP = internal VIP; NodePort = ClusterIP + port 30000-32767 on nodes; LoadBalancer = NodePort + cloud LB; ExternalName = DNS CNAME alias.
  • Headless services skip `kube-proxy` VIP translation and return direct Pod IPs via CoreDNS.
  • `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.
18What 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`.
  • Profiles: `privileged`, `baseline`, and `restricted`; Modes: `enforce` (rejects pod), `audit` (logs annotation), and `warn` (prints user warning).
  • `privileged` (unrestricted), `baseline` (blocks hostNetwork/privileged pods), and `restricted` (hardened: requires `runAsNonRoot: true`, seccomp `RuntimeDefault`, and dropping `ALL` capabilities).
  • Replaced the removed `PodSecurityPolicy` (PSP) API starting in Kubernetes 1.25.
19How 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.
  • Single list item (`- namespaceSelector: ... \n podSelector: ...`) = logical AND; separate list items (`- namespaceSelector: ... \n - podSelector: ...`) = logical OR.
  • A default-deny-all policy uses `podSelector: {}` with `policyTypes: ["Ingress", "Egress"]` and no `ingress`/`egress` allow rules.
  • Pods allow all traffic until selected by a `NetworkPolicy`; separate `-` list items use OR logic, while properties inside one `-` item use AND logic.
20Compare 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.
  • 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.
  • `Recreate` kills all old Pods before creating new ones; `RollingUpdate` replaces Pods gradually using `maxSurge` (extra Pods allowed) and `maxUnavailable` (max unavailable Pods).
  • Setting `maxSurge: 1` and `maxUnavailable: 0` ensures full capacity is maintained throughout the update by starting each new Pod before terminating an old one.
21In 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.
  • 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).
  • `completions` sets required successes; `parallelism` sets concurrent Pods; `backoffLimit` caps retries; `activeDeadlineSeconds` caps runtime; `concurrencyPolicy` (`Allow`/`Forbid`/`Replace`) governs overlapping CronJobs.
  • `ttlSecondsAfterFinished` automatically cleans up completed Jobs and their Pods after the specified TTL.
22When 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}]`.
  • Allow UDP/TCP port 53 egress to CoreDNS in the `kube-system` namespace.
  • Without port 53 egress allowed, Pods can reach raw IP addresses allowed by the policy but cannot resolve any DNS hostnames.
  • Explicitly allow Egress on UDP and TCP port 53 to `kube-system` (CoreDNS pods), or DNS resolution inside isolated Pods will fail completely.
23Compare `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`.
  • 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.
  • Helm = parameterized charts + release lifecycle (`helm install/upgrade/rollback/list`); Kustomize = declarative YAML patching (`patchesStrategicMerge` / JSON6902) integrated into `kubectl apply -k`.
  • Use `kubectl kustomize <dir>` or `helm template <release> <chart>` to preview rendered manifests before applying.
24If 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`.
  • 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.
  • Check `kubectl get ep <svc>` (empty = selector mismatch or failing readinessProbe), verify `port` vs `targetPort`, check `NetworkPolicy`, and test `nslookup` against CoreDNS.
  • Also verify `kube-proxy` DaemonSet pods are healthy in `kube-system`.
25How 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.
  • Controls even Pod distribution across `topology.kubernetes.io/zone` or `kubernetes.io/hostname` using `maxSkew` (>=1) and `DoNotSchedule` / `ScheduleAnyway`.
  • `maxSkew` defines the maximum allowed Pod count difference between any two topology domains (`topologyKey`); `whenUnsatisfiable` sets `DoNotSchedule` (hard) or `ScheduleAnyway` (soft).
  • More flexible than binary `podAntiAffinity` because it supports multi-pod skew budgets per zone.
26In 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`).
  • Container-level `securityContext` settings override Pod-level `spec.securityContext` settings for that container; `fsGroup` and `supplementalGroups` exist only at the Pod level.
  • Container `securityContext` overrides Pod `securityContext`; `capabilities`, `privileged`, `readOnlyRootFilesystem`, and `allowPrivilegeEscalation` are container-level fields only.
  • `fsGroup` is a Pod-level field (`spec.securityContext.fsGroup`) that sets group ownership on mounted volumes.
27Compare 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.
  • Startup = protects slow-starting apps (restarts on failure); Liveness = detects deadlocks (restarts container); Readiness = controls Service traffic routing (removes IP from endpoints, no restart).
  • `startupProbe` disables other probes until startup succeeds; `livenessProbe` restarts deadlocked containers; `readinessProbe` removes unhealthy Pods from Service `EndpointSlices` without restarting them.
  • All three support `httpGet`, `tcpSocket`, `grpc`, and `exec` command checks.
28Compare 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.
  • NoSchedule = hard block on scheduling; PreferNoSchedule = soft block; NoExecute = hard block + evicts existing pods.
  • `NoSchedule` blocks new un-tolerated pods; `PreferNoSchedule` is soft; `NoExecute` blocks new pods AND immediately evicts running pods lacking a matching toleration.
  • To remove a taint from a node, append a minus sign at the end: `kubectl taint nodes node1 key=value:NoSchedule-`.
29Where 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.
  • Managed by `kubelet` without the scheduler; mirror pods appear in the API server with a `-<nodename>` suffix.
  • 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.
  • Check `/var/lib/kubelet/config.yaml` (`staticPodPath`) if `/etc/kubernetes/manifests` is non-standard.
30In 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.
  • Three-tier role-oriented API: `GatewayClass` (cluster-scoped) -> `Gateway` (listeners/IPs/TLS) -> `HTTPRoute`/`GRPCRoute`/`TLSRoute` (application routing rules).
  • Cross-namespace attachment between a `Gateway` and an `HTTPRoute` or backend Service is securely governed by a `ReferenceGrant`.
  • `GatewayClass` defines the controller template; `Gateway` defines network listeners and TLS ports; `HTTPRoute` defines application HTTP routing, headers, and weighted traffic splitting.
31How 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.
  • Pass `--encryption-provider-config` to `kube-apiserver` with an `EncryptionConfiguration` manifest listing `aescbc` (or `kms`) before `identity: {}`, then re-encrypt existing secrets.
  • 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.
  • 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!
32When 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.
  • Mounted `ConfigMap`/`Secret` volumes (without `subPath`) update automatically within ~60–90 seconds, whereas environment variables (`env`/`envFrom`) and `subPath` mounts require a Pod restart.
  • Standard volume mounts auto-update asynchronously; `env`, `envFrom`, and `subPath` volume mounts stay frozen until the Pod is recreated.
  • Setting `immutable: true` on a ConfigMap/Secret improves cluster performance by stopping `kubelet` from polling the API server for changes.