Kubernetes (K8S) Interview Questions & Answers

1. What is Kubernetes and why is it used?

Kubernetes (K8s) is an open-source container orchestration platform used to deploy, manage, scale, and monitor containerized applications automatically.

Why it is used:
Interview Answer: Kubernetes automates deployment, scaling, networking, and management of containerized applications.

2. Difference between Docker and Kubernetes?

Docker Kubernetes
Containerization Platform Container Orchestration Platform
Creates Containers Manages Containers
Single Host Focus Multi-Node Cluster Focus
No Auto Scaling Supports Auto Scaling
No Self Healing Supports Self Healing
Interview Answer: Docker packages applications into containers, while Kubernetes manages and orchestrates containers across multiple servers.

3. What is a Pod?

A Pod is the smallest deployable unit in Kubernetes and contains one or more containers sharing the same network and storage.

Interview Answer: A Pod is the smallest deployable unit in Kubernetes that hosts one or more containers.

4. What is a ReplicaSet?

ReplicaSet ensures a specified number of Pod replicas are always running.

Example: If desired replicas = 3 and one Pod crashes, ReplicaSet creates a replacement Pod.

Interview Answer: ReplicaSet maintains the desired number of Pod replicas and provides self-healing.

5. What is a Deployment?

Deployment manages ReplicaSets and Pods and supports rolling updates, rollbacks, and scaling.

Interview Answer: Deployment is a Kubernetes object that manages Pods and ReplicaSets while maintaining the desired application state.

6. What is a Service?

Service provides a stable endpoint to access Pods.

Type Purpose
ClusterIP Internal Communication
NodePort Expose via Node IP
LoadBalancer Cloud Load Balancer
ExternalName External DNS Mapping
Interview Answer: A Service provides a stable network endpoint for accessing Pods whose IPs can change.

7. What is Ingress?

Ingress manages external HTTP/HTTPS access to services inside a cluster.

api.company.com/user  ? user-service
api.company.com/order ? order-service
Interview Answer: Ingress provides URL-based routing, SSL termination, and external access to services.

8. What is etcd?

etcd is a distributed key-value store that stores Kubernetes cluster state and configuration.

Interview Answer: etcd is the source of truth for Kubernetes because all cluster configuration is stored there.

9. What is kubelet?

kubelet is an agent running on every worker node.

Interview Answer: kubelet ensures containers are running as expected on a worker node.

10. What is kube-proxy?

kube-proxy manages networking and load balancing between services and pods.

Interview Answer: kube-proxy routes traffic to Pods and implements Kubernetes Service networking.

11. How does Service Discovery work?

Kubernetes automatically creates DNS entries for services.

<service-name>.<namespace>.svc.cluster.local
user-service.default.svc.cluster.local
Interview Answer: Services are discovered through internal Kubernetes DNS.

12. How does HPA work?

Horizontal Pod Autoscaler automatically scales Pods based on CPU, Memory, or custom metrics.

Interview Answer: HPA increases or decreases pod replicas based on resource utilization.

13. Difference between ConfigMap and Secret?

ConfigMap Secret
Configuration Data Sensitive Data
URLs, Ports Passwords, Tokens
Plain Text Base64 Encoded

14. What happens when a Pod fails?

Kubernetes automatically recreates the Pod through Deployment/ReplicaSet.

Interview Answer: Failed Pods are automatically restarted or recreated to maintain desired state.

15. How do Rolling Updates work?

  1. Create new Pod version
  2. Verify health
  3. Remove old Pod
  4. Repeat gradually
Interview Answer: Rolling updates replace old Pods gradually without downtime.

16. What are PV and PVC?

Component Description
PV Persistent Volume (Storage Resource)
PVC Persistent Volume Claim (Storage Request)
Interview Answer: PVC requests storage and Kubernetes binds it to a suitable PV.

17. What is Helm?

Helm is the package manager for Kubernetes.

Interview Answer: Helm simplifies Kubernetes deployments using reusable Helm Charts.

18. How do you secure Kubernetes?

Interview Answer: Kubernetes security is achieved using RBAC, network policies, secrets, and encryption.

19. What is Namespace?

Namespace provides logical isolation of resources within a cluster.

Interview Answer: Namespace is used to separate resources for teams or environments inside the same cluster.

20. Explain Kubernetes Architecture.

Control Plane (Master Node) Worker Node
API Server
Scheduler
Controller Manager
etcd
kubelet
kube-proxy
Container Runtime
Pods
Interview Answer: Kubernetes consists of a Control Plane that manages the cluster and Worker Nodes that run application Pods.

30-Second Interview Summary

Kubernetes is an open-source container orchestration platform that automates deployment, scaling, networking, and management of containerized applications. Pods run on Worker Nodes, while the Control Plane manages scheduling, scaling, monitoring, and cluster state. Deployments manage Pods, Services expose applications, Ingress handles external traffic, HPA provides auto-scaling, and Helm simplifies deployments.