โธ๏ธ Round 2: Kubernetes Internals, Controllers & Production Scheduling
In Staff Platform Architect and Principal SRE interviews across Indian tech leaders (Flipkart, Swiggy, Razorpay, Uber IDC, Atlassian, Google Cloud), Round 2 moves past manifest syntax into control plane mechanics.
Interviewers expect you to explain how the API Server handles concurrency via MVCC, how etcd executes Raft consensus, how the scheduler scores nodes, how kubelet coordinates with CRI/CNI/CSI, and how to recover from fatal webhook freezes.
๐ Question 1: Trace kubectl apply -f deployment.yaml Under the Hood
๐ฏ The Scenario & Interviewerโs Trap
โYou execute
kubectl apply -f deployment.yamlagainst an Amazon EKS / Google GKE cluster. Trace the lifecycle of this request from the moment the CLI executes until the containerโs process is running and accepting traffic on the worker node. List every subsystem, validation phase, and controller involved.โ
Interviewerโs Intent: To test if you understand the asynchronous, decoupled, level-triggered architecture of Kubernetes or if you think kube-apiserver directly creates containers.
๐ก Staff-Level Model Answer
flowchart TD
subgraph Client["1. Client Phase"]
CLI["kubectl apply"] --> ClientGo["client-go discovers OpenAPI schema & serializes JSON"]
end
subgraph APIServer["2. kube-apiserver Pipeline"]
AuthN["Authentication (TLS Cert / OIDC Webhook / AWS IAM)"]
AuthZ["Authorization (RBAC ClusterRole / Webhook)"]
Mutating["Mutating Admission Webhooks (Linkerd, Kyverno, etc.)"]
Schema["Object Schema Validation (OpenAPI v3)"]
Validating["Validating Admission Webhooks (OPA Gatekeeper)"]
AuthN --> AuthZ --> Mutating --> Schema --> Validating
end
subgraph Storage["3. Persistent State"]
Validating --> etcd["etcd Raft Consensus (WAL fsync + MVCC Commit)"]
end
subgraph Controllers["4. Control Plane Reconciliation"]
etcd -->|Watch Event| DepCtrl["Deployment Controller (creates ReplicaSet)"]
DepCtrl -->|Watch Event| RSCtrl["ReplicaSet Controller (creates Pod specs with Pending status)"]
RSCtrl -->|Watch Event| Sched["kube-scheduler (Filter -> Score -> Reserve -> Bind)"]
end
subgraph Worker["5. Node Execution (kubelet)"]
Sched -->|Assigns nodeName| Kubelet["kubelet PLEG (Pod Lifecycle Event Generator)"]
Kubelet --> CRI["CRI (containerd): Pull Image, Create Namespaces"]
Kubelet --> CNI["CNI (AWS VPC CNI / Cilium): Allocate IP & veth pair"]
Kubelet --> CSI["CSI (EBS CSI): Attach & Format/Mount Filesystem"]
CRI --> Container["Application Container Process Starts (PID in netns)"]
end
ClientGo --> AuthN
Step-by-Step Breakdown:
- Client-Side Processing:
kubectlloads~/.kube/config, contacts the API discovery endpoint (/openapi/v2), converts YAML to JSON, and executes aPATCHorPOSTrequest over TLS. - API Server Request Pipeline:
- Authentication (AuthN): Validates caller identity via x509 client certificates, OIDC bearer tokens, or Webhook Token Authenticators (e.g.,
aws-iam-authenticator). - Authorization (AuthZ): Evaluates RBAC rules (
RoleBinding/ClusterRoleBinding) to verify verbs (create,patch) against the resource (deployments.apps). - Mutating Webhooks: Invoked sequentially. Webhooks can inject sidecars (Istio, Vault Agent) or modify fields.
- Schema Validation: Verifies required fields against registered OpenAPI schemas.
- Validating Webhooks: Invoked in parallel (e.g., OPA Gatekeeper, Kyverno). If any webhook rejects with
allow: false, the entire request is aborted with HTTP 400/403.
- Authentication (AuthN): Validates caller identity via x509 client certificates, OIDC bearer tokens, or Webhook Token Authenticators (e.g.,
- etcd Persistence:
- The API Server writes the validated
Deploymentresource to etcd. - etcd writes the record to its Write-Ahead Log (WAL), executes Raft consensus across a majority quorum (N/2 + 1), and commits the change to its bbolt MVCC key-value store, returning a new
resourceVersion.
- The API Server writes the validated
- Asynchronous Controller Reconciliation Loops:
- Deployment Controller: Watches etcd for deployment changes via HTTP/2 streaming. It sees the new Deployment, creates a corresponding
ReplicaSet, and writes it to the API Server. - ReplicaSet Controller: Sees the
ReplicaSet, calculates desired vs current replicas, creates the requested number ofPodobjects withspec.nodeName: ""(Pendingstate), and writes them to etcd.
- Deployment Controller: Watches etcd for deployment changes via HTTP/2 streaming. It sees the new Deployment, creates a corresponding
- Scheduling Phase (
kube-scheduler):- The scheduler watches for unassigned pods (
nodeName == ""). - Filtering (Predicates): Filters out nodes lacking resources (CPU/RAM), failing Taints/Tolerations, or failing NodeAffinity rules.
- Scoring (Priorities): Ranks candidate nodes using scoring algorithms (LeastAllocated, ImageLocality, TopologySpread).
- Reserve & Permit: Temporarily reserves node resources and executes any Permit plugins.
- Binding: Writes a
Bindingobject back to the API Server, populatingpod.spec.nodeName.
- The scheduler watches for unassigned pods (
- Worker Node Execution (
kubelet):- The
kubeleton the target worker node detects the pod assigned to its node via its Informer watch loop. - CSI Attachment & Mount: Kubelet calls the CSI driver to attach remote block storage (e.g., EBS) and mount the filesystem into
/var/lib/kubelet/pods/<pod-uid>/volumes. - CRI Container Runtime: Kubelet instructs
containerdvia gRPC to pull container images, set up Linux cgroups, and initialize namespaces. - CNI Network Provisioning:
containerdcalls the CNI plugin (e.g., AWS VPC CNI, Cilium) to allocate an IP address, configure host-to-pod veth interfaces, and set up routing rules. - Container Start:
containerdlaunches the container process and marks the PodRunning.
- The
๐ Question 2: etcd Raft Consensus, Quorum Loss & Linearizable Reads
๐ฏ The Scenario & Interviewerโs Trap
โYour production Kubernetes control plane runs a 3-node etcd cluster spread across 3 AWS Availability Zones. AZ-a suffers a catastrophic network isolation event. What happens to etcd? How does Raft handle leader election, what is the mathematical quorum requirement, and what is the difference between a serializable read and a linearizable read?โ
Interviewerโs Intent: To verify whether you understand distributed consensus theory, split-brain protection, and how etcd avoids serving stale reads during network partitions.
๐ก Staff-Level Model Answer
flowchart TD
subgraph Cluster["3-Node etcd Cluster across 3 AZs"]
AZ1["Node 1 (Leader) in AZ-a<br/>(ISOLATED!)"]
AZ2["Node 2 (Follower) in AZ-b"]
AZ3["Node 3 (Follower) in AZ-c"]
end
AZ1 -.->|Network Partition| AZ2
AZ1 -.->|Network Partition| AZ3
AZ2 <-->|Heartbeats Active| AZ3
subgraph Election["Raft Quorum: ceil((3+1)/2) = 2 nodes"]
AZ2 -->|Election Timeout fires| AZ2_Cand["Node 2 becomes Candidate"]
AZ2_Cand -->|Requests Vote| AZ3
AZ3 -->|Grants Vote| AZ2_Cand
AZ2_Cand --> NewLeader["Node 2 becomes New Raft Leader!"]
end
1. Quorum Mathematics:
In etcd (and Raft in general), the quorum requirement is: ๐ Quorum = โ N / 2 โ + 1
- For a 3-node cluster (N=3): Quorum is โ 3/2 โ + 1 = 2 nodes.
- Fault Tolerance: Can survive f node failures, where N = 2f + 1:
- 3 nodes survive f = 1 failure.
- 5 nodes survive f = 2 failures.
- Why an odd number of nodes? A 4-node cluster also requires a quorum of โ 4/2 โ + 1 = 3 nodes. Adding a 4th node does not increase fault tolerance (it still tolerates only 1 failure) while increasing network communication overhead!
2. Network Partition Behavior:
- The Minority Partition (Node 1 in AZ-a):
- Node 1 cannot contact Nodes 2 and 3. When the API Server attempts a write to Node 1, Node 1 cannot achieve quorum replication. The write fails or hangs.
- The Majority Partition (Nodes 2 & 3 in AZ-b and AZ-c):
- Nodes 2 and 3 stop receiving leader heartbeats. Node 2โs randomized election timeout expires, increments its Raft term, transitions to
Candidate, and requests votes from Node 3. - Node 3 votes for Node 2. Node 2 receives 2/3 votes, achieves quorum, and becomes the new leader.
- The cluster continues processing writes and reads without interruption.
- Nodes 2 and 3 stop receiving leader heartbeats. Node 2โs randomized election timeout expires, increments its Raft term, transitions to
3. Serializable Reads vs. Linearizable Reads:
- Serializable Read (Stale Read Risk):
- The local node satisfies the read directly from its in-memory bbolt database without communicating with other nodes.
- Danger: If Node 1 is partitioned, an API server querying Node 1 with serializable reads would receive stale state that does not reflect recent writes committed by Node 2.
- Linearizable Read (Default in Kubernetes):
- The leader node confirms with a quorum of peers (via a Raft
ReadIndexheartbeat exchange) that it is still the legitimate leader before serving the read. - Guarantees strong consistency: clients are guaranteed to see the latest committed write.
- The leader node confirms with a quorum of peers (via a Raft
How to Triage etcd Health:
# Check cluster membership and health:
etcdctl endpoint health --cluster -w table
# Check leader status and Raft term:
etcdctl endpoint status --cluster -w table
# Check WAL disk fsync latency (must be < 10ms):
etcdctl check perf
๐ Question 3: The Fatal Admission Webhook Freeze & Rescue
๐ฏ The Scenario & Interviewerโs Trap
โAn engineer configures a
ValidatingWebhookConfigurationenforcing custom compliance rules. The webhook server runs as a pod inside the cluster. Overnight, all worker nodes reboot due to an automated AMI patch. When the nodes restart, the webhook pods fail to start. Suddenly, the entire Kubernetes cluster freezes: no pods can start,kubectl applyhangs indefinitely, and evenkubectl delete validatingwebhookconfigurationtimes out. How did this deadlock occur, and how do you recover the cluster?โ
Interviewerโs Intent: To test if you understand the cyclic dependency between in-cluster admission webhooks and API Server request processing, and whether you know how to execute emergency surgical recovery.
๐ก Staff-Level Model Answer
flowchart TD
Reboot["Worker Nodes Reboot"] --> Evict["Webhook Pods Evicted / Destroyed"]
Evict --> AttemptStart["Kubelet attempts to recreate Webhook Pods"]
AttemptStart --> APICall["Kubelet sends Pod Create request to API Server"]
APICall --> Intercept["API Server intercepts request: ValidatingWebhookConfiguration has failurePolicy: Fail"]
Intercept --> CallWebhook["API Server attempts to contact Webhook Service at 10.100.20.5:443"]
CallWebhook --> Timeout["Webhook Pod is NOT RUNNING! Connection Times Out after 30s!"]
Timeout --> Reject["API Server REJECTS the pod creation!"]
Reject --> Deadlock["DEADLOCK: Webhook cannot start because Webhook is required to start itself!"]
1. Why the Deadlock Occurred:
- The
ValidatingWebhookConfigurationwas configured with:failurePolicy: Fail rules: - operations: ["CREATE", "UPDATE"] apiGroups: ["*"] apiVersions: ["*"] resources: ["pods", "deployments"] - When nodes rebooted, kubelet attempted to launch the webhook pod.
- The API Server intercepted the Pod creation request. Because
failurePolicy: Failwas set, the API Server required approval from the webhook service. - But the webhook service has 0 ready endpoints because its pods are currently trying to start!
- The API Server waited for the webhook timeout (default 10โ30s) and aborted the pod creation. Classic chicken-and-egg cyclic deadlock.
2. The 3 Recovery Procedures:
Strategy A: Emergency Master Node Manifest Bypass (Fastest)
If you have SSH access to control plane nodes (or self-hosted control planes):
# Temporarily edit the kube-apiserver static pod manifest:
vim /etc/kubernetes/manifests/kube-apiserver.yaml
# Add this flag to temporarily disable admission plugins:
--disable-admission-plugins=ValidatingAdmissionWebhook,MutatingAdmissionWebhook
# kubelet automatically restarts kube-apiserver.
# Delete the broken webhook:
kubectl delete validatingwebhookconfiguration <broken-webhook-name>
# Re-enable webhooks in kube-apiserver.yaml
Strategy B: Direct etcd Surgical Purge
If the API Server is completely non-responsive to API requests:
# Directly query and delete the webhook object from etcd:
ETCDCTL_API=3 etcdctl --cacert=/etc/kubernetes/pki/etcd/ca.crt \
--cert=/etc/kubernetes/pki/etcd/server.crt \
--key=/etc/kubernetes/pki/etcd/server.key \
del /registry/validatingwebhookconfigurations/<broken-webhook-name>
Strategy C: Architectural Prevention (The Staff Answer)
Never run webhooks that intercept core system namespaces without strict safeguards:
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
name: security-validator
webhooks:
- name: validator.corp.com
failurePolicy: Ignore # <-- Non-blocking during outages!
timeoutSeconds: 3
namespaceSelector:
matchExpressions:
- key: kubernetes.io/metadata.name
operator: NotIn
values: ["kube-system", "kube-node-lease", "webhook-system"] # Exclude system namespaces!
๐ Question 4: StatefulSets & EBS CSI Multi-AZ Scheduling Deadlocks
๐ฏ The Scenario & Interviewerโs Trap
โYou run a Kafka StatefulSet on Amazon EKS backed by AWS EBS
gp3volumes. Worker Node-1 inus-east-1asuffers an AWS hardware failure and crashes. Karpenter immediately provisions a new replacement EC2 instance inus-east-1bbecause that AZ has cheaper spot capacity. The Kafka pod is scheduled on the new node, but stays permanently trapped inContainerCreatingwithVolumeAttachment failed: VolumeInUseorZoneMismatch. What happened, and how do you design storage classes to prevent this?โ
Interviewerโs Intent: To test if you understand that EBS block volumes are physically tied to a single AWS Availability Zone, and how Kubernetes topology-aware volume scheduling works.
๐ก Staff-Level Model Answer
flowchart TD
subgraph AZa["Availability Zone: us-east-1a"]
EBS["EBS Volume: vol-0123<br/>(Hard-locked to us-east-1a SAN fabric)"]
Node1["Node-1 (FAILED / CRASHED)"]
EBS -.->|Attached| Node1
end
subgraph AZb["Availability Zone: us-east-1b"]
Node2["Node-2 (New Karpenter Node launched in AZ-b)"]
Pod["Kafka-0 Pod scheduled here!"]
end
Pod -->|Requires vol-0123| EBS
EBS -- "CANNOT CROSS PHYSICAL AZ BOUNDARY!" --> CrossErr["Error: VolumeAttachment Deadlock!"]
1. The Root Cause:
- EBS is Single-AZ: Unlike EFS (NFS) or S3 (Object Storage), Amazon EBS volumes exist on physical Storage Area Network (SAN) infrastructure inside a single Availability Zone (
us-east-1a). They cannot cross physical datacenter boundaries. - The Karpenter Race: When Node-1 died, Karpenter saw a pending pod. If the StorageClass used default immediate binding, or if the pod lacked AZ node affinity, Karpenter launched the replacement node in
us-east-1b. - The Detach Hang: Furthermore, AWS EBS has a volume lock timeout. If Node-1 crashed abruptly without cleanly unmounting the volume, the AWS EC2 API reports the volume in
busyorattachingstate for up to 6โ10 minutes before force-detaching.
2. The Architectural Solution:
- Topology-Aware StorageClass (
WaitForFirstConsumer):apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: ebs-gp3-topology provisioner: ebs.csi.aws.com volumeBindingMode: WaitForFirstConsumer # Crucial! Defers volume creation until pod is scheduled allowedTopologies: - matchLabelExpressions: - key: topology.ebs.csi.aws.com/zone values: - us-east-1a - us-east-1b - us-east-1c - StatefulSet Node Affinity / NodeSelector:
Ensure StatefulSet pods maintain an affinity to the zone where their PersistentVolume was originally provisioned:
spec: template: spec: affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: topology.kubernetes.io/zone operator: In values: ["us-east-1a"]
๐ Question 5: Karpenter vs. Cluster Autoscaler Architectural Comparison
๐ฏ The Scenario & Interviewerโs Trap
โWhy did your engineering team migrate from Kubernetes Cluster Autoscaler to Karpenter? Detail the architectural differences in how they communicate with the cloud provider, how they handle bin-packing, and how Karpenter handles Spot instance interruptions without causing service disruptions.โ
Interviewerโs Intent: To verify whether you have actually operated modern, cost-efficient Kubernetes clusters at scale, or if you still rely on legacy Auto Scaling Group (ASG) patterns.
๐ก Staff-Level Model Answer
| Architectural Dimension | Cluster Autoscaler (Legacy) | Karpenter (Modern Standard) |
|---|---|---|
| Cloud Provider Abstraction | Manages AWS Auto Scaling Groups (ASGs). Indirect orchestration. | Directly invokes EC2 Fleet API. No ASGs or Launch Templates required. |
| Scaling Reaction Time | 2 to 5 minutes. Must wait for ASG cooldowns, node scaling groups, and user-data execution. | 15 to 45 seconds. Direct EC2 API calls, optimized node images, parallel launches. |
| Bin-Packing & Instance Selection | Rigid. You must create static ASGs per instance type (m5.large, c5.xlarge). |
Dynamic Bin-Packing. Examines pending pod resource shapes and dynamically launches the cheapest matching instance from 200+ instance types. |
| Disruption & Consolidation | Crude scale-down. Only scales down when a node is underutilized for 10+ minutes. | Continuous Consolidation. Actively computes if workloads can be rescheduled onto smaller or fewer nodes to reduce spend. |
| Spot Interruption Handling | Relies on external AWS Node Termination Handler daemonsets. | Built-in native handling of 2-minute Spot Interruption Warnings and EC2 Rebalance Recommendations via SQS. |
Karpenter Spot Interruption Graceful Workflow:
sequenceDiagram
autonumber
participant AWS as AWS EC2 Spot Fabric
participant SQS as SQS Interruption Queue
participant Karpenter as Karpenter Controller
participant K8s as Kubelet & Pods
AWS->>SQS: Spot Interruption Warning (2-minute countdown)
SQS->>Karpenter: Event: EC2 Spot Interruption Notice
Karpenter->>AWS: Immediately provisions replacement node (parallel spin-up)
Karpenter->>K8s: Taints expiring node (NoSchedule) to block new pods
Karpenter->>K8s: Issues graceful eviction (respects PDBs)
Note over K8s: Replacement node is READY before the 2-minute deadline expires!
K8s->>Karpenter: Pods rescheduled on new node with ZERO dropped requests!
๐ Summary: Kubernetes Internals Quick-Fire Reference
| Question | Core Mechanism | Critical Staff Detail |
|---|---|---|
| etcd quorum requirement | โ N/2 โ + 1 | 3 nodes tolerate 1 failure; 5 nodes tolerate 2 failures; never use even numbers. |
| Linearizable vs Serializable | Raft ReadIndex validation |
Serializable reads can return stale data on partitioned leaders; Linearizable guarantees strong consistency. |
| Webhook cluster freeze | Cyclic dependency on failurePolicy: Fail |
Always exclude kube-system, use timeoutSeconds: 3, or bypass via control plane manifests. |
| EBS ContainerCreating hang | Single-AZ storage fabric | Use volumeBindingMode: WaitForFirstConsumer to avoid Cross-AZ attachment deadlocks. |
| Karpenter advantages | Direct EC2 Fleet API + Dynamic bin-packing | Bypasses ASG lag, provisions in <45s, and handles 2-min Spot terminations natively via SQS. |
๐ง Complete Lesson-by-Lesson One-Line Memory Bank (Round 2 Scope)
โธ๏ธ Phase 4: Kubernetes & Scaling (All Lessons)
Lesson 1: EKS Architecture & IRSA
| # | One-Line Question | One-Line Answer |
|---|---|---|
| 1 | Which control plane components are managed by AWS in an Amazon EKS cluster? | Multi-AZ kube-apiserver, etcd quorum, kube-scheduler, kube-controller-manager, and cloud-controller-manager. |
| 2 | How does the AWS VPC CNI (aws-node DaemonSet) differ from overlay CNIs like Flannel or Calico VXLAN? |
It allocates real first-class AWS VPC IPv4 addresses from the subnet directly to pods via secondary IPs on Elastic Network Interfaces (ENIs), eliminating VXLAN encapsulation overhead. |
| 3 | Why does an m5.large EC2 instance stop scheduling new pods at 29 pods even when CPU and RAM are 70% idle? |
Each m5.large supports a maximum of 3 ENIs ร 10 IPs per ENI = 30 IPs (minus 1 for the node primary IP = 29 pods max). |
| 4 | How does AWS VPC CNI Prefix Delegation (ENABLE_PREFIX_DELEGATION = "true") solve pod density limits on EKS? |
Instead of assigning single /32 secondary IPs to ENI slots, AWS assigns /28 IPv4 prefixes (16 IPs per slot), increasing an m5.large nodeโs capacity from 29 to 110 pods. |
| 5 | Why must production EKS worker nodes block IMDSv1 and enforce IMDSv2 with http_put_response_hop_limit = 1? |
A hop limit of 1 ensures IMDS packets cannot be forwarded across the containerโs veth router hop, preventing SSRF attacks in pods from stealing the Worker Nodeโs IAM Role credentials. |
| 6 | How does IRSA (IAM Roles for Service Accounts) inject AWS credentials into a specific pod? | The EKS Pod Identity Webhook mutates the pod to mount a projected OIDC JWT token and injects AWS_ROLE_ARN and AWS_WEB_IDENTITY_TOKEN_FILE environment variables. |
| 7 | Why is volumeBindingMode: WaitForFirstConsumer mandatory on all production AWS EBS StorageClasses? |
It delays creating the physical EBS volume until kube-scheduler picks a specific worker node, guaranteeing the volume is created in the exact same Availability Zone as the pod. |
| 8 | When must you use the Amazon EFS CSI Driver instead of the Amazon EBS CSI Driver? | When multiple pods across different worker nodes and Availability Zones must mount the exact same volume concurrently using ReadWriteMany (RWX). |
Lesson 2: Karpenter & Spot Fleets
| # | One-Line Question | One-Line Answer |
|---|---|---|
| 1 | Why does Karpenter launch replacement worker nodes in 30โ45 seconds while Cluster Autoscaler takes 3โ5 minutes? |
Karpenter bypasses AWS Auto Scaling Groups (ASGs) entirely and calls the EC2 Fleet API directly based on real-time pending pod resource requests and topology constraints. |
| 2 | What are the two core Custom Resource Definitions (CRDs) used to configure Karpenter v1? | NodePool (defines pod scheduling constraints, taints, and disruption policies) and EC2NodeClass (defines AWS-specific AMI, subnets, security groups, and EBS block mappings). |
| 3 | Why must you specify a wide variety of instance families (m5, m6i, c5, c6i, r5) in a Karpenter Spot NodePool? |
Spot diversification across 15+ instance pools allows EC2 Fleet price-capacity-optimized allocation to pick the deepest capacity pool with the lowest interruption rate. |
| 4 | What AWS infrastructure is required for Karpenter to gracefully drain Spot nodes before AWS reclaims them? | An Amazon EventBridge rule capturing EC2 Spot Instance Interruption Warnings (2-minute notice) and Rebalance Recommendations, routing them into an Amazon SQS queue polled by Karpenter. |
| 5 | What annotation on a critical stateful pod prevents Karpenter Consolidation from voluntarily evicting that pod to save money? | karpenter.sh/do-not-disrupt: "true". |
| 6 | What Kubernetes construct ensures replicas of a deployment are distributed evenly across Availability Zones (maxSkew: 1)? |
topologySpreadConstraints keyed on topology.kubernetes.io/zone and kubernetes.io/hostname. |
Lesson 3: Helm & Kustomize
| # | One-Line Question | One-Line Answer |
|---|---|---|
| 1 | What is the fundamental architectural difference between Helm and Kustomize? | Helm is a Go-templating package manager with release lifecycle history ({{ .Values.x }}), while Kustomize is a template-free YAML overlay patching engine built natively into kubectl -k. |
| 2 | Where does Helm v3 store its release state history inside a Kubernetes cluster? | As compressed, double-Base64-encoded Kubernetes Secret objects labeled owner=helm inside the target release namespace. |
| 3 | How do you recover a Helm release stuck in pending-upgrade? |
Run helm history <release> and execute helm rollback <release> <last-deployed-revision> (or delete the stuck pending-upgrade Helm secret revision). |
| 4 | What is the difference between a Strategic Merge Patch and a JSON 6902 Patch in Kustomize? | Strategic Merge looks like a partial Kubernetes YAML manifest that merges by key/name, while JSON 6902 uses explicit surgical operations (op: replace, path: /spec/replicas, value: 5). |
| 5 | How does Kustomize trigger an automatic rolling restart of a Deployment whenever a ConfigMapโs data changes? |
Kustomize configMapGenerator appends a 10-character content SHA hash suffix to the ConfigMap name (e.g., app-config-8g9f2k) and updates the Deploymentโs volume reference automatically. |
Lesson 4: Ingress & AWS ALB Controller
| # | One-Line Question | One-Line Answer |
|---|---|---|
| 1 | What is the difference between alb.ingress.kubernetes.io/target-type: instance and target-type: ip? |
instance routes ALB traffic to a NodePort on EC2 nodes (adding an extra kube-proxy hop), whereas ip routes directly from the ALB to the Podโs VPC IP address via AWS VPC CNI. |
| 2 | How do you share a single AWS Application Load Balancer across 50 Ingress objects in different namespaces? | Add the annotation alb.ingress.kubernetes.io/group.name: shared-prod-alb to all 50 Ingress manifests. |
| 3 | Why do users experience intermittent HTTP 502 / 504 Bad Gateway errors for 5โ10 seconds during a rolling update behind an AWS ALB? | kubelet sends SIGTERM to the pod at the exact same millisecond the Endpoints controller notifies the ALB controller; the pod stops accepting connections before the ALB finishes removing its IP from the Target Group. |
| 4 | What two configurations completely eliminate the AWS ALB 502 Bad Gateway race condition during pod termination? | Add a container lifecycle.preStop hook (exec: command: ["/bin/sleep", "15"]) and enable Pod Readiness Gates (elbv2.k8s.aws/pod-readiness-gate-inject: enabled) on the namespace. |
| 5 | How do you automatically sync Kubernetes Ingress and Service hostnames into AWS Route 53 Hosted Zones? |
Deploy ExternalDNS with an IRSA role granting route53:ChangeResourceRecordSets. |
Lesson 5: Prometheus & PromQL
| # | One-Line Question | One-Line Answer |
|---|---|---|
| 1 | What are the 4 core Prometheus metric types? | Counter (monotonic cumulative count), Gauge (goes up/down), Histogram (server-side bucketed latency), and Summary (client-side quantiles). |
| 2 | What is the exact difference between PromQL rate(metric[5m]) and irate(metric[5m])? |
rate() calculates the average per-second rate across all samples in the 5m window (smooth, used for alerts); irate() uses only the last 2 samples (spiky, used for high-resolution graphs). |
| 3 | How do you calculate the 99th percentile (p99) HTTP latency from a Prometheus Histogram in PromQL? | histogram_quantile(0.99, sum by (le, service) (rate(http_request_duration_seconds_bucket[5m]))). |
| 4 | How do you immediately drop a rogue high-cardinality label at scrape time before it enters Prometheus TSDB? | Add a metric_relabel_configs rule with action: labeldrop and regex: "user_id" inside the ServiceMonitor or scrape_config. |
| 5 | How does Thanos Sidecar + Thanos Querier deduplicate metrics from two identical HA Prometheus replicas? | Both Prometheus servers attach an external_labels: {replica: "a/b"} label, and thanos-query runs with --query.replica-label=replica to merge and deduplicate series on the fly. |
Lesson 6: CoreDNS ndots & Cluster Upgrades
| # | One-Line Question | One-Line Answer |
|---|---|---|
| 1 | Why does a Kubernetes pod querying api.stripe.com generate 8 unnecessary DNS queries before resolving the real IP? |
Default /etc/resolv.conf sets ndots:5; since api.stripe.com has only 2 dots (2 < 5), glibc appends all 4 cluster search domains (in both IPv4 A and IPv6 AAAA) before querying the absolute domain. |
| 2 | How does NodeLocal DNSCache prevent Linux kernel conntrack table exhaustion and 5-second UDP DNS timeouts? | It runs a local caching daemon on every node (169.254.20.10) that serves cached queries locally and upgrades upstream cache-misses to CoreDNS from lossy UDP to multiplexed TCP. |
| 3 | Can you upgrade an Amazon EKS cluster directly from version 1.28 to 1.31 in one step? |
No, Kubernetes strictly prohibits skipping minor versions; you must upgrade sequentially (1.28 โ 1.29 โ 1.30 โ 1.31). |
| 4 | What CLI tool scans a live cluster and Git manifests to detect removed or deprecated Kubernetes API versions before upgrading? | Pluto (pluto detect-all-in-cluster) or Kubent (kube-no-trouble). |
| 5 | In what exact sequence must components be upgraded during a production EKS cluster upgrade? | (1) Audit deprecated APIs โ (2) Upgrade EKS Control Plane โ (3) Upgrade core add-ons (vpc-cni, coredns, kube-proxy, ebs-csi) โ (4) Roll/replace Worker Nodes. |
๐ Phase 5: GitOps & Control Planes (All Lessons)
Lesson 1: ArgoCD App of Apps
| # | One-Line Question | One-Line Answer |
|---|---|---|
| 1 | What are the 3 core architectural microservices that make up an ArgoCD installation? | argocd-server (API/UI), argocd-repo-server (clones Git & renders Helm/Kustomize), and argocd-application-controller (StatefulSet comparing live K8s state against Git). |
| 2 | What is the difference between automated.prune: true and automated.selfHeal: true in an ArgoCD Application? |
prune: true deletes cluster resources when their YAML files are deleted from Git; selfHeal: true overwrites manual kubectl edit changes on the cluster back to match Git. |
| 3 | How do you force ArgoCD to install CRDs before deploying operators, and operators before deploying custom resources? | Annotate manifests with ArgoCD Sync Waves (argocd.argoproj.io/sync-wave: "-1", "0", "1"), which applies lower numbers first and waits for health checks between waves. |
| 4 | How do you fix an ArgoCD Infinite Sync Loop caused by HPA modifying spec.replicas? |
Remove spec.replicas from the Git YAML manifest or add ignoreDifferences for /spec/replicas with RespectIgnoreDifferences=true in syncOptions. |
Lesson 2: Argo Rollouts & Canaries
| # | One-Line Question | One-Line Answer |
|---|---|---|
| 1 | What CRD replaces kind: Deployment when adopting progressive delivery with Argo Rollouts? |
kind: Rollout (apiVersion: argoproj.io/v1alpha1). |
| 2 | What Argo Rollouts CRD queries Prometheus or Datadog during a canary rollout and triggers an automatic rollback if error rates breach 1%? | AnalysisTemplate (instantiated at runtime as an AnalysisRun). |
| 3 | What causes the Canary Database Schema Trap where an automated canary rollback brings down 100% of production? | The canary executed a destructive SQL migration (e.g., renaming or dropping a column) that broke backward compatibility with the stable v1 pods; prevent via Expand-and-Contract. |
Lesson 3: Crossplane Control Planes
| # | One-Line Question | One-Line Answer |
|---|---|---|
| 1 | What is the fundamental architectural difference between Terraform and Crossplane? | Terraform is a CLI/pipeline tool that runs once at CI time, whereas Crossplane runs inside Kubernetes as an active 24/7 reconciliation loop that continuously self-heals cloud drift. |
| 2 | Why did Crossplane introduce Composition Functions (KCL / Python / Go) to replace traditional Patch-and-Transform YAML? | Traditional YAML patching became thousands of lines of untestable spaghetti lacking loops or conditionals; KCL Functions allow concise, strongly typed programmatic logic with unit testing. |
| 3 | What flag on a Crossplane Managed Resource prevents kubectl delete from accidentally destroying a production cloud database? |
spec.deletionPolicy: Orphan (alongside spec.managementPolicies: ["Observe", "Create", "Update"] omitting "Delete"). |
Lesson 4 & 5: ApplicationSets & Hub-and-Spoke ArgoCD
| # | One-Line Question | One-Line Answer |
|---|---|---|
| 1 | What does the Matrix Generator do in an ArgoCD ApplicationSet? |
It computes the Cartesian Product (M ร N) of two generatorsโe.g., combining 10 Clusters (Cluster Generator) ร 15 Add-ons (Git Generator) = 150 Applications from one file. |
| 2 | How do you protect production clusters from accidental mass-deletion when a directory is renamed in an ApplicationSet? |
Configure spec.syncPolicy.preserveResourcesOnDeletion: true (or set applicationsSync: create-update) on the ApplicationSet. |
| 3 | Why does argocd-application-controller get OOMKilled when managing 50+ spoke clusters, and what is the fix? |
A single controller replica cannot hold the Informer caches for 50 clusters in RAM; enable Controller Dynamic Sharding (replicas: 5) across spoke clusters. |
๐ Phase 6: Service Mesh & eBPF (All Lessons)
Lesson 1โ4: Cilium, eBPF, L7 Policies & ClusterMesh
| # | One-Line Question | One-Line Answer |
|---|---|---|
| 1 | How does Cilium (kubeProxyReplacement: true) achieve O(1) service load-balancing compared to O(N) iptables? |
It attaches eBPF programs to kernel socket and TC hooks that look up Service-to-Pod backends directly inside O(1) eBPF Hash Maps in kernel memory. |
| 2 | What ensures an eBPF program loaded into the Linux kernel cannot crash the kernel or enter an infinite loop? | The In-Kernel eBPF Verifier, which performs static DAG code analysis, bounds-checking, and memory safety verification before JIT compilation. |
| 3 | Why are Pod IP addresses unreliable for firewall rules, and what does Cilium use instead? | Pod IPs churn constantly during autoscaling; Cilium uses cryptographic Security Identities (numeric ID) derived from pod labels instead of IP addresses. |
| 4 | What critical traffic is accidentally broken if you apply a Default Deny-All Egress policy without an explicit DNS exception? | Pods immediately lose the ability to resolve DNS names because UDP/TCP Port 53 traffic to kube-dns / coredns in kube-system is blocked. |
| 5 | Name the 3 role-oriented CRDs of the Kubernetes Gateway API and who owns each. | GatewayClass (Infrastructure Provider), Gateway (Platform/SRE Team โ listeners & TLS), and HTTPRoute / GRPCRoute (Application Developers โ paths & weights). |
| 6 | How do you turn a standard Kubernetes Service into a global multi-cluster service with local-zone preference in Cilium ClusterMesh? |
Add annotations service.cilium.io/global: "true" and service.cilium.io/affinity: "local". |
Phase 4 โ Lesson 7: Azure AKS Internals, Cilium CNI Overlay & Azure Dependent PaaS Ecosystem
| # | One-Line Question | One-Line Model Answer |
|---|---|---|
| 1 | Why is Azure CNI Overlay powered by Cilium preferred over legacy Kubenet and traditional flat Azure CNI for large AKS clusters? |
Kubenet caps at 400 nodes (UDR route limit) and flat Azure CNI exhausts VNet IPs, whereas Cilium CNI Overlay uses an isolated 100.64.0.0/16 pod CIDR with O(1) eBPF routing to scale to 5,000+ nodes. |
| 2 | Why should production AKS node pools always use Ephemeral OS Disks (--node-osdisk-type Ephemeral) instead of Managed OS Disks? |
Ephemeral OS Disks run on the VM host local NVMe/Temp SSD cache at $0 cost with sub-millisecond latency, preventing OS disk IOPS throttling (PLEG is not healthy / NodeNotReady) during heavy image pulls. |
| 3 | Why must AKS System Node Pools be tainted with CriticalAddonsOnly=true:NoSchedule across 3 Availability Zones? |
To prevent application pods from scheduling onto system nodes and starving critical control-plane add-ons (coredns, konnectivity-agent, metrics-server) of CPU or memory. |
| 4 | Why was aad-pod-identity (v1) deprecated in favor of AKS Entra Workload Identity? |
aad-pod-identity intercepted IMDS (169.254.169.254) via node-level iptables rules with race conditions, whereas Entra Workload Identity uses standard Kubernetes OIDC projected ServiceAccount tokens (AZURE_FEDERATED_TOKEN_FILE). |
| 5 | What causes the AADSTS70021: No matching federated identity record found error in AKS Workload Identity? |
A mismatch between the Federated Credential issuer (e.g. trailing /) or subject (system:serviceaccount:<ns>:<sa>) in Entra ID, or omitting the azure.workload.identity/use: "true" label on the Pod. |
| 6 | Why should production AKS clusters use Application Gateway for Containers (ALB for AKS) instead of legacy AGIC? |
Legacy AGIC updates Application Gateway v2 via slow ARM control-plane calls (30โ90s latency on pod churn), whereas App Gateway for Containers uses Kubernetes Gateway API and a fast data-plane API to update pod endpoints in < 1 second. |
| 7 | What are the 5 consistency levels of Azure Cosmos DB in order from strongest to weakest? | Strong โ Bounded Staleness โ Session (Default) โ Consistent Prefix โ Eventual. |
| 8 | Why does Azure Cosmos DB throw HTTP 429 (RequestRateTooLarge) at only 15% total RU/s utilization, and how do you fix it? |
Provisioned RU/s is divided equally across N physical partitions (max 10,000 RU/s and 50 GB per physical partition); a skewed key overloads one partition and requires Hierarchical Partition Keys or write-sharding suffixes. |
| 9 | In Azure System Design, when do you choose Azure Service Bus vs. Azure Event Hubs vs. Azure Event Grid? | Use Service Bus for transactional enterprise messaging (FIFO sessions, DLQ), Event Hubs for high-throughput Kafka-compatible event streaming, and Event Grid for serverless reactive HTTP event push. |
| 10 | Why must stateful RWO workloads on AKS use Premium_ZRS (Zone-Redundant Storage) Azure Disks instead of Premium_LRS? |
Premium_LRS pins the disk to a single Availability Zone (blocking pod reschedule on AZ failure), whereas Premium_ZRS replicates synchronously across 3 AZs and attaches immediately in any zone. |