Kubernetes Interview Questions (50+ Detailed Q&A)
1. Architecture & Components
1. K8s Architecture Diagram
1. K8s Architecture Diagram
- Control Plane (Master):
- API Server: Gateway. Only component talking to etcd.
- Etcd: Key-Value store. Source of truth.
- Scheduler: Assigns Pods to Nodes.
- Controller Manager: Reconciles state (ReplicaSet, Node).
- Cloud Controller: Talks to AWS/GCP (LBs, Disk).
- Worker Node:
- Kubelet: Agent talking to API Server. Manages Pods.
- Kube-proxy: Network rules (IPTables).
- Runtime: Docker/Containerd.
kubectl apply -f deployment.yaml\u2192 API Server- API Server validates, writes to etcd
- Deployment Controller sees new Deployment \u2192 creates ReplicaSet
- ReplicaSet Controller sees new RS \u2192 creates Pod specs
- Scheduler sees unscheduled Pods \u2192 assigns to Nodes
- Kubelet on Node sees new Pod assignment \u2192 pulls image, starts container
- Kube-proxy updates iptables rules for Service
- API Server down: Cluster unmanageable (but existing Pods keep running)
- etcd down: Cluster state lost (catastrophic)
- Scheduler down: New Pods stay Pending
- Kubelet down: Node marked NotReady, Pods evicted after timeout
2. Role of Etcd
2. Role of Etcd
3. Kube-proxy modes
3. Kube-proxy modes
- IPTables: Default. Fast. Linux Kernel routing.
- IPVS: For massive scale (thousands of services). Hash table based.
- Userspace: Old, slow.
4. API Server Role
4. API Server Role
5. Scheduler Logic
5. Scheduler Logic
- Filtering: Which nodes meet requirements? (RAM, CPU, Taints).
- Scoring: Rank valid nodes (Least load, Image affinity).
- Binding: Notify API Server.
6. Controller Pattern
6. Controller Pattern
7. CRI, CNI, CSI
7. CRI, CNI, CSI
- CRI (Runtime): Swap Docker for Containerd/CRI-O.
- CNI (Network): Swap Flannel for Calico.
- CSI (Storage): Swap EBS for PD-SSD.
8. Pause Container
8. Pause Container
9. Pod Lifecycle
9. Pod Lifecycle
10. Static Pods
10. Static Pods
/etc/kubernetes/manifests).
Not managed by API Server/scheduler.
Used for Control Plane components (etcd, apiserver) in self-hosted clusters.2. Workloads & Scheduling
11. Deployment vs StatefulSet vs DaemonSet
11. Deployment vs StatefulSet vs DaemonSet
- Deployment: Stateless. Random names (
app-xyz). Easy update/rollback. - StatefulSet: Sticky identity (
app-0,app-1). Ordered startup. Persistent storage attachment. - DaemonSet: One pod per Node. (Logs, Monitoring).
12. Jobs vs CronJobs
12. Jobs vs CronJobs
- Job: Run to completion (Batch). Retries on failure.
- CronJob: Time-based schedule.
13. Taints & Tolerations
13. Taints & Tolerations
14. Node Affinity vs Selector
14. Node Affinity vs Selector
- Selector: Simple equality (
disk=ssd). Hard rule. - Affinity: Expressive (
Not In,Exists). Soft rules (preferredDuringScheduling).
15. Init Containers
15. Init Containers
16. Sidecar Pattern
16. Sidecar Pattern
17. Resource Requests vs Limits
17. Resource Requests vs Limits
- Request: Guaranteed. Used for Scheduling.
- Limit: Max cap. If CPU exceeded -> Throttle. If RAM exceeded -> OOMKill.
18. Pod Disruption Budget (PDB)
18. Pod Disruption Budget (PDB)
19. Rolling Update vs Recreate
19. Rolling Update vs Recreate
- Rolling: New pod up -> Old pod down. Zero downtime.
- Recreate: All old down -> All new up. Downtime.
20. QoS Classes
20. QoS Classes
- Guaranteed: Limit == Request for all. (Last to be evicted).
- Burstable: Request < Limit.
- BestEffort: No requests. (First to be evicted).
3. Networking & Service Discovery
21. Pod-to-Pod Networking Rules
21. Pod-to-Pod Networking Rules
- Every Pod gets an IP.
- All Pods can talk to all Pods without NAT.
22. Service Types
22. Service Types
- ClusterIP: Internal VIP.
- NodePort: Random port (30000+) on Node IP.
- LoadBalancer: Cloud LB.
- ExternalName: DNS alias to external service.
23. How does Service Discovery work?
23. How does Service Discovery work?
my-svc.my-ns.svc.cluster.local.24. Ingress vs Ingress Controller
24. Ingress vs Ingress Controller
- Ingress: The Rule (Resource). “Route /api to Service B”.
- Controller: The Implementation (Nginx Pod). Reads Rule, updates
nginx.conf.
25. Network Policies
25. Network Policies
26. Headless Service
26. Headless Service
ClusterIP: None.
DNS returns List of Pod IPs directly, not VIP.
Used for StatefulSets (Direct peering).27. Service Mesh (Istio)
27. Service Mesh (Istio)
28. CNI Plugins (Flannel vs Calico)
28. CNI Plugins (Flannel vs Calico)
- Flannel: VXLAN Overlay. Simple. No NetPol.
- Calico: Layer 3 BGP. Complex. Supports NetPol.
29. Gateway API
29. Gateway API
30. Port Forwarding
30. Port Forwarding
4. Storage & Config
31. PV vs PVC
31. PV vs PVC
- PV: Physical volume (Disk). Admin creates it.
- PVC: Claim (Request). User creates it.
32. StorageClass
32. StorageClass
33. Access Modes
33. Access Modes
- RWO: ReadWriteOnce (1 Node). Block storage.
- RWX: ReadWriteMany (Multiple Nodes). NFS/EFS.
34. ConfigMap vs Secret
34. ConfigMap vs Secret
- Conf: Plain text. Env vars, files.
- Secret: Base64. Encrypted at rest (if configured).
35. Downward API
35. Downward API
36. EmptyDir
36. EmptyDir
5. Troubleshooting & Security (Deep Dive)
37. `CrashLoopBackOff` Debugging
37. `CrashLoopBackOff` Debugging
kubectl logs(App error).kubectl describe(Liveness probe failed? OOM?).kubectl get events.
38. `ImagePullBackOff`
38. `ImagePullBackOff`
39. `Pending` State
39. `Pending` State
40. `Terminating` Stuck
40. `Terminating` Stuck
delete pod --grace-period=0 --force.41. RBAC (Role vs ClusterRole)
41. RBAC (Role vs ClusterRole)
- Role: Namespaced (Can read Pods in ‘dev’).
- ClusterRole: Global (Can read Nodes).
- Binding: Connects User to Role.
42. ServiceAccount
42. ServiceAccount
43. Security Context
43. Security Context
runAsUser: 1000. readOnlyRootFilesystem.
Defines privileges at Pod/Container level.44. Admission Controllers
44. Admission Controllers
- Validating: “No, wrong schema”. (OPA Gatekeeper).
- Mutating: “I’ll add a sidecar automatically”.
45. OPA (Open Policy Agent)
45. OPA (Open Policy Agent)
46. Etcd Encryption
46. Etcd Encryption
47. Network Policies Default
47. Network Policies Default
48. Container Runtime Security
48. Container Runtime Security
49. Upgrading Cluster
49. Upgrading Cluster
- Upgrade Master components.
- Drain Node (Evict pods).
- Upgrade Kubelet.
- Uncordon.
50. Helm vs Kustomize
50. Helm vs Kustomize
- Helm: Templating (
{{ .Values }}). Package Management. Complex. - Kustomize: Overlay/Patching. Native to Kubectl. Cleaner (No templates).
6. Kubernetes Medium Level Questions
51. DaemonSet
51. DaemonSet
52. StatefulSet
52. StatefulSet
53. Job and CronJob
53. Job and CronJob
54. Init Containers
54. Init Containers
55. Sidecar Pattern
55. Sidecar Pattern
56. Resource Requests and Limits
56. Resource Requests and Limits
- Requests: Minimum guaranteed
- Limits: Maximum allowed
57. Pod Disruption Budget
57. Pod Disruption Budget
58. Network Policies
58. Network Policies
59. Ingress Controllers
59. Ingress Controllers
60. Service Mesh (Istio)
60. Service Mesh (Istio)
7. Kubernetes Advanced Level Questions
61. Custom Resource Definitions (CRDs)
61. Custom Resource Definitions (CRDs)
62. Operators
62. Operators
63. Admission Controllers
63. Admission Controllers
64. Pod Security Standards
64. Pod Security Standards
65. RBAC Advanced Patterns
65. RBAC Advanced Patterns
66. Cluster Autoscaler
66. Cluster Autoscaler
67. Pod Priority and Preemption
67. Pod Priority and Preemption
68. Taints and Tolerations
68. Taints and Tolerations
69. Pod Affinity and Anti-Affinity
69. Pod Affinity and Anti-Affinity
70. Troubleshooting Techniques
70. Troubleshooting Techniques