Skip to Sidebar Skip to Content

Kubernetes Interview Questions and Answers

Kubernetes Interview Questions and Answers

What is Kubernetes?

Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, networking, and management of containerized applications across a cluster of machines.

Kubernetes - Declarative Orchestration

What component is responsible for maintaining the desired state of a cluster?

The Kubernetes control plane maintains the desired state of the cluster through several components working together, primarily the API Server, etcd, Scheduler, and Controllers. 

What are the key components within the control plane?

API Server: The primary entry point for all communications within the cluster.

etcd: It is a distributed key-value store that acts as Kubernetes' source of truth. It stores cluster configuration, desired state, metadata, and various cluster objects. 

Controllers: Components that constantly monitor the API server to compare the current state with the desired state and fix any discrepancies.

Scheduler (kube-scheduler): Watches for newly created Pods that do not yet have a node assigned. Selects the most suitable worker node based on resource availability, policies, and constraints.

How does a pod get assigned to a specific machine?

Kubernetes - The Scheduler

This is handled by the scheduler. It watches for new pods without assigned nodes and selects the best fit by:

Filtering out nodes that lack sufficient resources (like CPU or memory) or have taints that the pod cannot tolerate. Scoring the remaining nodes and picking the highest-rated one.

Which component actually starts the containers once a node is selected?

Kubernetes - The Kubelet

The kubelet, which is an agent running on every node, performs the actual work. Once a pod is assigned to its node, the kubelet pulls the container image and tells the container runtime to start it.

How does Kubernetes handle container health?

The kubelet monitors containers using liveness, readiness, and startup probes. If a liveness probe fails, the kubelet restarts the container according to the Pod's restart policy. 

How do pods communicate with each other across different nodes?

Kubernetes follows the Pod Networking Model where every Pod gets its own IP address and can communicate with other Pods without NAT. This connectivity is usually provided by a CNI plugin such as Calico, Cilium, Flannel, or Weave. 

Why should you use a Service instead of communicating directly via pod IP addresses?

Pods are temporary; when a pod is replaced, it receives a new IP address. A Service provides a stable virtual IP (ClusterIP) and DNS name. It uses label selectors and EndpointSlices to route traffic to healthy backend Pods. 

Kubernetes - IP Pods and Services

You can learn more about Kubernetes from some of our other popular blogs here :

Kubernetes 101: Beginner’s Guide to Container Orchestration
Learn what Kubernetes is, how it works, and why it powers modern DevOps. Start with free hands-on labs, and beginner courses from KodeKloud.
Kubernetes Architecture Explained: Nodes, Pods, and Clusters
Understand Kubernetes architecture step by step. Learn how clusters, nodes, and pods work together with real hands-on labs from KodeKloud.
Guide to Securing Pod to Pod and Cloud Traffic in Kubernetes
By default, Kubernetes pods communicate openly. Apply network policies, mTLS, and workload identity to secure pod to pod and cloud communication.
KodeKloud KodeKloud

Subscribe to Newsletter

Join me on this exciting journey as we explore the boundless world of web design together.