Kubernetes is a popular container orchestration tool used by DevOps engineers. Major companies such as Huwaei, SAP and Sound Cloud use this platform. They use it for software development. If you have an interview for a position that requires a Kubernetes certification, you have to know the basics.
So, you need to brush up your knowledge about Kubernetes. Here is a list of the most-asked Kubernetes interview questions.
What is Kubernetes?
Kubernetes is an open-source platform designed to automate the deployment, scaling, and management of containerized applications. It provides a framework to run distributed systems resiliently, handling scaling, failover, and deployment patterns.
What are the primary features of Kubernetes?
The main features of Kubernetes include –
- It automates tasks such as launching containers and hosting containers on a server
- Allows vertical and horizontal scaling of resources
- It can work with hybrid, public cloud and on-premise environments. This allows you to transfer your workloads
- It can replace, reschedule, and restart containers
- Supports automatic rollback and rollout for your applications
- It offers you a stable environment for developing, testing, and production of application
- It can manage your command-line and batch workloads
- Automatically restarts failed containers, replaces them, and reschedules when nodes die.
- Service Discovery & Load Balancing.
What are the main components of the Kubernetes architecture?
The primary components of Kubernetes are –
- Master node
This is required for managing the Kubernetes cluster. For checking fault tolerance, there may be many Master nodes. It has components such as kube-controller-manager, kube-apiserver, kube-scheduler, etcd.
- Worker node
These contain the services required for communication between the master node and between the containers. It has kubelet and kube-proxy running on each node.
- Scheduler
This handles scheduling tasks for worker nodes. While doing so, it takes resource limitations, affinity and anti-affinity specifications into consideration.
- Etcd
This is a key-value store in Kubernetes, which is a backup for your cluster data. It stores configuration details, handles port forwarding and network rules.
What is POD & Node in Kubernetes?
In Kubernetes, a POD runs on a node and is the smallest execution unit. If a POD crashes or stops working, Kubernetes will create a new replica of it. It will then continue executing operations.
A node can be a virtual machine or a physical machine in Kubernetes. The Master node manages this, and can contain many PODs.
Which process runs on the Kubernetes Master Node?
The master node runs multiple key processes:
-
kube-apiserver
-
kube-scheduler
-
kube-controller-manager
-
etcd
The kube-apiserver is the entry point for the control plane and handles all API requests.
Define daemon sets.
Daemon sets in Kubernetes are used for ensuring that some or all the nodes run a copy of a POD. This way, you can run a daemon on every node. These are used for node monitoring, cluster storage and log collection.
How are Kubernetes and Docker related?
Kubernetes and Docker both manage containerized applications.
Docker is used to build, run , and distribute Docker containers. You can use it to package and ship the application.
Kubernetes is a container orchestration platform. You can use it to manage and scale the application.
What is a Kubernetes Cluster?
A cluster is a set of node machines used for running containerized applications. You can run containers across different environments. These can be on-premise, virtual, cloud and physical. They are OS independent.
Each node in the cluster can be a physical or virtual machine. The master node controls and manages the cluster, while worker nodes run the actual applications.
Clusters consist of one master node and some worker nodes.
What are the components of Kubernetes cluster?
A Kubernetes cluster contains six main components –
- API server – It works as the front end of the control panel of Kubernetes.
- Scheduler – This schedules nodes as per their resource needs. It schedules a POD to a compute node according to its resource requirements.
- Controller manager – Handles node controllers, replication controllers and endpoint controllers. It ensures that the correct number of PODS are running.
- Kubelet – Communicates with the Docker engine and ensures that containers are running in a Pod. It interacts with the Control panel to execute an action.
- Kube-proxy – This is a network proxy that facilitates Kubernetes networking. Implements the Kubernetes Service concept across every node in a given cluster.
- Etcd – Stores cluster data such as state information and configuration information.
What is the Google Kubernetes Engine?
Google Kubernetes Engine (GKE) is a managed Kubernetes service provided by Google Cloud Platform. It automates cluster provisioning, upgrades, scaling, and security.
What are the recommended security measures for Kubernetes?
Standard Kubernetes security measures include –
- Always keep the software updated to the latest version
- Enable Role-Based Access Control (RBAC) to check who accesses the Kubernetes API and their permissions
- Use namespaces to establish security boundaries and isolate sensitive workloads
- Control traffic between PODs and clusters using network segmentation policies
- Secure sensitive cloud metadata using Google Container Engine’s metadata hiding feature
- Disable anonymous access to the Kubernetes API server using TLS encryption
- Enable audit logging
- Limit container privileges with PodSecurityPolicy or PodSecurityAdmission
What is Kube-proxy?
Kube-proxy is a network proxy that runs on each node in your cluster. It implements part of the Kubernetes Service concept. It handles the load balancing of the traffic. This is between the services to the appropriate backend PODs.
Is Kubernetes IaaS or PaaS?
Kubernetes is neither PaaS nor IaaS. It is a container orchestration engine that can be considered a Container As A Service (CaaS).
How do you get a static IP address for a Kubernetes load balancer?
In cloud environments like GCP or AWS, you reserve a static external IP and reference it in the LoadBalancer
service definition under loadBalancerIP
. This ensures a static IP is used.
Mention the different types of controller managers.
Types of controllers in Kubernetes are -
- namespace controller
- replication controller
- serviceaccounts controller
- endpoints controller
- Job Controller
- StatefulSet Controller
- ReplicaSet Controller
What are the differences between Kubernetes and Docker Swarm?
Basis of comparison |
Kubernetes |
Docker |
Installation |
Installation is time-consuming. The installation instructions differ based on OS and provider. |
Easy to install. It offers the flexibility for a node to join an existing cluster. |
Application deployment |
Apps can be deployed using pods, and microservices pods. |
You can use apps only as a microservice in swarm clusters. |
Scalability |
It has a set of APIs and strong guarantees, making it complicated and thus slowing down the rate of scaling. |
This deploys containers faster, making scalability faster too. |
Availability |
By tolerating application failure and distributing pods among nodes, it offers high availability. |
As all the services can be cloned using the Swarm nodes, availability is high here. |
Load balancing |
Pods are used within a cluster for load balancing. Manual service configuration is needed. |
A DNS element within the Swarm mode can be used for handling incoming requests. |
Networking |
Container networking requires TLS authentication for networking that has to be manually configured |
Inter-node connections can be established using TLS that is automatically configured |
Data volumes |
Data volumes can be shared between pods. |
Data volumes can be shared between many containers. But, they exist locally on the node where they are created. |
Service discovery |
You can define a container as a service which simplifies service discovery |
Service discovery is simple here too as containers communicate with each other. They use private IP addresses |
What is Kubectl?
kubectl is the command-line tool to interact with the Kubernetes cluster. It communicates with the Kubernetes API server to create, update, and manage cluster resources.
It is a client of the Kubernetes API.
What are Secrets in Kubernetes?
You can store sensitive information in Kubernetes secrets. These can be SSH keys and passwords. You can access them via an environment variable or a volume, from a container that is running in a POD.
You can create a Secret from a text file or a YAML file.
Mention important kubectl commands.
Important kubectl commands include –
- kubectl apply
- kubectl annotate
- kubectl attach
- kubectl api-versions
- kubectl autoscale
- kubectl config set
- kubectl edit
- kubectl cluster-info dump
- kubectl set cluster
- kubectl get clusters
- kubectl set-credentials
- kubectl config
- kubectl cluster-info
- kubectl config current-context
- kubectl drain NODE
- kubectl get pods
- kubectl describe pod <name>
- kubectl logs <pod>
- kubectl exec -it <pod> -- bash
What is Autoscaling in Kubernetes?
Autoscaling is needed for increasing/ decreasing the number of nodes in a cluster. This is as per the service response demands. The feature can scale the infrastructure horizontally using:
- Horizontal Pod Autoscaler (HPA)
- Cluster Autoscaler for node-level scaling.
- Vertical Pod Autoscaler (VPA) for resource limits.
What is Container Orchestration?
Container orchestration is the process of handling containers for apps. The activities include managing, scheduling, networking and deployment of containers. Using this process, you can deploy the same application across different environments. It also helps in the following –
- Allocating resources between containers
- Service discovery load balancing between containers
- Monitoring the health of hosts and containers
- Managing application load across host infrastructure by scaling or removing containers
Can Pods in different namespaces communicate?
Yes, pods in different namespaces can communicate using their IP addresses. The IP address of each pod can be seen using this command –
kubectl get pods -o wide --all-namespaces
What will happen when adding a new API to Kubernetes?
Adding a new API or Custom Resource Definition (CRD) in Kubernetes allows you to extend the Kubernetes API to define custom objects and controllers, enhancing platform capabilities without changing core Kubernetes code.
What is a StatefulSet in Kubernetes?
A StatefulSet is a Kubernetes controller used to manage stateful applications. It ensures each pod has a stable hostname, unique identity, and persistent storage across rescheduling. It is ideal for databases or applications that require ordered deployment and stable networking.
What is a ConfigMap in Kubernetes?
A ConfigMap is an API object used to inject configuration data into pods. It allows separation of configuration from the application code and can be used to pass environment variables, command-line arguments, or configuration files.
What is Helm in Kubernetes?
Helm is a package manager for Kubernetes that simplifies the deployment and management of applications using Helm charts. Charts are reusable templates that define Kubernetes resources. Helm supports versioning, dependency management, and rollback, making it easy to manage complex applications.
What is the difference between a PersistentVolume (PV) and a PersistentVolumeClaim (PVC)?
- A PersistentVolume (PV) is a piece of storage provisioned by an administrator or dynamically by a StorageClass.
- A PersistentVolumeClaim (PVC) is a request for storage by a user.
The PVC binds to an appropriate PV, allowing pods to use persistent storage independent of the underlying infrastructure.
How do you monitor a Kubernetes cluster?
Monitoring is done using tools like Prometheus and Grafana for metrics, EFK or ELK Stack for logging, and Kube-state-metrics for Kubernetes object states. Monitoring includes node health, pod status, resource usage, logs, and application-level metrics to ensure cluster performance and reliability.
How do you update a running deployment in Kubernetes?
You can update a running deployment using:
kubectl set image deployment/my-deployment my-container=my-image:v2
Kubernetes will perform a rolling update, replacing old pods with new ones without downtime. You can also use kubectl apply an updated YAML manifest.
What is the difference between a Deployment and a StatefulSet?
Feature | Deployment | StatefulSet |
---|---|---|
Identity | Pods are interchangeable | Each pod has a unique identity |
Storage | Shared/ephemeral | Stable, persistent volumes per pod |
Use Case | Stateless apps | Stateful apps (e.g., databases) |
Pod Management | No order enforced | Ordered, graceful start/stop |
Networking | Standard service | Often uses a headless service |
Deployments are ideal for stateless apps, while StatefulSets are used for stateful workloads.