20 Real-Life Kubernetes Interview Questions

Nailing Kubernetes interviews

Featured image

This post is about me sharing multiple questions and answers for Kubernetes interviews. I have conducted multiple interviews related to Kubernetes roles and have also been on the other side, trying to answer the same questions. This is focused on an interview methodology of interrogating the candidate and not having a conversation about past experiences, which I have seen is not a common practice when doing interviews.

1. What is Kubernetes and why is it essential for container orchestration?

A: Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications, ensuring high availability and reliability.

2. Name the key components of a Kubernetes cluster.

A: A Kubernetes cluster consists of the Master, that has the API Server, Controller Manager, Scheduler and etcd. Then the Nodes have, kubelet and the kube-proxy, where containers run.

3. What is a Pod in Kubernetes?

A: A Pod is the smallest deployable unit in Kubernetes, containing one or more containers sharing the same network namespace.

4. Differentiate between a Deployment and a StatefulSet.

A: Deployments manage stateless apps with rolling updates, while StatefulSets are used for stateful apps with stable naming entities. A StatefulSet is better suited to stateful workloads that require persistent storage on each cluster node, such as databases and other identity-sensitive workloads. A Deployment, on the other hand, is suitable for stateless workloads that use multiple replicas of one pod, such as web servers like Nginx

5. How does Kubernetes handle service discovery?

A: Kubernetes uses DNS for service discovery, and you can access services via their DNS names.

6. How can you expose an application outside the Kubernetes cluster?

A: You can expose an app using Services (ClusterIP, NodePort, LoadBalancer) or Ingress controllers to manage HTTP traffic.

7. What are Labels and Selectors in Kubernetes?

A: Labels are key-value pairs attached to resources, and Selectors are used to filter and group resources based on labels.

8. How do you troubleshoot a Pod that is stuck in the “Pending” state?

A: Check events with kubectl describe pod, inspect resource requests/limits, and ensure the node has available resources.

9. What is the process of horizontally scaling a Deployment ?

This is done via the Horizontal Pod Autoscaling(HPA), a resource that allows to define specific scaling options based on specific scenarios

10. What is a DaemonSet, and can you provide a practical use case?

A: A DaemonSet ensures that a Pod runs on all or specific nodes. Use it for monitoring agents. Example: Deploy a DaemonSet for a logging agent.

11. What are Helm charts?

A Helm chart is a package that contains all the necessary resources to deploy an application to a Kubernetes cluster. This includes YAML configuration files for deployments, services, secrets, and config maps that define the desired state of your application

12. Describe Kubernetes Persistent Volumes (PVs) and Persistent Volume Claims (PVCs).

A persistent volume (PV) is a piece of storage in the Kubernetes cluster, while a persistent volume claim (PVC) is a request for storage. They work together with the Cloud provider or the storageclass in order to provision storage objects such as EBS drivers on AWS or Persistent Disk in GCP and then map them into the clusters via PV and PVC.

13. What is Kubernetes Federation, and when is it useful?

A: Kubernetes Federation allows managing multiple clusters as a single entity, helpful for multi-cloud or multi-region deployments.

14. What is Kubernetes RBAC, and why is it important?

A: Role-Based Access Control (RBAC) defines who can perform actions in a cluster, ensuring fine-grained access control for users and service accounts.

15. Explain the concept of Custom Resource Definitions (CRDs) in Kubernetes.

A: CRDs extend Kubernetes to support custom resource types, allowing you to define and manage your own resources and controllers. This allows companies to write their own software that is able to be deployed into Kubernetes, for example a CRD for Prometheus, Elasticsesarch, Grafana, etc. that will create custom Kubernetes resources in order to manage this applications.

16. What is Network Policy in Kubernetes?

A: Network Policies define rules for controlling ingress and egress traffic to and from Pods, providing network segmentation and isolation within the cluster.

17. How does Kubernetes interact with a cloud provider to create a load balancer?

A: Kubernetes uses the “Cloud Controller Manager” (CCM) to interface with cloud providers. When a Service of type LoadBalancer is created in Kubernetes, the CCM detects this and communicates with the specific cloud provider’s API to provision a load balancer. Once provisioned, the external IP and details of the load balancer are updated in the Service’s status in Kubernetes. This allows traffic to be routed appropriately to the cluster’s pods.

18. Can you explain the differences between ClusterIP, NodePort, and LoadBalancer service types in Kubernetes?

A: In Kubernetes, these are three primary types of services to expose applications:

19. How does a Kubernetes service discover and manage the pods it routes traffic to?

A: Kubernetes services use “selectors” to determine which pods receive the traffic. When defining a service, you specify a set of label selectors. Pods within the cluster that have matching labels are then automatically selected to receive traffic from that service. This allows for dynamic management, as pods are added or removed, the service will automatically update the set of pods it routes to based on the labels.

20. What is the role of “kube-proxy” in relation to Kubernetes services?

A: kube-proxy is a key component in Kubernetes networking. It runs on each node and is responsible for ensuring that the traffic directed to a service’s IP and port is correctly forwarded to one of the service’s backend pods. It does this by maintaining IPtables rules (or equivalent on other platforms) on the nodes.


There you have it, I hope all these questions give you a better understanding of how a Technical interview goes, at least in the sense of knowing the theoretical part of Kubernetes and how the different components work together, in a future post I will talk about a more deep technical interview, on where instead of asking how much is one plus one one needs to answer how to add up, that is, having a conversation on experiences instead of just being interrogated with a lot of questions.

Build On!