Posted in

Top 30 Kubernetes Interview Questions and Answers for All Experience Levels

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 of experience demonstrate their Kubernetes expertise.

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 deployment, scaling, load balancing, and self-healing.

2. Why is Kubernetes popular today?

Kubernetes is popular due to its ability to handle scalability, self-healing, automation, and portability across different environments. It simplifies managing containerized applications at scale while ensuring high availability.

3. Describe the Kubernetes architecture.

Kubernetes follows a client-server architecture with a control plane (master nodes) and worker nodes. The control plane includes API Server, etcd, Scheduler, and Controller Manager. Worker nodes run Kubelet, Container Runtime, and Kube-proxy.[1][3]

4. What is a Pod in Kubernetes?

A Pod is the smallest deployable unit in Kubernetes that can contain one or more containers. Containers in a Pod share storage, network, and lifecycle, and can communicate using localhost.

5. What are the main components of the Kubernetes control plane?

The control plane components are: API Server (handles REST requests), etcd (distributed key-value store), Scheduler (assigns Pods to nodes), and Controller Manager (runs controllers to maintain desired state).[3][5]

6. What is etcd in Kubernetes?

etcd is a distributed key-value store that serves as the single source of truth for all cluster data. It stores the cluster state and configuration managed by the API Server.[1][3]

7. What is Kubelet?

Kubelet is an agent running on each worker node that ensures containers in Pods are running as expected. It communicates with the API Server and manages Pod lifecycle on the node.[1][3]

8. What is Kube-proxy?

Kube-proxy runs on each node and manages network rules for Pod communication. It maintains network rules on nodes and enables service-to-pod communication using mechanisms like iptables or IPVS.

9. What are Kubernetes Services?

Kubernetes Services provide a stable network endpoint to access a set of Pods. They handle load balancing and service discovery for Pods, which have ephemeral IPs.

10. What are the different types of Kubernetes Services?

Service types include ClusterIP (internal access), NodePort (external access via node port), LoadBalancer (external load balancer), and ExternalName (maps to external service).

Intermediate Kubernetes Interview Questions

11. What is a Deployment in Kubernetes?

A Deployment manages a ReplicaSet of Pods, providing declarative updates for Pods and ReplicaSets. It enables rolling updates, rollbacks, and scaling of stateless applications.

12. Explain ReplicaSet vs. ReplicationController.

ReplicaSet ensures the desired number of Pod replicas are running and supports set-based selectors. ReplicationController is older and uses equality-based selectors only.

13. What are Kubernetes Namespaces?

Namespaces provide a way to divide cluster resources among multiple users or teams. They are virtual clusters within a physical cluster for resource isolation.

14. What is a ConfigMap in Kubernetes?

ConfigMap stores non-confidential configuration data in key-value pairs that can be consumed by Pods. It separates configuration from application code.

15. What are Kubernetes Secrets?

Secrets store sensitive data like passwords, tokens, and certificates in base64-encoded format. They provide a secure way to inject confidential data into Pods.

16. Explain Horizontal Pod Autoscaler (HPA).

HPA automatically scales the number of Pods in a Deployment based on observed CPU/memory utilization against defined targets. It requires metrics server.

17. What are Kubernetes Probes?

Probes monitor container health: Liveness probe restarts unhealthy containers, Readiness probe controls traffic routing, and Startup probe waits for app initialization.

18. How does the Kubernetes Scheduler work?

The scheduler assigns Pods to nodes through two phases: Filtering (predicates to find feasible nodes) and Scoring (priorities to rank eligible nodes), then binding.[3]

19. What are Persistent Volumes (PV) and Persistent Volume Claims (PVC)?

PV is cluster storage provisioned by administrators. PVC is a request for storage by users that binds to a suitable PV for Pod consumption.

20. Explain Ingress in Kubernetes.

Ingress manages external HTTP/HTTPS traffic to Services using rules. It requires an Ingress Controller to handle incoming requests and route to appropriate Services.[2]

Advanced Kubernetes Interview Questions

21. What is Role-Based Access Control (RBAC) in Kubernetes?

RBAC controls access to Kubernetes resources based on user roles. It uses Roles/ClusterRoles and RoleBindings/ClusterRoleBindings to define permissions.[1]

22. Explain Network Policies in Kubernetes.

Network Policies define rules to allow/deny traffic between Pods. They act as firewalls at the IP/network layer for Pod-to-Pod communication.[1][2]

23. What are Taints and Tolerations?

Taints repel Pods from nodes unless Pods have matching tolerations. They are used for node scheduling restrictions like dedicated nodes for specific workloads.[1]

24. How would you scale an application experiencing increased traffic at Paytm?

Deploy Horizontal Pod Autoscaler targeting CPU utilization. Monitor metrics and set min/max replicas. Use Cluster Autoscaler for node scaling during traffic spikes.[6]

25. What steps would you take for high availability Kubernetes cluster design at Zoho?

Use multi-master control plane across availability zones, etcd clustering, Pod Anti-Affinity, and multi-node worker pools. Enable self-healing with liveness probes.[1][6]

26. How do you troubleshoot a Pod in CrashLoopBackOff state?

Check events with kubectl describe pod <pod-name>, review logs with kubectl logs <pod-name>, verify resource limits, and check probe configurations.[2]

kubectl describe pod my-pod
kubectl logs my-pod --previous

27. How do you debug a Pod not getting scheduled?

Check Pod events for scheduling failures, verify node resources, taints/tolerations, node selectors, and affinity rules using kubectl describe pod.[1]

28. A Deployment at Salesforce is not scaling as expected. How do you troubleshoot?

Verify HPA configuration, check metrics server status, ensure resource requests/limits are set, review Pod conditions, and validate custom metrics if used.[2]

29. How do you handle backup and restore of a Kubernetes cluster?

Backup etcd snapshots regularly. For applications, use tools to snapshot Persistent Volumes and cluster resources. Restore by recovering etcd and PV data.[3]

30. How would you resolve DNS resolution issues in a Pod at Atlassian?

Verify CoreDNS pods status, check Pod logs, test DNS with nslookup inside Pod, ensure service accounts have proper permissions, and validate network policies.[2]

Leave a Reply

Your email address will not be published. Required fields are marked *