Kubernestes interview questions
Core Kubernetes Concepts
1. What happens when you run kubectl apply -f deployment.yaml?
API server receives request
Validates YAML
Stores desired state in etcd
Scheduler assigns Pod to node
Kubelet pulls image & starts container
2. Difference between Deployment, StatefulSet, and DaemonSet?
Deployment → stateless apps (web apps)
StatefulSet → stateful apps (DBs like MySQL)
DaemonSet → runs one pod per node (logging, monitoring agents)
3. What is etcd?
Distributed key-value store
Stores cluster state (source of truth)
4. What is a Pod?
Smallest deployable unit
Can have one or multiple containers
Shares network + storage
🔹 Networking (Very Important)
5. How does Kubernetes networking work?
Each Pod gets unique IP
Flat network (no NAT between pods)
Uses CNI plugins (Calico, Flannel)
6. Difference between ClusterIP, NodePort, and LoadBalancer?
ClusterIP → internal access
NodePort → exposes via node IP
LoadBalancer → cloud external LB
7. What is Ingress?
HTTP/HTTPS routing
Works with Ingress Controller (NGINX)
8. Debug: Pod not reachable
Check:
kubectl get pods
kubectl describe pod
kubectl logs
kubectl get svc
kubectl get endpoints
🔹 Storage
9. What is PV and PVC?
PV (Persistent Volume) → actual storage
PVC (Persistent Volume Claim) → request for storage
10. Difference between emptyDir and Persistent Volume?
emptyDir → temporary
PV → permanent
🔹 Security
11. What is RBAC?
Role-Based Access Control
Controls user permissions
12. How do you secure a cluster?
RBAC
Network Policies
Secrets management
Disable root containers
🔹 Config & Secrets
13. Difference between ConfigMap and Secret?
ConfigMap → plain text
Secret → base64 encoded (sensitive data)
🔹 Scaling & Availability
14. What is HPA (Horizontal Pod Autoscaler)?
Scales pods based on CPU/memory
15. What is rolling update?
Zero downtime deployment
Replaces pods gradually
🔹 Troubleshooting (Most Important)
16. Pod stuck in Pending state
No resources (CPU/memory)
Node issue
PVC not bound
17. CrashLoopBackOff issue
Application crash
Wrong config
Check logs:
kubectl logs
18. ImagePullBackOff
Wrong image name
Private repo auth issue
🔹 Real-Time Scenarios (VERY IMPORTANT)
19. How will you deploy an application in Kubernetes?
Steps:
Create Docker image
Push to registry
Create Deployment YAML
Expose via Service
Setup Ingress
20. How do you perform zero downtime deployment?
Use rolling updates
Configure readiness/liveness probes
21. How will you monitor Kubernetes?
Prometheus
Grafana
ELK stack
22. How do you handle node failure?
Pods rescheduled automatically
Use multiple replicas
23. How do you upgrade a cluster?
Drain node
Upgrade master
Upgrade worker nodes
🔹 DevOps Integration
24. How do you integrate Kubernetes with CI/CD?
Jenkins / GitHub Actions
Helm charts
kubectl apply
25. What is Helm?
Package manager for Kubernetes
Manages YAML templates
🔹 Advanced (For 5+ Years)
26. What is CNI?
Container Network Interface
Handles pod networking
27. What is Service Mesh?
Example: Istio
Handles traffic, security, observability
28. What is Pod Disruption Budget (PDB)?
Ensures minimum pods running during maintenance
29. What are taints and tolerations?
Controls pod scheduling on nodes
30. Difference between liveness and readiness probe?
Liveness → restart container
Readiness → control traffic
🔥 Pro Tip for Your Interview
Comments
Post a Comment