π₯ Question 1
Explain full Kubernetes control plane architecture and request flow from kubectl to pod creation.
β Real Production Answer
Kubernetes control plane mainly consists of:
- kube-apiserver
- etcd
- kube-scheduler
- kube-controller-manager
- (cloud-controller-manager if cloud provider integrated)
Now request flow:
-
When I run
kubectl apply -f deployment.yaml,kubectlsends REST API request to kube-apiserver. -
kube-apiserver:
- Authenticates (cert/token)
- Authorizes (RBAC)
- Validates object schema
- Writes object state into etcd
-
Now the object is stored as desired state in etcd.
-
Deployment controller (inside controller-manager) sees new Deployment object.
- It creates a ReplicaSet.
-
ReplicaSet controller sees desired replicas and creates Pod objects.
-
Pods are now in Pending state.
-
kube-scheduler watches for unscheduled pods.
- Applies filtering (resource availability, taints, affinity)
- Scores nodes
- Assigns pod to a node
-
kubelet on that node:
- Watches API server
- Pulls image
- Creates container via container runtime (containerd / CRI-O)
- Reports status back
-
Pod becomes Running.
Production insight:
- API server is the only component talking to etcd.
- Everything else works via watch mechanism.
- If scheduler is down β pods stay Pending.
- If controller-manager down β state reconciliation stops.
π₯ Question 2
What happens internally when you create a Deployment?
β Real Production Answer
Deployment is a higher-level abstraction.
When I create a Deployment:
- API server stores Deployment object.
- Deployment controller creates a ReplicaSet.
- ReplicaSet ensures desired replica count.
- Pods get created.
Deployment does not directly manage pods. It manages ReplicaSets.
During update:
- A new ReplicaSet is created.
- Old ReplicaSet scaled down gradually.
- Controlled by
maxSurgeandmaxUnavailable.
Production insight:
- Rollbacks happen by scaling older ReplicaSet.
- If rollout fails, check ReplicaSet events.
- If readiness probe fails β rollout stalls.
π₯ Question 3
Difference between Deployment, StatefulSet, DaemonSet β with production use cases.
β Deployment
- Stateless apps
- Web servers
- APIs
- Horizontally scalable
Pods are interchangeable.
Example: Frontend app behind LoadBalancer.
β StatefulSet
- Stable pod identity
- Ordered startup/shutdown
- Stable persistent storage
- Predictable DNS
Used for:
- Databases (MySQL, MongoDB)
- Kafka
- Elasticsearch
Each pod gets:
- pod-0, pod-1 naming
- Dedicated PVC
Production insight: Donβt use StatefulSet unless you need stable identity or storage.
β DaemonSet
- One pod per node
- Runs on every node
Used for:
- Logging agents (Fluent Bit)
- Monitoring (Node Exporter)
- Security agents
If new node joins β DaemonSet pod auto-created.
π₯ Question 4
When should you use StatefulSet over Deployment β and why not always?
β Use StatefulSet when:
- Application needs stable hostname
- Persistent storage tied to instance
- Ordered scaling
- Clustered systems (Kafka, DB)
Example: Database cluster where each node has its own disk.
β Why not always?
- StatefulSets are slower to scale
- More complex
- Harder rolling updates
- Storage management complexity
- Cannot freely replace pods
If app is stateless β Deployment is simpler and safer.
Interview insight: If someone says βI use StatefulSet for everythingβ β red flag.
π₯ Question 5
How kube-scheduler makes scheduling decisions?
β Real Production Answer
Scheduler works in two phases:
1οΈβ£ Filtering (Predicate phase)
Eliminates nodes that cannot run the pod:
- Not enough CPU/memory
- Taints not tolerated
- NodeSelector mismatch
- Affinity rules fail
- Volume binding constraints
2οΈβ£ Scoring phase
Ranks remaining nodes based on:
- Resource availability
- Spread
- Affinity preferences
- Topology
Best score wins.
Scheduler then binds pod to node.
Production insight:
- If pod stuck Pending β scheduler logs are key.
- If requests not defined β scheduling becomes unpredictable.
- Resource requests are critical.
π₯ Question 6
What are scheduler predicates and priorities (or scheduling framework plugins)?
β Real Production Answer
Older Kubernetes versions used:
- Predicates β filtering phase
- Priorities β scoring phase
Now in modern Kubernetes, this is handled through the Scheduling Framework plugins, but conceptually same idea.
πΉ Filtering (Predicates Equivalent)
Scheduler removes nodes that donβt satisfy:
- Insufficient CPU/memory
- Taints not tolerated
- NodeSelector mismatch
- Node affinity required rules
- Volume binding constraints
- Node not Ready
If no node passes β Pod stays Pending.
πΉ Scoring (Priorities Equivalent)
Among eligible nodes, scheduler scores based on:
- Least requested resources
- Balanced resource allocation
- Pod affinity preferences
- Topology spread constraints
Highest score wins.
π₯ Production Insight
If a pod is stuck Pending:
First check:
kubectl describe pod <pod>Look at:
- Events section
- β0/5 nodes availableβ
That tells you which predicate failed.
At 12 LPA level, you must know:
Scheduling mostly depends on resource requests, not limits.
π₯ Question 7
How does kube-controller-manager work? Name key controllers.
β Real Production Answer
kube-controller-manager runs multiple controllers that reconcile desired state with actual state.
It constantly:
- Watches API server
- Compares desired vs current
- Takes action to fix drift
This is reconciliation loop.
πΉ Important Controllers
- Deployment Controller
- ReplicaSet Controller
- Node Controller
- Job Controller
- Endpoint Controller
- ServiceAccount Controller
- Namespace Controller
- PersistentVolume Controller
Example:
If a pod crashes β ReplicaSet controller detects fewer replicas β creates new pod.
π₯ Production Insight
If controller-manager is down:
- No new pods created
- No node health checks
- No scaling actions
- Cluster state drifts
But existing running pods continue working.
π₯ Question 8
What happens if kube-controller-manager goes down?
β Real Production Answer
Existing workloads continue running because kubelet works independently.
But:
- No self-healing
- No scaling
- No ReplicaSet enforcement
- No Job completion
- No node failure handling
Example:
If a node dies:
- Node controller won't mark it NotReady.
- Pods won't get rescheduled.
Cluster slowly degrades.
π₯ Real Production Fix
- Control plane should run in HA mode.
- Controller-manager usually runs as static pod on master nodes.
- If one instance fails, another takes leadership.
π₯ Question 9
How etcd stores data β and why quorum matters?
β Real Production Answer
etcd is a distributed key-value store.
It stores:
- All cluster state
- Pods
- Deployments
- ConfigMaps
- Secrets
- Node info
Everything in Kubernetes = object in etcd.
πΉ How It Works
- Uses Raft consensus algorithm
- Requires majority to agree before commit
- Strong consistency
If you have 3 etcd nodes:
- Minimum 2 required for quorum.
If you have 5:
- Minimum 3 required.
π₯ Why Quorum Matters
If quorum lost:
- Cluster becomes read-only
- API server cannot write
- No new objects created
- Cluster effectively dead
Thatβs why: Never run single-node etcd in production.
π₯ Production Best Practice
- Always odd number of etcd nodes (3 or 5)
- Regular snapshots
- Separate etcd from worker load
π₯ Question 10
How do you design HA control plane?
β Real Production Answer
For production:
πΉ Control Plane HA Components
- Multiple control plane nodes (minimum 3)
- etcd cluster with quorum
- Load Balancer in front of API servers
Flow:
kubectl β LoadBalancer β multiple kube-apiserver instancesEach API server:
- Talks to etcd cluster
- Leader election used for controllers
πΉ Options
Managed (EKS, GKE, AKS):
- HA handled by cloud provider.
Self-managed:
- kubeadm with stacked etcd
- External etcd cluster
π₯ Production Insight
Common mistakes:
- Single master
- Single etcd
- No LB in front of API server
- No etcd backup
π₯ Interview Upgrade Answer
Mention:
- Use 3 control plane nodes
- Separate etcd disks (SSD)
- Enable API server audit logging
- Regular etcd snapshots
- Test restore process
If you mention restore testing β interviewer knows youβve done real work.
Now weβre entering the area where most 2β3 year DevOps engineers collapse β networking.
If you master this section, your interview confidence will jump massively.
π₯ Question 11
How does pod-to-pod communication work across nodes?
β Real Production Answer
In Kubernetes, every pod gets:
- Its own IP
- Flat networking model
- No NAT between pods
Kubernetes follows:
Every pod can talk to every other pod directly via IP.
πΉ Same Node Communication
- Pods connected via Linux bridge (like
cni0) - Traffic stays local
πΉ Cross-Node Communication
This is where CNI plugin matters.
Example (AWS EKS with VPC CNI):
- Pods get real VPC IPs
- ENIs attached to worker nodes
- Traffic routed via VPC
Example (Calico):
- Uses overlay networking (VXLAN/IPIP)
- Encapsulates traffic
Flow: Pod A β Node network β CNI routing β Node B β Pod B
π₯ Production Insight
If cross-node traffic fails:
Check:
- CNI plugin logs
- Node routes (
ip route) - Security groups (in cloud)
- NetworkPolicy
Networking issues are 80% of real cluster debugging.
π₯ Question 12
What is CNI β and what breaks if CNI fails?
β Real Production Answer
CNI = Container Network Interface.
It is the plugin responsible for:
- Assigning pod IP
- Configuring networking
- Managing routes
Without CNI:
- Pods wonβt get IP
- Pods stuck in ContainerCreating
- Cross-node communication fails
πΉ Common CNIs
- AWS VPC CNI
- Calico
- Cilium
- Flannel
- Weave
π₯ Production Insight
If CNI pods crash:
- Entire cluster networking unstable
- New pods fail to start
- Services may break
Always monitor:
- CNI DaemonSet health
- IP exhaustion (very common in AWS)
IP exhaustion is a classic production issue.
π₯ Question 13
Difference between ClusterIP, NodePort, LoadBalancer in real usage.
β ClusterIP (Default)
- Internal-only
- Accessible inside cluster
- Used for microservices communication
Example: Backend service accessed by frontend.
β NodePort
- Exposes service on every nodeβs IP + static port (30000β32767)
- Mostly used for testing
- Not ideal for production
β LoadBalancer
- Cloud provider provisions external LB
- Exposes service publicly
- Used for production traffic
Example: Public API service.
π₯ Production Insight
Best practice: LoadBalancer β Ingress Controller β ClusterIP services
Avoid exposing every service with LoadBalancer (cost issue).
π₯ Question 14
How kube-proxy works (iptables vs ipvs modes)?
β Real Production Answer
kube-proxy manages service routing.
When you create a Service:
- kube-proxy sets up rules on nodes.
πΉ iptables Mode
- Uses Linux iptables rules
- Simple
- Slower at scale (large clusters)
πΉ IPVS Mode
- Uses Linux IP Virtual Server
- More efficient
- Better performance
- Recommended for large clusters
π₯ Production Insight
If service routing fails:
Check:
kubectl get svc
kubectl describe svc
iptables -L -nIn large clusters, IPVS performs better.
π₯ Question 15
What is headless service and when used?
β Real Production Answer
Headless Service = Service without ClusterIP.
Defined as:
clusterIP: NoneNo load balancing.
Instead:
- DNS returns all pod IPs.
πΉ Used In:
- StatefulSets
- Databases
- Direct pod-to-pod communication
- Kafka clusters
Example:
mysql-0.mysql-headless.default.svc.cluster.local
Each pod gets stable DNS.
π₯ Production Insight
If you need:
- Direct communication between cluster members
- Stable identity
- Peer discovery
Use headless service.
π₯ Question 16
How DNS resolution works inside the cluster?
β Real Production Answer
Kubernetes uses CoreDNS for internal DNS.
When a pod starts:
- kubelet injects DNS config into
/etc/resolv.conf - Nameserver usually points to CoreDNS service IP
- Pod queries CoreDNS
- CoreDNS checks Kubernetes API for service/pod records
- Returns IP
πΉ Service DNS Format
<service-name>.<namespace>.svc.cluster.localExample:
backend.default.svc.cluster.localShort names work because of search domains.
πΉ For Headless Services
DNS returns:
- Multiple A records (one per pod)
π₯ Production Debugging
If DNS fails:
Check:
kubectl get pods -n kube-system(CoreDNS running?)
Test inside pod:
nslookup service-nameCommon issues:
- CoreDNS crash
- NetworkPolicy blocking DNS (UDP 53)
- CNI issues
DNS failure = full microservice meltdown.
π₯ Question 17
How would you debug if one pod cannot reach another pod?
β Real Production Approach
I follow structured debugging:
Step 1: Basic Connectivity
From source pod:
ping target-ip
curl target-serviceIf IP works but service name fails β DNS issue.
Step 2: Check Service
kubectl get svc
kubectl describe svc
kubectl get endpointsIf endpoints empty β selector mismatch.
Step 3: Check NetworkPolicy
Very common mistake.
kubectl get networkpolicyIf policy exists β verify ingress/egress rules.
Step 4: CNI & Node Level
- Check CNI pod health
- Check node routes
- Security groups (cloud)
π₯ Production Insight
80% of inter-pod issues are:
- Wrong label selector
- NetworkPolicy blocking
- Port mismatch
π₯ Question 18
How is NetworkPolicy enforced and common mistakes?
β Real Production Answer
NetworkPolicy defines allowed traffic at pod level.
But important:
NetworkPolicy only works if CNI supports it.
Example:
- Calico supports
- AWS VPC CNI alone doesnβt enforce (needs Calico)
πΉ Enforcement
NetworkPolicy:
- Applied at pod level
- Uses labels
- Default deny model if policy exists
If any NetworkPolicy applied to a namespace: β Traffic not explicitly allowed is denied.
π₯ Common Mistakes
- Forgetting egress rules
- Forgetting DNS (UDP 53)
- Wrong pod labels
- Applying policy but CNI doesnβt support it
Production issue example: App can't call external API because egress blocked.
π₯ Question 19
Difference between Ingress and Gateway API?
β Ingress
- Older abstraction
- Layer 7 HTTP routing
- Requires Ingress Controller (Nginx, ALB, Traefik)
Supports:
- Host-based routing
- Path-based routing
- TLS termination
β Gateway API (Newer & More Powerful)
- More flexible
- Role-based separation
- Better traffic control
- Supports advanced routing
Gateway API separates:
- Gateway (infra)
- HTTPRoute (app routing)
π₯ Production Insight
Ingress still widely used.
Gateway API is future direction.
If you say:
"Gateway API gives better separation between infra and app teams"
Interviewer will be impressed.
π₯ Question 20
How TLS termination works with Ingress controller?
β Real Production Flow
-
User hits HTTPS endpoint.
-
LoadBalancer forwards traffic to Ingress Controller.
-
Ingress Controller:
- Uses TLS secret
- Terminates TLS
- Forwards HTTP to backend service
πΉ TLS Secret
Stored as:
type: kubernetes.io/tlsContains:
- tls.crt
- tls.key
πΉ Production Best Practice
Use cert-manager:
- Automatically issues certificates (Let's Encrypt)
- Auto-renewal
- Reduces manual errors
π₯ Real Production Failure Cases
- Expired certificate
- Secret missing
- Wrong host in Ingress rule
- Port mismatch
π₯ Question 21
Difference between resource requests and limits β real impact on scheduling?
β Real Production Answer
In Kubernetes:
- Requests β used for scheduling
- Limits β enforced at runtime
πΉ Requests
When a pod is scheduled, kube-scheduler checks:
- CPU request
- Memory request
Scheduler ensures the node has at least that much available.
If no node satisfies β Pod stays Pending.
πΉ Limits
Enforced by container runtime using cgroups.
- CPU limit β throttling
- Memory limit β OOMKill
π₯ Real Production Impact
If you donβt define requests:
- Scheduler may overcommit node
- Many pods land on same node
- Node pressure increases
- Random OOMs later
If you donβt define limits:
- One bad pod can consume entire node memory
- Node becomes unstable
Best practice: Always define both.
π₯ Question 22
What happens if limits are not defined?
β Real Production Answer
If limits not defined:
- CPU β unlimited usage (can starve others)
- Memory β can consume entire node
- Node may enter MemoryPressure
- Kernel OOM killer may kill random pods
In worst case:
- Node crashes
- Multiple services affected
π₯ Production Insight
In shared clusters: Never allow workloads without limits.
Use:
- LimitRange
- ResourceQuota
To enforce guardrails at namespace level.
π₯ Question 23
What is OOMKilled and how to prevent it?
β Real Production Answer
OOMKilled happens when:
- Container exceeds memory limit
- Linux kernel kills it
Pod status shows:
Reason: OOMKilledπΉ Root Causes
- Memory leak in app
- Too low memory limit
- Traffic spike
- Poor request/limit tuning
π₯ Debugging Approach
- Check pod describe
- Check previous logs:
kubectl logs pod-name --previous- Compare usage vs limits (Prometheus/Grafana)
π₯ Prevention
- Set realistic memory requests & limits
- Use HPA
- Profile application memory
- Avoid equal request=limit unless needed
π₯ Question 24
How does HPA calculate scaling decisions?
β Real Production Answer
HPA works based on:
Current Metric / Target MetricExample:
If CPU target = 60% Current average CPU = 90%
New replicas = (90 / 60) Γ current replicas
πΉ Requirements
- Metrics Server installed
- CPU requests defined
If requests missing β HPA wonβt work properly.
πΉ Scaling Cycle
- HPA checks metrics periodically (default 15s)
- Calculates desired replicas
- Updates Deployment
- ReplicaSet creates new pods
π₯ Production Insight
Common issue: HPA scales up fast, scales down slowly (stabilization window).
You must tune:
- minReplicas
- maxReplicas
- scaleDown behavior
π₯ Question 25
Metrics Server vs Prometheus for HPA β difference?
β Metrics Server
- Lightweight
- Provides CPU & memory metrics only
- Used by HPA
- Not long-term storage
β Prometheus
- Full monitoring system
- Stores historical metrics
- Custom metrics support
- Can integrate with HPA via adapter
π₯ Production Insight
Default HPA uses Metrics Server.
For advanced scaling (like requests per second): Use:
- Prometheus Adapter
- Custom metrics API
Example: Scale based on:
- Queue length
- HTTP requests/sec
- Kafka lag
Thatβs more production-grade scaling.
π₯ Question 26
When HPA fails to scale β what are your debugging steps?
β Real Production Answer
If HPA is not scaling, I check systematically:
Step 1: Check HPA Status
kubectl get hpa
kubectl describe hpa <name>Look for:
- Current metrics
- Target metrics
- Events
- Conditions
If it says:
failed to get CPU utilization
β Metrics Server issue.
Step 2: Verify Metrics Server
kubectl get pods -n kube-systemCheck metrics-server is running.
Test:
kubectl top podsIf this fails β HPA won't work.
Step 3: Check Resource Requests
HPA calculates based on CPU requests.
If CPU request not defined:
- Scaling wonβt behave correctly.
Step 4: Check min/maxReplicas
Sometimes HPA not scaling because:
- Already at maxReplicas
- Current replicas equal calculated replicas
Step 5: Stabilization Window
Scale down might not happen due to:
- Stabilization window (default 300s)
π₯ Production Insight
Most common causes:
- Missing CPU requests
- Metrics Server misconfigured
- Target utilization unrealistic
π₯ Question 27
Difference between HPA, VPA, and Cluster Autoscaler?
β HPA (Horizontal Pod Autoscaler)
- Scales number of pods
- Based on CPU/memory/custom metrics
Used for:
- Web apps
- APIs
β VPA (Vertical Pod Autoscaler)
- Adjusts CPU/memory requests & limits
- Does NOT scale pod count
- Often restarts pods to apply new values
Used for:
- Stateful workloads
- Apps needing tuning
β οΈ Important
Do NOT run HPA and VPA on same resource for CPU β conflict risk.
β Cluster Autoscaler
- Scales nodes
- Adds/removes worker nodes
- Works when pods are Pending due to lack of resources
Flow: HPA scales pods β No space β Cluster Autoscaler adds nodes.
π₯ Production Insight
Scaling hierarchy:
- HPA tries first
- If node capacity full β Cluster Autoscaler triggers
- Node joins β Pending pods scheduled
π₯ Question 28
PodDisruptionBudget β real production use case?
β Real Production Answer
PDB ensures minimum pods stay available during voluntary disruptions.
Voluntary disruptions:
- Node drain
- Cluster upgrade
- Manual eviction
Example:
3 replicas running.
PDB:
minAvailable: 2During node upgrade: Only 1 pod can be evicted at a time.
π₯ Why Important?
Without PDB: During node drain β all pods might go down β outage.
π₯ Production Scenario
While upgrading EKS:
- Node draining respects PDB
- Ensures zero downtime
π₯ Question 29
Taints & tolerations β when have you used them?
β Real Production Answer
Taints repel pods.
Tolerations allow pods to run on tainted nodes.
Real Use Cases
-
Dedicated GPU nodes
- Taint GPU nodes
- Only ML workloads tolerate
-
Infra nodes
- Taint monitoring/logging nodes
- Prevent regular apps from scheduling
-
Spot instances
- Taint spot nodes
- Only fault-tolerant workloads run there
π₯ Production Insight
If pod Pending with:
node(s) had taint that pod didn't tolerate
Add toleration in spec.
π₯ Question 30
Node affinity vs Pod affinity vs Anti-affinity β real scenario usage?
β Node Affinity
Controls which nodes pod can schedule on.
Example: Schedule only on:
- SSD nodes
- GPU nodes
- Specific AZ
β Pod Affinity
Schedule pod close to another pod.
Example: App + cache in same zone for latency reduction.
β Pod Anti-Affinity
Ensure pods are NOT on same node.
Example: 3 replicas of API β spread across 3 nodes.
π₯ Question 31
Rolling update β what parameters control its behavior?
β Real Production Answer
Rolling update is default strategy in Deployment.
Controlled by:
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 1πΉ maxUnavailable
How many pods can be unavailable during update.
Example: Replicas = 4 maxUnavailable = 1
At least 3 pods always running.
πΉ maxSurge
How many extra pods can be created above desired replicas.
Example: Replicas = 4 maxSurge = 1
Kubernetes can temporarily run 5 pods.
π₯ Production Insight
For high-traffic apps:
- maxUnavailable = 0
- maxSurge = 1 or 25%
Ensures zero downtime.
π₯ Question 32
How do maxUnavailable and maxSurge affect rollout?
β Real Production Example
Replicas = 10 maxUnavailable = 2 maxSurge = 3
During rollout:
- Up to 3 new pods created
- Up to 2 old pods taken down
So total pods can go up to 13 temporarily.
π₯ Impact
If maxUnavailable too high: β Risk downtime
If maxSurge too high: β Resource pressure
Production Balance
Low traffic app β aggressive rollout OK Critical production β conservative rollout
π₯ Question 33
How to implement Blue-Green deployment in Kubernetes?
β Real Production Answer
Blue-Green = two identical environments.
Approach:
-
Deploy:
- deployment-blue
- deployment-green
-
Service points to one of them.
Switch by changing:
- Service selector OR
- Ingress route
Flow:
Current: Service β blue
Deploy green Test green Switch service selector β green Remove blue later
π₯ Production Insight
Benefits:
- Instant rollback (just switch back)
- Safe for big schema changes
Downside:
- Double resource usage
π₯ Question 34
How to implement Canary deployment in Kubernetes?
β Real Production Answer
Canary = gradual traffic shift.
Basic Method (Simple)
Deploy:
- app-v1 (stable)
- app-v2 (canary, fewer replicas)
Traffic automatically distributed by Service.
Example: 10 replicas v1 1 replica v2 ~10% traffic to v2
Advanced Method (Ingress Based)
Using:
- NGINX Ingress annotations
- Istio / service mesh
Example: Route:
- 90% β v1
- 10% β v2
Gradually increase.
π₯ Production Insight
True canary requires:
- Monitoring
- Automated rollback
- Metrics comparison
Without metrics β it's blind rollout.
π₯ Question 35
How to rollback a bad deployment safely?
β Real Production Answer
First: Check rollout status:
kubectl rollout status deployment appIf broken:
kubectl rollout undo deployment appThis restores previous ReplicaSet.
π₯ What Actually Happens?
Deployment scales down new ReplicaSet. Scales up old ReplicaSet.
Production-Level Rollback Strategy
Better approach:
- Use readiness probes properly
- Monitor error rate
- Use automated rollback (Argo Rollouts / Flagger)
π₯ Interview Upgrade Answer
Mention:
-
Donβt rely only on manual rollback
-
Monitor:
- HTTP 5xx
- Latency
- CPU spike
-
Use progressive delivery tools
That signals maturity.
π₯ Question 36
How does readiness probe affect rollout?
β Real Production Answer
Readiness probe determines whether a pod is ready to receive traffic.
During rollout:
- New pod is created
- Kubernetes waits until readiness probe passes
- Only then does it send traffic
- Only then old pod is terminated (based on rollout strategy)
π₯ What If Readiness Probe Fails?
- Pod remains in
NotReady - Service does NOT route traffic to it
- Rollout may get stuck
If maxUnavailable = 0 And new pods never become Ready β Rollout blocks completely.
π₯ Production Insight
Bad readiness configuration can cause:
- Stuck deployment
- Traffic imbalance
- Partial outages
Best practice: Readiness should check:
- App health
- DB connectivity (if critical)
- Dependencies ready
π₯ Question 37
Liveness vs Readiness vs Startup probe β failure impact?
β Liveness Probe
Checks:
Should this container be restarted?
If liveness fails:
- Container restarted
Used to detect:
- Deadlocks
- Stuck processes
β Readiness Probe
Checks:
Should this pod receive traffic?
If fails:
- Traffic stops
- Pod not restarted
β Startup Probe
Used for:
- Slow starting apps
Disables liveness until startup passes.
π₯ Production Mistake
Common error: Using liveness probe for DB connection check.
Result: Temporary DB issue β pod restarts continuously β worse outage.
Correct approach:
- DB check in readiness, not liveness.
π₯ Question 38
How to achieve zero downtime deployment?
β Real Production Strategy
-
Use RollingUpdate
- maxUnavailable: 0
- maxSurge: 1
-
Proper readiness probe
-
Multiple replicas
-
PodDisruptionBudget
-
Graceful shutdown handling in app
π₯ Critical Element
App must handle:
- SIGTERM signal
- Stop accepting traffic
- Finish ongoing requests
- Exit cleanly
If app ignores SIGTERM: β Rolling update causes dropped requests.
Production Add-ons
- Use preStop hook
- Increase terminationGracePeriodSeconds
π₯ Question 39
What breaks zero downtime deploy most often?
β Real Production Failures
- Single replica app
- No readiness probe
- DB migration blocking
- App not handling SIGTERM
- Wrong resource limits causing crash
- HPA scaling too slow
- Sticky sessions not handled
π₯ Real Example
Deploy new version. Readiness passes. But new version has memory leak. After traffic shift β OOMKilled β outage.
Lesson: Deployment success β production success.
Monitoring is mandatory.
π₯ Question 40
How do you manage config changes without rebuilding image?
β Real Production Answer
Use:
- ConfigMap (non-sensitive config)
- Secret (sensitive data)
Mounted as:
- Environment variables
- Files
πΉ Config Update Without Rebuild
Update ConfigMap:
kubectl apply -f config.yamlBut important:
Pods DO NOT auto-restart.
Options:
- Manually restart deployment
- Use hash annotation in Deployment
- Use Reloader controller
- Use Helm upgrade
π₯ Production Insight
For zero downtime config update:
- Update ConfigMap
- Rolling restart deployment
Never bake config into image in production.
π₯ Question 41
PV vs PVC vs StorageClass β full lifecycle explanation
β Real Production Answer
πΉ PersistentVolume (PV)
-
Actual storage resource
-
Could be:
- EBS
- NFS
- EFS
- Ceph
- Local disk
Cluster-level object.
πΉ PersistentVolumeClaim (PVC)
-
Request for storage by pod
-
Namespace-level object
-
Specifies:
- Size
- Access mode
- StorageClass
πΉ StorageClass
Defines:
- Provisioner
- Parameters
- Reclaim policy
- Volume binding mode
Used for dynamic provisioning.
π Full Lifecycle (Dynamic Provisioning Example)
-
Pod creates PVC.
-
PVC references StorageClass.
-
StorageClass provisioner creates actual volume (like EBS).
-
PV created and bound to PVC.
-
Pod mounts PVC.
-
Pod writes data.
-
If PVC deleted:
-
Reclaim policy decides:
- Delete
- Retain
-
π₯ Production Insight
Always check:
kubectl get pvc
kubectl describe pvcIf PVC stuck in Pending β StorageClass issue.
π₯ Question 42
Static vs Dynamic provisioning
β Static Provisioning
Admin manually creates PV. PVC binds to matching PV.
Used when:
- Pre-existing storage
- Special compliance cases
Hard to scale.
β Dynamic Provisioning
Most common.
PVC β StorageClass β Auto create volume.
Example in AWS:
- PVC triggers EBS creation.
π₯ Production Best Practice
Always prefer dynamic provisioning unless special need.
Reduces manual mistakes.
π₯ Question 43
How volume binding works?
β Real Production Answer
Binding process:
-
PVC created.
-
Kubernetes searches for:
- Matching PV OR
- Uses StorageClass to provision new PV.
Matching based on:
- Access mode
- Storage size
- StorageClass name
Once matched: PVC status β Bound
π₯ VolumeBindingMode
Important field in StorageClass:
volumeBindingMode: WaitForFirstConsumerThis delays volume creation until pod scheduled.
Why important?
For:
- Multi-AZ clusters
- Ensures volume created in same zone as pod
Without this: Volume may create in wrong AZ β scheduling failure.
π₯ Question 44
When PVC stays Pending β root causes?
β Real Production Debug Flow
If PVC Pending:
Check:
kubectl describe pvc <name>Common causes:
- No matching StorageClass
- Wrong StorageClass name
- Insufficient quota
- Provisioner not running
- VolumeBindingMode conflict
- Cloud permission issue (IAM)
π₯ Real Production Case
In AWS:
EBS provisioner fails because:
- Worker node IAM role missing permission
- Subnet not tagged properly
PVC remains Pending.
π₯ Question 45
Stateful app storage best practices
β Real Production Best Practices
- Use StatefulSet
- Use dynamic provisioning
- Use WaitForFirstConsumer
- Ensure backups enabled
- Avoid deleting PVC blindly
- Use appropriate access mode
π₯ Important
For database:
- One PVC per replica
- Never share RWO volume across pods
- Always test restore process
π₯ Production Risk
Deleting StatefulSet does NOT delete PVC by default.
Good: Prevents accidental data loss.
Bad: Leftover storage cost if not cleaned.
π₯ Question 46
RWX vs RWO β production implications?
β RWO (ReadWriteOnce)
- Volume can be mounted by one node at a time
- Most common (EBS in AWS)
- Safe for databases
Example: MySQL pod using EBS volume β RWO.
β RWX (ReadWriteMany)
-
Volume can be mounted by multiple nodes simultaneously
-
Requires shared filesystem:
- EFS
- NFS
- CephFS
Used for:
- Shared content
- File uploads
- ML shared datasets
π₯ Production Implications
RWO:
- Better performance
- Lower complexity
- Zone-bound
RWX:
- More flexible
- Higher latency (network FS)
- Needs careful permission handling
β οΈ Common Mistake
Trying to use EBS (RWO) with multiple replicas β fails.
Know your backend storage limitations.
π₯ Question 47
How do you design RBAC with least privilege?
β Real Production Answer
RBAC has:
- Role / ClusterRole
- RoleBinding / ClusterRoleBinding
- ServiceAccount
Principle: Grant only required permissions.
πΉ Example
If app only needs to:
- Read ConfigMaps
Create:
Role:
verbs: ["get", "list"]
resources: ["configmaps"]Bind to ServiceAccount.
π₯ Production Best Practices
- Never use cluster-admin for apps
- Separate infra vs app roles
- Audit API server logs
- Use namespace isolation
π₯ Red Flag in Interview
If someone says:
βI give cluster-admin to simplify things.β
Thatβs a security risk.
π₯ Question 48
Difference between Role and ClusterRole?
β Role
- Namespace-scoped
- Limited to one namespace
Used for:
- App-specific permissions
β ClusterRole
-
Cluster-wide
-
Can:
- Access all namespaces
- Access non-namespaced resources (nodes, PV)
π₯ Important
ClusterRole can still be bound to a single namespace using RoleBinding.
Production Use Case
Monitoring tool: Needs to read pods in all namespaces β ClusterRole.
App: Needs access only in its namespace β Role.
π₯ Question 49
How ServiceAccount is used by pods?
β Real Production Answer
Every pod runs with a ServiceAccount.
If not specified: β default ServiceAccount.
πΉ What It Does
- Provides identity to pod
- Used for API access
- Mounts token inside pod
Token location:
/var/run/secrets/kubernetes.io/serviceaccount/π₯ Production Best Practice
- Create custom ServiceAccount per app
- Attach minimal RBAC
- Disable auto-mount token if not needed
π₯ In Cloud (Example: EKS)
ServiceAccount can be linked with IAM role (IRSA).
Pod β IAM role β AWS API securely.
Very important for production AWS setups.
π₯ Question 50
How secrets are stored β and why base64 is not encryption?
β Real Production Answer
By default:
Secrets stored in etcd as base64 encoded.
Base64 β encryption.
Anyone with etcd access can decode.
π₯ Secure Production Setup
Enable:
Encryption at RestUsing:
- KMS provider
- EncryptionConfiguration
π₯ Best Practices
-
Never commit secrets in Git
-
Use external secret managers:
- AWS Secrets Manager
- HashiCorp Vault
-
Use sealed secrets or External Secrets Operator
π₯ Interview Upgrade Answer
If you mention:
- etcd encryption
- KMS integration
- IRSA
- Secret rotation strategy
Youβre signaling production maturity.