Skip to main content

Command Palette

Search for a command to run...

Day 32 - Kubernetes Interview Q&A

Updated
3 min read

1. Difference between Docker and Kubernetes

Docker → Builds and runs containers.
Kubernetes → Orchestrates containers across multiple nodes.

Key points:

  • Docker = container runtime.

  • Kubernetes = container orchestration tool.

  • Kubernetes provides auto-healing, auto-scaling, load balancing.

  • Kubernetes runs on a cluster → if one node fails, workloads shift automatically.


2. Main Components of Kubernetes Architecture

Control Plane

  • API Server → Entry point for all commands.

  • Scheduler → Decides which node runs a pod.

  • etcd → Key-value store for cluster state.

  • Controller Manager → Runs controllers like ReplicaSet, Node Controller, Job Controller.

  • Cloud Controller Manager → Integrates with cloud providers (e.g., creates LoadBalancer IPs).

Worker Node

  • kubelet → Ensures pods run and are healthy.

  • kube-proxy → Manages networking rules and service routing.

  • Container Runtime → Docker, containerd, CRI-O, etc.


3. Docker Swarm vs Kubernetes

Docker Swarm

  • Simple and easy.

  • Limited networking and scaling.

  • Good for small workloads.

Kubernetes

  • Highly scalable, flexible.

  • Advanced networking (CNI).

  • Large ecosystem & community.

  • Industry standard for production.


4. Docker Container vs Kubernetes Pod

  • Container → Single isolated runtime.

  • Pod → Kubernetes unit that can contain one or more containers.

  • Containers in a pod share:

    • Network namespace

    • Storage volumes

    • Lifecycle

Pod = wrapper around one or more containers.


5. What is a Namespace?

Namespace provides logical isolation within a Kubernetes cluster.

Use cases:

  • Multi-project isolation

  • Resource separation

  • Independent RBAC policies

  • Isolated services, configs, secrets


6. Role of kube-proxy

kube-proxy:

  • Manages network rules on nodes

  • Updates iptables/ipvs

  • Routes service traffic to appropriate pods

  • Enables ClusterIP, NodePort, LoadBalancer traffic flow


7. Types of Kubernetes Services

ClusterIP

  • Default type

  • Internal access only

  • Used for service-to-service communication

NodePort

  • Opens a port on each node

  • External access via NodeIP:Port

LoadBalancer

  • Creates cloud load balancer

  • Exposes app to the internet


8. Difference Between NodePort and LoadBalancer

NodePort

  • Access via NodeIP:NodePort

  • Limited to your cluster/node network

  • No external load balancing

LoadBalancer

  • Cloud provider allocates a public IP

  • Global reach over the internet

  • Adds external LB + NodePort behind the scenes


9. Role of kubelet

kubelet:

  • Ensures pods are running

  • Reports pod/node status to API server

  • Restarts containers if required

  • Handles pod lifecycle management


10. Day-to-Day Kubernetes Activities (DevOps Engineer)

A strong interview-ready answer:

  • Deploy and manage applications on Kubernetes

  • Monitor cluster health and workloads

  • Troubleshoot pod failures, service issues, networking problems

  • Handle upgrades and maintenance of master/worker nodes

  • Manage RBAC, namespaces, resource quotas

  • Support developers with deployment issues

  • Manage CI/CD pipeline deployments to Kubernetes

  • Handle cluster security, patching, vulnerabilities

  • Operate logging and monitoring (Prometheus, Grafana, Loki, EFK)