Kubernetes & Cloud-Native Orchestration Master Interview Bank
K8s control plane architecture (etcd, kube-scheduler), Pod lifecycle, Deployments, Services, Ingress, CNI networking, CSI volumes, and HPA autoscaling.
Curriculum Roadmap & Learning Path
3 StagesPart 1: Basic & Foundational Concepts (Junior / Entry-Level)
13 QuestionsWhat is Kubernetes (K8s), and why is it needed over bare Docker containers?
While Docker packages and runs individual containers on a single host, running distributed production systems requires managing hundreds of containers across dozens of physical or cloud servers.
What is a Pod, and why is it the smallest deployable unit in Kubernetes?
Kubernetes does not run containers directly; it wraps one or more containers into a Pod.: Shared Context: All containers in a Pod share the exact same • Network Namespace: Same IP address, port space, and localhost loopback interface • Storage Volumes: Mounted storage volumes can be accessed simultaneously by all containers in the Pod.
What are Namespaces in Kubernetes and what are their isolation boundaries?
A Namespace is a logical partition or virtual cluster within a single physical Kubernetes cluster.: Default Namespaces • default: Default space for user workloads • kube-system: Reserved for core Kubernetes control plane and add-on components (CoreDNS, kube-proxy) • kube-public: Universally readable namespace for public cluster discovery.
Imperative (`kubectl create/run`) vs. Declarative (`kubectl apply -f`) Management.
Imperative Management: You tell Kubernetes what actions to perform step-by-step.
Essential `kubectl` Commands for Daily Operations.
Essential daily kubectl commands allow engineers to inspect cluster topology, tail container logs, troubleshoot pod scheduling events, and apply declarative YAML configurations. #### Code Example.
Kubernetes Architecture: Control Plane Components vs. Worker Node Agents.
Control Plane (Master Nodes - The Brain) • kube-apiserver: The front door of Kubernetes • etcd: Distributed key-value store holding 100% of the cluster's state, configurations, and secrets • kube-scheduler: Watches for newly created unscheduled Pods and assigns them to optimal Worker Nodes.
What is the Pod Lifecycle and what are the Pod Phases?
A Pod progresses through distinct operational phases: Pending: Accepted by API Server, but waiting for scheduling, downloading container images, or waiting for Init Containers to complete • Running: Bound to a node; at least one primary container is actively running or restarting.
Liveness, Readiness, and Startup Probes: Differences and Use Cases.
Startup Probe • Tests if a slow-starting legacy application (e.g. Java Spring Boot taking 90 seconds to boot) has finished initializing • While running, it disables Liveness and Readiness checks so the Kubelet doesn't mistakenly kill the slow-starting container • Liveness Probe.
Deployments vs. ReplicaSets vs. StatefulSets: When to use each?
ReplicaSet: Low-level controller that ensures a specified number of identical Pod replicas are running at any given time • Deployment: Higher-level controller that manages ReplicaSets • StatefulSet: Manages stateful workloads (databases like PostgreSQL, Redis clusters, Kafka brokers).
Kubernetes Services: ClusterIP vs. NodePort vs. LoadBalancer vs. Headless.
Pods are ephemeral; when replaced, they receive new IP addresses. A Service provides a single stable IP address and DNS name that load-balances traffic across matching Pods.: ClusterIP (Default) • Exposes the service on a cluster-internal private IP • Accessible only from inside the cluster • NodePort.
ConfigMaps and Secrets: Configuration Management.
ConfigMap: Stores non-confidential configuration (environment variables, config files like nginx.conf) in plaintext key-value pairs • Secret: Stores sensitive data (passwords, TLS certificates, OAuth tokens) • By default, secrets are stored as base64-encoded strings in etcd.
Persistent Volumes (PV), PVCs, and StorageClasses.
Decouples storage infrastructure from application deployment: StorageClass (SC): Defines the storage provisioner and tier (e.g., AWS gp3, GCP pd-ssd, Azure managed-csi) • PersistentVolumeClaim (PVC): A request for storage submitted by a developer (e.g., "I need 50GB of ReadWriteOnce SSD storage").
Resource Requests vs. Resource Limits (CPU & Memory).
```yaml resources: requests: cpu: "250m" # 0.25 of a CPU core memory: "512Mi" # 512 Megabytes limits: cpu: "1000m" # 1 full CPU core memory: "1Gi" # 1 Gigabyte.
Part 2: Core Architecture & Implementation (Mid-Level)
11 QuestionsThe etcd Distributed Datastore: Raft Consensus, Quorum, and Latency.
etcd is a strongly consistent (CP), distributed key-value store using the Raft consensus algorithm. Every Kubernetes object is stored in etcd under keys prefixed with /registry/. \text{Quorum} = \left\lfloor \frac{N}{2} \right\rfloor + 1: A 3-node etcd cluster tolerates 1 failure (2 required for quorum).
Kube-API Server Request Lifecycle: Authentication, Authorization, and Admission Controllers.
Every request to kube-apiserver passes through a strict 3-phase pipeline before being committed to etcd.
Kube-Scheduler Deep-Dive: Filtering, Scoring, Affinity, Taints, and Tolerations.
The scheduler assigns unscheduled Pods to optimal worker nodes in a two-phase process: Filtering (Predicates): Eliminates unqualified nodes • Does the node have enough unreserved CPU/memory requests? • Does the node match Pod nodeSelector / nodeAffinity? • Does the node have a Taint that the Pod cannot Tolerate?.
Ingress Controllers vs. Kubernetes Gateway API.
Ingress (Legacy Standard) • Manages external HTTP/HTTPS routing into services using hostnames and paths • Limitations: Tightly coupled; single manifest defines both routing rules and infrastructure configuration; poor support for non-HTTP protocols • Kubernetes Gateway API (Modern Replacement).
Kubernetes Networking Model & CNI: Calico vs. Cilium (eBPF).
The fundamental rule of Kubernetes networking: Every Pod gets its own unique IP address, and all Pods can communicate with all other Pods without NAT. A Container Network Interface (CNI) plugin implements this model: Calico: Uses standard Linux iptables and BGP routing to manage Pod routing and NetworkPolicies • Cilium (Modern Standard).
Kubernetes Network Policies & Microsegmentation.
By default, Kubernetes has a flat, open network: any Pod can establish a network socket to any other Pod in the cluster. A NetworkPolicy acts as a stateful firewall for Pods.
Horizontal Pod Autoscaler (HPA) vs. Vertical Pod Autoscaler (VPA) vs. KEDA.
Horizontal Pod Autoscaler (HPA): Scales the number of pod replicas up or down based on CPU, memory, or custom metrics • Vertical Pod Autoscaler (VPA): Adjusts the CPU and memory requests/limits of existing pods • Warning: Running HPA and VPA on the same resource on CPU/Memory causes catastrophic scaling oscillation fights!
Cluster Autoscaling: Kubernetes Cluster Autoscaler vs. Karpenter.
When new Pods cannot be scheduled because nodes have exhausted their CPU/RAM requests: Kubernetes Cluster Autoscaler (CAS) • Tightly coupled to Cloud Auto Scaling Groups (ASGs) • Slow (takes 3 to 7 minutes to provision nodes) • Scales pre-configured homogeneous node groups (e.g. all m5.xlarge).
Quality of Service (QoS) Classes: Guaranteed vs. Burstable vs. BestEffort.
When a worker node runs out of physical memory, the Kubelet evicts Pods based on their QoS class: Guaranteed (Safest) • requests == limits for both CPU and Memory • Lowest eviction priority • Burstable (Standard).
Zero-Downtime Rolling Updates: `maxSurge`, `maxUnavailable`, and `preStop` Hooks.
To achieve 100% zero dropped connections during a deployment update.
Troubleshooting: CrashLoopBackOff, ImagePullBackOff, and Pending Pods.
ImagePullBackOff • Typo in image name or tag • Missing image pull secret for private registry (imagePullSecrets) • Container registry rate limit hit (e.g. Docker Hub anonymous pulls).
Part 3: Advanced Internals, Scale & Production Security (Senior / Lead)
26 QuestionsKubernetes Role-Based Access Control (RBAC): Least Privilege Architecture.
RBAC regulates who can perform what actions on which Kubernetes resources: Role / ClusterRole: Defines permissions (Verbs: get, list, watch, create, delete) on (Resources: pods, services, secrets) • RoleBinding / ClusterRoleBinding: Binds the role to a Subject (User, Group, or ServiceAccount).
Custom Resource Definitions (CRDs) and the Operator Pattern.
CRD (Custom Resource Definition): Extends the Kubernetes API with custom schema objects (e.g., PostgresCluster, KafkaTopic) • Operator Pattern: Combines a CRD with a custom Controller running an infinite Reconcile Loop written in Go (using controller-runtime or Kubebuilder).
Service Mesh Architecture: Istio vs. Linkerd, Sidecars vs. Ambient Mesh.
A Service Mesh manages microservice-to-microservice traffic at Layer 7: Features: Transparent mutual TLS (mTLS), distributed tracing, circuit breaking, fault injection, and canary traffic splitting • Sidecar Architecture (Classic Istio/Linkerd) • Injects an Envoy proxy container into every single Pod.
Pod Security Standards (PSS) & Pod Security Admission (PSA).
Replaces the deprecated PodSecurityPolicy (PSP) with native namespace-level enforcement. Three standard tiers: Privileged: Unrestricted; allows containers to run as root, mount host devices, and disable seccomp • Baseline: Minimally restrictive; prevents known privilege escalations • Restricted (Production Standard).
Deep Dive: CoreDNS Performance, `ndots:5`, and DNS Latency Spikes.
By default, the Linux /etc/resolv.conf injected by Kubelet into every Pod contains.
Pod Disruption Budgets (PDB) & Safe Node Maintenance.
When cloud providers perform node upgrades or when Karpenter drains nodes for bin-packing, pods are evicted: If all 3 replicas of your payment API are evicted simultaneously -> Outage! • Pod Disruption Budget (PDB): Enforces high-availability constraints during voluntary disruptions.
Multi-Tenant Cluster Governance: LimitRanges, ResourceQuotas, and Virtual Clusters (`vcluster`).
Preventing noisy neighbor problems when multiple development teams share one cluster: ResourceQuota: Sets hard limits on total aggregate compute resources per namespace (e.g., Team A can consume at most 40 cores and 100GB RAM).
Handling Ephemeral Storage Evictions.
Pods write logs, build artifacts, and scratch data to /var/lib/kubelet/pods/ on the host disk: If a pod writes a runaway 20GB log file without constraints, the host node disk hits 85% utilization, triggering DiskPressure • Kubelet begins evicting Pods randomly! • Solution: Always define ephemeral-storage requests and limits.
Disaster Recovery: etcd Snapshot Backup, Restores, and Quorum Failures.
Because etcd contains the complete cluster state, disaster recovery procedures must be tested regularly: Automated Snapshot.
Observability: Prometheus Pull Model, ServiceMonitors, and OpenTelemetry in K8s.
Monitoring microservices in dynamic Kubernetes environments: ServiceMonitor CRD (Prometheus Operator) • Eliminates hardcoded scrape endpoints in Prometheus config • Automatically discovers pods and scrapes metrics based on Kubernetes service labels.
Hardening Kubernetes Workloads with Kyverno and Open Policy Agent (OPA) Gatekeeper.
Enforcing corporate security policies at API admission time using validating webhooks: Kyverno Policy Example: Enforcing Read-Only Root Filesystem.
High-Availability Control Plane Design across Multiple Availability Zones.
In a production enterprise cluster spanning 3 Availability Zones (AZ-a, AZ-b, AZ-c): Deploy 3 Control Plane nodes, placing exactly 1 node per AZ • etcd runs co-located on these 3 nodes (forming a 3-node Raft quorum) • A managed Cloud Network Load Balancer (NLB) sits in front of the 3 kube-apiserver instances on port 6443.
Kubernetes CSI Driver Internals: Dynamic Volume Snapshots and Cloning.
The Container Storage Interface (CSI) separates storage vendor implementations from core Kubernetes: CSI Components • csi-provisioner: Creates cloud disks when PVCs are declared • csi-attacher: Attaches EBS/GPD volumes to worker EC2/GCE VM instances • csi-snapshotter: Takes point-in-time volume snapshots via VolumeSnapshot CRD.
Autoscaling with Cluster Proportional Autoscaler and NodeLocal DNSCache.
Core infrastructure services like CoreDNS can become severe performance bottlenecks as cluster node counts grow from 5 to 500: Cluster Proportional Autoscaler (CPA): Automatically scales CoreDNS replica counts proportionally based on the total number of worker nodes and • NodeLocal DNSCache.
Managing Node Drain, Cordon, and Automated OS Patching (Kured).
kubectl cordon : Marks the node as unschedulable; prevents new Pods from being placed on it without affecting running workloads • kubectl drain --ignore-daemonsets --delete-emptydir-data: Safely evicts all running Pods respecting PodDisruptionBudgets, signaling them to • Kured (Kubernetes Reboot Daemon).
Architecting an Enterprise Kubernetes Platform: The 10 Golden Production Commandments.
Never deploy raw Pods: Always use Deployments or StatefulSets • Explicit Resource Requests & Limits: Every single container must define both CPU and memory requests • Readiness and Liveness Probes: Mandatory on all production workloads • Enforce Read-Only Root Filesystems & Non-Root Users: No containers running as UID 0.
Kubernetes Service Types: ClusterIP vs NodePort vs LoadBalancer vs Ingress.
ClusterIP (Default): Exposes service on an internal cluster IP address • NodePort: Opens a static high-range port (30000-32767) on every worker node • LoadBalancer: Provisions a real cloud load balancer (AWS NLB/ALB, GCP LB, Azure LB) with a public IP that routes directly to NodePort/ClusterIP.
Kubernetes Gateway API: The Evolution of Ingress.
The Gateway API replaces legacy Ingress with a modern, role-oriented routing specification: Separation of Concerns • Infrastructure Architect creates the GatewayClass • Cluster Operator provisions the Gateway (listeners, TLS certificates, IP addresses).
Persistent Storage: StorageClass, PersistentVolume (PV), and PVC.
Decouples storage infrastructure from application deployments: StorageClass: Defines the storage provisioner (e.g. AWS EBS gp3, Azure Disk, Ceph) and dynamic volume allocation parameters.
StatefulSets and Headless Services.
Deployments treat Pods as interchangeable cattle. StatefulSets treat Pods as unique pets: Stable Identity: Pods are named sequentially (mysql-0, mysql-1, mysql-2) and started/terminated in strict ordinal order.
Pod Disruption Budgets (PDB) and Zero-Downtime Node Draining.
When upgrading Kubernetes nodes (kubectl drain ), Kubernetes evicts all running Pods from the node: Pod Disruption Budget (PDB): Enforces that a minimum number of Pod replicas (e.g. minAvailable: 2 or maxUnavailable: 25%) must remain online and.
Pod Placement Controls: Node Affinity, Taints, and Tolerations.
NodeSelector: Basic key-value matching to place pods on specific labeled nodes (disk: ssd) • Node Affinity (requiredDuringScheduling.. • Taints & Tolerations: A Taint on a node (gpu=true:NoSchedule) repels Pods.
Service Mesh Architecture: Istio and Ambient Mesh.
A Service Mesh manages service-to-service communication transparently: Sidecar Model: Injects an Envoy proxy container into every application Pod • Core Features • Zero-Trust Mutual TLS (mTLS): Automatic cryptographic encryption and identity verification between services.
Pod Security Standards (PSS) and Security Context.
Replaces legacy PodSecurityPolicies (PSP) with three admission levels applied via namespace labels: Privileged: Unrestricted execution (system components, network daemons) • Baseline: Minimally restrictive; blocks known privilege escalations.
The Kubernetes Operator Pattern and CRDs.
An Operator encodes human operational domain knowledge (backing up databases, handling failovers, upgrading clusters) into automated software: Custom Resource Definition (CRD): Extends the Kubernetes API with custom objects (e.g. kind: PostgresCluster).
Cluster Autoscaling: Horizontal Pod Autoscaler (HPA) vs Karpenter.
Horizontal Pod Autoscaler (HPA): Scales the number of Pod replicas based on CPU, memory, or custom Prometheus metrics • Cluster Autoscaler (Legacy): Scales node groups slowly by launching pre-configured VM instance templates • Karpenter (Next-Gen Node Autoscaler): High-speed, just-in-time node provisioner.