Kubernetes Interview Questions

Ace your Kubernetes interview with this comprehensive Q&A guide covering basic to advanced topics, scenario-based questions, and design questions with detailed explanations for each answer.

25+ Questions Basic to Expert Detailed Explanations
8
Basic Questions
7
Intermediate Questions
6
Advanced Questions
5
Scenario & Design Questions
Basic Level Questions

These questions test fundamental understanding of Kubernetes concepts. They're typically asked in junior or mid-level interviews.

Q1: What is Kubernetes and what are its key features? Basic

Answer: Kubernetes is an open-source container orchestration platform that automates the deployment, scaling, and management of containerized applications. It was originally developed by Google and is now maintained by the Cloud Native Computing Foundation (CNCF).

Key Features:
  • Container Orchestration: Automates container deployment, scaling, and management
  • Service Discovery & Load Balancing: Exposes containers using DNS names or IP addresses
  • Self-Healing: Restarts failed containers, replaces and reschedules containers
  • Horizontal Scaling: Scale applications up and down with simple commands
  • Automated Rollouts and Rollbacks: Gradually roll out changes and rollback if issues occur
  • Secret and Configuration Management: Manage sensitive information without rebuilding images
Q2: What is the difference between a Pod and a Container? Basic

Answer: A Pod is the smallest deployable unit in Kubernetes. It is a group of one or more containers that share storage and network resources. A Container is a single runtime instance of a container image.

Key Difference: Pods are the abstraction layer in Kubernetes. They provide shared context and isolation for containers. While a pod can contain multiple containers (sidecar pattern), the most common use case is one container per pod. Containers share the same network namespace and can communicate via localhost.
Q3: What are the components of the Kubernetes control plane? Basic

Answer: The control plane consists of several components that manage the cluster:

  • API Server: The central management point that exposes the Kubernetes API
  • etcd: A distributed key-value store that stores all cluster data
  • Scheduler: Assigns pods to nodes based on resource requirements
  • Controller Manager: Runs controllers that handle cluster state
  • Cloud Controller Manager: Interacts with cloud providers
Control Plane vs Worker Nodes: The control plane manages the cluster's state and makes global decisions. Worker nodes run the actual application workloads. All communication goes through the API server.
Q4: What is a Service in Kubernetes? Basic

Answer: A Service is an abstraction that defines a logical set of pods and a policy by which to access them. It provides stable network endpoints (IP or DNS name) for accessing pods, which can be dynamically created and destroyed.

Service Types:
  • ClusterIP: Exposes the service on an internal IP (default)
  • NodePort: Exposes the service on each node's IP
  • LoadBalancer: Creates an external load balancer (cloud providers)
  • Headless: No cluster IP (for stateful applications)
Q5: What is the difference between a Deployment and a StatefulSet? Basic

Answer: A Deployment manages stateless applications with identical replicas. A StatefulSet manages stateful applications with unique identities and persistent storage.

Key Differences:
  • StatefulSets provide stable network identities (pod-0, pod-1, etc.)
  • StatefulSets support ordered deployment and scaling
  • StatefulSets use persistent storage (PVCs) per pod
  • Deployments are for stateless applications (cattle), StatefulSets are for stateful (pets)
Q6: What is Ingress and how does it differ from a Service? Basic

Answer: Ingress manages external access to services in a cluster, typically HTTP/HTTPS. It provides load balancing, SSL termination, and name-based virtual hosting.

Key Difference: Services operate at L4 (TCP/UDP) and provide basic load balancing. Ingress operates at L7 (HTTP/HTTPS) and provides advanced routing (path-based, host-based), SSL termination, and canary deployments.
Q7: What are labels and selectors in Kubernetes? Basic

Answer: Labels are key-value pairs attached to Kubernetes objects (pods, services, etc.) for organization and grouping. Selectors are used to filter objects based on labels.

Why It Matters: Labels and selectors are fundamental to Kubernetes' decoupling mechanism. Services use selectors to find pods, deployments use them to manage pod groups, and you can use them for grouping and filtering resources (e.g., `kubectl get pods -l app=nginx`).
Q8: What is the difference between a ConfigMap and a Secret? Basic

Answer: ConfigMaps store non-sensitive configuration data in key-value pairs. Secrets store sensitive data (passwords, API keys, certificates) and are encoded in base64.

Security Consideration: Secrets are base64-encoded, not encrypted by default. For production, enable etcd encryption and use external secret management tools (Sealed Secrets, Vault) for additional security.
Intermediate Level Questions

These questions test deeper understanding of Kubernetes operations, networking, and security. Typically asked in senior engineer interviews.

Q9: How does the Kubernetes scheduler work? Intermediate

Answer: The scheduler watches for newly created pods with no assigned node and selects the best node for them based on:

  • Resource requirements (CPU, memory)
  • Node affinity/anti-affinity rules
  • Taints and tolerations
  • Pod priority
  • Topology spread constraints
  • Node availability and health
Scheduler Phases: The scheduler uses a two-phase process: filtering (finds nodes that can run the pod) and scoring (ranks filtered nodes). The node with the highest score is selected. The scheduler is pluggable and can be customized.
Q10: What are taints and tolerations? Intermediate

Answer: Taints are applied to nodes to repel pods. Tolerations are applied to pods to allow scheduling on tainted nodes.

Use Cases:
  • Dedicated Nodes: Taint nodes for specific workloads (GPU, database)
  • Node Maintenance: Taint with NoExecute to evict pods
  • Node Group Isolation: Separate development and production workloads
  • Spot Instances: Taint spot nodes for fault-tolerant workloads
Q11: What is the difference between a ReplicaSet and a Deployment? Intermediate

Answer: A ReplicaSet ensures that a specified number of pod replicas are running at all times. A Deployment manages ReplicaSets and provides declarative updates, rollbacks, and scaling.

Why It Matters: Deployments are the recommended way to manage stateless applications. They abstract ReplicaSets and provide features like rolling updates, rollbacks, and revision history. You rarely work with ReplicaSets directly; Deployments manage them for you.
Q12: How does Kubernetes handle network communication between pods? Intermediate

Answer: Kubernetes uses the Container Network Interface (CNI) to manage pod networking. Each pod gets its own IP address, and pods can communicate with each other without NAT.

Key Points:
  • CNI plugins (Calico, Cilium, Flannel) implement the networking model
  • Each pod has a unique IP address within the cluster network
  • Services provide stable endpoints for accessing pods
  • Network policies provide security controls at L3/L4
Q13: What is a headless service and when would you use it? Intermediate

Answer: A headless service is a service with clusterIP: None. It doesn't provide load balancing; instead, DNS resolves to individual pod IPs.

Use Cases:
  • StatefulSets: Each pod needs direct access (e.g., databases)
  • Service Discovery: Applications that need to discover all pod instances
  • Custom Load Balancing: When you want to implement your own load balancing logic
  • Peer-to-Peer Communication: Services that need to talk to specific pods
Q14: What are PersistentVolumes and PersistentVolumeClaims? Intermediate

Answer: A PersistentVolume (PV) is a piece of storage in the cluster provisioned by an administrator. A PersistentVolumeClaim (PVC) is a request for storage by a user.

How It Works:
  1. Administrator provisions a PV (NFS, EBS, etc.)
  2. User creates a PVC requesting storage (size, access mode, etc.)
  3. Kubernetes binds the PVC to a matching PV
  4. Pods use PVCs to mount storage
Q15: How do you implement zero-downtime deployments in Kubernetes? Intermediate

Answer: Zero-downtime deployments can be achieved using:

  • Rolling Updates: Default deployment strategy
  • Blue-Green Deployments: Switch traffic between two environments
  • Canary Deployments: Gradual rollout with traffic splitting
  • PodDisruptionBudgets: Prevent excessive pod evictions
  • Readiness Probes: Ensure pods are ready before routing traffic
Best Practice: Use rolling updates with proper readiness and liveness probes. For riskier changes, use canary deployments with metric-based analysis to automatically rollback if issues occur.
Advanced Level Questions

These questions test deep expertise in Kubernetes architecture, performance, and complex troubleshooting. Typically asked in senior/principal or architect interviews.

Q16: What is etcd and why is it critical for Kubernetes? Advanced

Answer: etcd is a distributed, reliable key-value store that serves as Kubernetes' backing store for all cluster data. It stores the entire cluster state including configurations, secrets, and resource status.

Why It's Critical:
  • etcd is the single source of truth for the cluster
  • All API server reads and writes go through etcd
  • etcd uses Raft consensus for consistency and HA
  • etcd failure means cluster failure
  • Regular backups are mandatory for disaster recovery
Q17: Explain the concept of QoS (Quality of Service) classes in Kubernetes. Advanced

Answer: QoS classes determine pod priority for eviction under resource pressure:

  • Guaranteed: Requests = Limits (highest priority)
  • Burstable: Requests < Limits (medium priority)
  • BestEffort: No requests or limits (lowest priority)
Eviction Order: Under resource pressure, BestEffort pods are evicted first, then Burstable (by usage-to-request ratio), and Guaranteed pods last. This ensures critical workloads are protected.
Q18: How does Kubernetes handle cluster autoscaling? Advanced

Answer: Kubernetes supports multiple autoscaling mechanisms:

  • Horizontal Pod Autoscaler (HPA): Scales pod replicas based on CPU/memory or custom metrics
  • Vertical Pod Autoscaler (VPA): Adjusts pod resource requests
  • Cluster Autoscaler: Adds/removes nodes based on pending pods
  • KEDA: Event-driven scaling for queues and external metrics
Best Practice: Use HPA for application scaling, VPA for resource optimization, and Cluster Autoscaler for infrastructure scaling. Combine them for comprehensive cost optimization.
Q19: What is the difference between CNI and service mesh? Advanced

Answer: CNI provides basic pod networking (IP assignment, routing, network policy). Service Mesh provides advanced networking features at L7 (traffic management, mTLS, observability).

Key Differences:
  • CNI operates at L3/L4, service mesh at L7
  • Service mesh uses sidecar proxies (Envoy, Linkerd)
  • Service mesh provides mTLS, canary, A/B testing
  • Service mesh adds observability (metrics, tracing, logs)
  • CNI is required for cluster networking; service mesh is optional
Q20: How do you implement backup and disaster recovery in Kubernetes? Advanced

Answer: Backup and disaster recovery strategies include:

  • etcd Backup: Regular etcd snapshots for cluster state
  • Velero: Application-level backup with volume snapshots
  • Volume Snapshots: CSI-based snapshots for persistent data
  • Application Backups: Database-specific backups (pg_dump, mysqldump)
  • Disaster Recovery Plan: Documented RTO/RPO and recovery procedures
Best Practice: Use Velero for comprehensive backups, test restore procedures regularly, and store backups in a separate location (different region, different cloud). Define clear RPO and RTO objectives.
Q21: What is the role of the API server in Kubernetes? Advanced

Answer: The API server is the central management component that:

  • Exposes the Kubernetes API
  • Authenticates and authorizes requests
  • Validates and mutates resources via admission controllers
  • Persists state to etcd
  • Provides the interface for all cluster operations
Critical Role: All cluster communication goes through the API server. It serves as the front-end for the control plane and is the only component that directly communicates with etcd. High availability is achieved by running multiple API server replicas behind a load balancer.
Scenario-Based Questions

These questions test practical problem-solving skills in real-world scenarios. They're commonly asked in senior-level interviews to assess hands-on experience.

Q22: Your application is experiencing high latency. How would you diagnose the issue using Kubernetes tools? Expert

Answer: Systematic diagnostic approach:

  1. Check pod status: kubectl top pods and kubectl get pods
  2. Check node resources: kubectl top nodes
  3. Check pod logs: kubectl logs <pod>
  4. Check events: kubectl get events
  5. Check service endpoints: kubectl get endpoints
  6. Check network policies: kubectl get networkpolicies
  7. Check ingress controller logs: kubectl logs -n ingress-nginx
Common Causes: Resource constraints, network latency, inefficient code, service mesh overhead, or database bottlenecks. Use monitoring tools (Prometheus, Grafana) and distributed tracing (Jaeger) for deeper analysis.
Q23: How would you migrate a stateful application from one Kubernetes cluster to another? Expert

Answer: Migration approach:

  1. Use Velero: Backup from source cluster, restore to target cluster
  2. Database Replication: Set up replication between clusters
  3. Data Migration: Use database-specific tools for data migration
  4. Application Deployment: Deploy application to target cluster
  5. Traffic Switch: Switch traffic using DNS or load balancer
  6. Validation: Test thoroughly before decomissioning source
Best Practice: Use a blue-green approach where both clusters run simultaneously. Plan for downtime or use a phased migration. Backup and test restore procedures before migration. Have a rollback plan.
Q24: Your cluster is experiencing frequent OOMKilled errors. How do you address this? Expert

Answer: Systematic approach to resolve OOMKilled issues:

  1. Diagnose: Identify which pods are OOMKilled (kubectl get pods | grep OOMKilled)
  2. Check usage: Monitor memory usage over time (kubectl top pods)
  3. Increase limits: Increase memory limits for affected pods
  4. Optimize code: Identify and fix memory leaks
  5. Scale horizontally: Add more replicas to distribute load
  6. Add nodes: Increase cluster capacity
  7. Use VPA: Implement VPA for automatic recommendations
Prevention: Set appropriate memory limits, monitor memory usage trends, implement HPA, and use VPA for automatic adjustments.
Q25: Design a secure multi-tenant Kubernetes cluster for a SaaS platform. Expert

Answer: Multi-tenant design considerations:

  • Namespace Isolation: Each tenant gets a namespace with resource quotas
  • Network Policies: Isolate tenant network traffic
  • RBAC: Fine-grained access control per tenant
  • Service Mesh: mTLS and identity-based security
  • Storage Isolation: Separate PVCs or storage classes
  • Resource Quotas: Limit resource consumption per tenant
  • Audit Logging: Log all tenant activities
  • Secrets Management: Per-tenant secrets with encryption
Key Considerations: Use OPA/Gatekeeper for policy enforcement, implement network segmentation with CNI network policies, use node taints for workload isolation, and monitor resource usage per tenant.
Quick Command Reference
# Basic Commands kubectl get nodes kubectl get pods kubectl get services kubectl get deployments # Debugging Commands kubectl describe pod <pod> kubectl logs <pod> kubectl logs --previous <pod> kubectl exec -it <pod> -- /bin/sh # Resource Management kubectl top nodes kubectl top pods kubectl scale deployment <name> --replicas=<count> # Configuration kubectl get configmaps kubectl get secrets kubectl create secret generic <name> --from-literal=key=value # Networking kubectl get services kubectl get endpoints kubectl get networkpolicies kubectl get ingress # Advanced kubectl get events --all-namespaces kubectl get componentstatuses kubectl get nodes -o yaml
Interview Tips & FAQs
What level of Kubernetes knowledge is expected for a DevOps role?
For DevOps/SRE roles, you should understand Kubernetes architecture, be able to troubleshoot common issues, know how to deploy and manage applications, and be comfortable with kubectl, Helm, and monitoring tools.
How should I prepare for Kubernetes interview questions?
Hands-on practice is essential. Set up a Kubernetes cluster (minikube, kind, or cloud-based), deploy applications, practice troubleshooting, and experiment with different features. Understand concepts deeply, not just commands.
What are the most commonly asked Kubernetes questions?
Top questions include: What is Kubernetes architecture? How do you deploy applications? What are pods and services? How do you handle scaling? What is the difference between Deployments and StatefulSets? How do you troubleshoot common issues?
Should I focus on kubectl commands or concepts for interviews?
Both are important. Concepts are more critical—you can always look up commands. Understand the "why" behind Kubernetes features. Demonstrate problem-solving ability and architectural thinking.
How do I explain Kubernetes architecture in interviews?
Start with the high-level: control plane (API server, etcd, scheduler, controller manager) and worker nodes (kubelet, kube-proxy, container runtime). Explain how they interact and the flow of a pod creation request.
What scenario-based questions are commonly asked?
Common scenarios: diagnosing pod failures (CrashLoopBackOff, ImagePullBackOff), handling node failures, implementing zero-downtime deployments, securing clusters, and managing stateful applications.
Do I need to memorize Helm commands for interviews?
Be familiar with Helm concepts and common commands. Understand chart structure, templating, and how Helm fits into the CI/CD pipeline. Concepts are more important than memorizing every flag.
Previous: Common Kubernetes Issues Next: Kubernetes Cheatsheet

Preparation is key. Practice these questions, set up a test environment, and you'll be well-prepared for your Kubernetes interview. Good luck!