Prepare for your Kubernetes interview with this comprehensive guide featuring 30 essential questions and answers. Covering basic, intermediate, and advanced topics, these questions help freshers, candidates with 1-3 years of experience, and professionals with 3-6 years master Kubernetes concepts, practical scenarios, and troubleshooting techniques.
Basic Kubernetes Interview Questions
1. What is Kubernetes?
Kubernetes is an open-source platform for automating deployment, scaling, and operations of containerized applications across clusters of hosts. It provides container orchestration capabilities including scheduling, load balancing, and self-healing.[1][2]
2. Why is Kubernetes popular today?
Kubernetes is popular due to its features like auto-scaling, self-healing, automated rollouts and rollbacks, load balancing, and a large active community that supports continuous development.[1][3][5]
3. What are the main features of Kubernetes?
Main features include auto-scaling, DNS management, load balancing, self-healing, automated rollouts and rollbacks, and horizontal scalability to handle failures and growth.[3][5]
4. Describe the Kubernetes architecture.
Kubernetes architecture consists of a Control Plane (API Server, etcd, Scheduler, Controller Manager) managing cluster state and Worker Nodes with Kubelet, Container Runtime, and Kube Proxy handling pod execution and networking.[1][4]
5. What is the role of etcd in Kubernetes?
etcd is a distributed key-value store serving as the single source of truth for all cluster data, ensuring consistency across components via regular snapshots for backup.[1][4]
6. What is a Pod in Kubernetes?
A Pod is the smallest deployable unit in Kubernetes, consisting of one or more containers that share storage, network, and lifecycle, with each Pod getting a unique IP.[2][4]
7. What is the difference between a Pod and a container?
A container runs a single application instance, while a Pod can contain multiple containers that need to share resources and communicate locally.[4]
8. What are Deployments in Kubernetes?
Deployments manage ReplicaSets of Pods, handling declarative updates for replicas, scaling, and rolling updates/rollbacks to ensure desired state.[1][3]
9. What is a Service in Kubernetes?
A Service provides a stable IP and DNS name for accessing a set of Pods, enabling load balancing and decoupling Pods from external clients as Pods are ephemeral.[2]
10. What are Namespaces in Kubernetes?
Namespaces provide a way to divide cluster resources between multiple users or teams, isolating objects like Pods and Services within virtual clusters.[2]
Intermediate Kubernetes Interview Questions
11. Explain Kubelet and its role.
Kubelet runs on each Worker Node, communicating with the API Server to ensure Pods are running as expected, managing container lifecycle via the Container Runtime.[1][2]
12. What is Kube Proxy?
Kube Proxy manages networking on nodes, routing traffic to Pods via services using mechanisms like iptables or IPVS for load balancing.[1]
13. What are liveness and readiness probes?
Liveness probes check if a container is running; failure triggers restart. Readiness probes check if a container is ready for traffic; failure removes it from Service load balancing.[3]
14. How does Kubernetes scheduling work?
Scheduling has filtering (predicates like resource fit, taints/tolerations), scoring (priorities), and binding phases to assign Pods to optimal nodes.[4]
15. What are ConfigMaps and Secrets?
ConfigMaps store non-sensitive configuration data for Pods. Secrets store sensitive data like passwords, both injected as environment variables or volumes.[2]
16. What are Horizontal Pod Autoscalers (HPA)?
HPA automatically scales the number of Pods in a Deployment based on observed metrics like CPU usage to match demand.[3][2]
17. Explain Kubernetes networking basics.
Pods get unique IPs for pod-to-pod communication. Services provide stable endpoints. Network policies control traffic rules between Pods.[2]
18. What is a headless Service?
A headless Service does not provide load balancing; it returns Pod IPs directly via DNS, useful for stateful applications needing direct access.[5]
19. What are Custom Resource Definitions (CRDs)?
CRDs extend Kubernetes APIs by allowing custom objects, enabling users to define and manage application-specific resources.[6]
20. How do you backup a Kubernetes cluster?
Backup etcd snapshots for cluster state and Persistent Volumes for application data using tools like Velero to restore resources and volumes.[4]
Advanced Kubernetes Interview Questions
21. What are taints and tolerations?
Taints repel Pods from nodes unless Pods have matching tolerations, used for scheduling like dedicating nodes to specific workloads.[1]
22. Explain Role-Based Access Control (RBAC) in Kubernetes.
RBAC manages permissions using Roles, ClusterRoles, RoleBindings, and ClusterRoleBindings to control access to resources.[1]
23. What are Network Policies?
Network Policies define rules to allow or deny traffic between Pods, enhancing security by restricting pod-to-pod communication.[1][2]
24. How do you troubleshoot a Pod not getting scheduled?
Check events with kubectl describe pod for issues like insufficient resources, taints, affinity rules, or node selectors.[1][2]
kubectl describe pod <pod-name>
25. What is CrashLoopBackOff and how to debug it?
CrashLoopBackOff occurs when a container repeatedly crashes. Debug with kubectl logs, describe pod for probe failures, resource limits, or errors.[1][2]
kubectl logs <pod-name>
kubectl describe pod <pod-name>
26. How to diagnose DNS issues in Kubernetes?
Verify CoreDNS Pods status, test DNS resolution inside Pods with nslookup, check Service and Pod network policies.[1]
27. What if a Pod is running but not reachable from a Service?
Check readiness probes, Service selectors matching Pod labels, endpoint status with kubectl get endpoints, and network policies.[1][2]
28. Why might a Deployment not scale as expected?
Verify HPA configuration, metrics server, resource requests/limits, Pod Disruption Budgets, or insufficient nodes.[1][2]
kubectl describe hpa <hpa-name>
29. Scenario: At Zoho, how would you ensure high availability for a critical application?
Use multi-node Control Planes, Pod Anti-Affinity for distribution, liveness probes, ReplicaSets, and Horizontal Pod Autoscaler.[1]
30. Scenario: In a Paytm-like environment, how do you secure Kubernetes workloads?
Implement RBAC, Network Policies, Pod Security Standards for non-root containers, Secrets management, image scanning, and admission controllers.[1]