Kubernetses Interview Questions:

Kuberneste interview questions: 1).🔥 Kubernetes Critical Interview Q&A (with Commands) ⚙️ 1. Pod Crash / Debugging Q: Pod is crashing. How do you troubleshoot? kubectl get pods kubectl describe pod kubectl logs kubectl logs --previous kubectl exec -it -- /bin/sh kubectl get events --sort-by=.metadata.creationTimestamp ⚙️ 2. Pod Pending Issue Q: Pod stuck in Pending state kubectl describe pod kubectl get nodes kubectl describe node kubectl get pvc kubectl describe pvc ⚙️ 3. Desired Pods ≠ Running Pods Q: Desired = 5, Running = 3 kubectl get deployment kubectl describe deployment kubectl get rs kubectl get pods -o wide kubectl describe pod kubectl get nodes kubectl top nodes 🌐 4. Service Not Reachable Q: Service is not accessible kubectl get svc kubectl describe svc kubectl get endpoints kubectl get pods -o wide kubectl exec -it -- curl kubectl exec -it -- nslookup 🌐 5. Networking Issue Between Pods kubectl exec -it -- ping kubectl exec -it -- curl kubectl get networkpolicy kubectl describe networkpolicy 🔐 6. RBAC Permission Issue Q: User not able to access resources kubectl auth can-i create pods --as= kubectl get role,rolebinding kubectl get clusterrole,clusterrolebinding kubectl describe role 📦 7. Storage Issue (PVC not binding) kubectl get pv kubectl get pvc kubectl describe pvc kubectl describe pv kubectl get storageclass ⚙️ 8. Node Not Ready kubectl get nodes kubectl describe node systemctl status kubelet journalctl -u kubelet kubectl get pods -n kube-system ⚙️ 9. High CPU / Memory Usage kubectl top nodes kubectl top pods kubectl describe pod kubectl get hpa kubectl describe hpa 🚀 10. Scaling Application Manual Scaling kubectl scale deployment --replicas=5 Auto Scaling (HPA) kubectl autoscale deployment --cpu-percent=70 --min=2 --max=10 kubectl get hpa 🔄 11. Rolling Update / Zero Downtime kubectl set image deployment/ app=nginx:v2 kubectl rollout status deployment/ kubectl rollout history deployment/ kubectl rollout undo deployment/ 🌍 12. Ingress Troubleshooting kubectl get ingress kubectl describe ingress kubectl get pods -n ingress-nginx kubectl logs -n ingress-nginx ⚡ 13. Taints & Tolerations Issue kubectl describe node | grep Taints kubectl describe pod 🔧 14. ConfigMap / Secret Issue kubectl get configmap kubectl describe configmap kubectl get secret kubectl describe secret kubectl exec -it -- env 📊 15. Logs & Monitoring kubectl logs kubectl logs -f kubectl logs --previous kubectl get events 🧠 16. Cluster Health Check kubectl cluster-info kubectl get componentstatuses kubectl get nodes kubectl get pods -A 🔥 17. Restart / Redeploy Pods kubectl rollout restart deployment kubectl delete pod ⚙️ 18. Debug Inside Pod kubectl exec -it -- /bin/bash kubectl exec -it -- env kubectl exec -it -- netstat -tulnp 🚨 19. Image Pull Error kubectl describe pod kubectl get events docker pull # (node level) ⚡ 20. Check All Resources Quickly kubectl get all kubectl get all -A kubectl get pods -o wide ====================================================== 1. Cluster Architecture & Design Q1: Explain Kubernetes architecture in detail.
👉 Focus: * Control Plane: API Server, Scheduler, Controller Manager, etcd * Worker Nodes: Kubelet, Kube-proxy, Container Runtime Q2: How does the Kubernetes scheduler decide pod placement?
👉 Key points: * Resource requests/limits * Taints & tolerations * Node affinity / anti-affinity * Pod topology spread ⚙️ 2. Pod & Workload Management Q3: Difference between Deployment vs StatefulSet? * Deployment → Stateless apps * StatefulSet → Stateful apps (stable hostname, storage) Q4: What happens when a pod crashes? kubectl describe pod kubectl logs 👉 Kubernetes restarts based on restartPolicy Q5: How do you scale applications manually and automatically? kubectl scale deployment app --replicas=5 kubectl autoscale deployment app --cpu-percent=70 --min=2 --max=10 🌐 3. Networking (VERY IMPORTANT) Q6: Explain Kubernetes networking model.
👉 Every pod gets: * Unique IP * Flat network (no NAT) Q7: Difference between ClusterIP, NodePort, LoadBalancer? * ClusterIP → Internal * NodePort → External via node * LoadBalancer → Cloud-based LB Q8: How do you troubleshoot service not reachable? kubectl get svc kubectl describe svc kubectl get endpoints kubectl exec -it -- curl 🔐 4. Security (HIGHLY ASKED) Q9: How do you secure Kubernetes cluster? * RBAC * Network Policies * Pod Security Standards * Secrets management Q10: Difference between Role and ClusterRole? * Role → Namespace level * ClusterRole → Cluster level 📦 5. Storage Q11: Explain Persistent Volume (PV) & PVC * PV → Actual storage * PVC → Request Q12: Difference between StorageClass and PV? * StorageClass → Dynamic provisioning * PV → Static provisioning 🔄 6. Troubleshooting (MOST CRITICAL) Q13: Pod is stuck in Pending state – why?
👉 Possible reasons: * No resources * Node not available * PVC issue kubectl describe pod Q14: Pod in CrashLoopBackOff – how to fix? kubectl logs kubectl describe pod 👉 Check: * App errors * Config issues * Liveness probe failure Q15: Node is NotReady – what will you check? kubectl get nodes kubectl describe node systemctl status kubelet 🚀 7. CI/CD & DevOps Integration Q16: How do you deploy application using CI/CD?
👉 Flow: * Git → Jenkins → Docker build → Push → Kubernetes deploy Q17: How do you update application with zero downtime?
👉 Rolling update: kubectl set image deployment/app container=nginx:v2 ⚡ 8. Advanced Concepts Q18: What are taints and tolerations?
👉 Control pod scheduling on nodes Q19: What is Ingress and how it works?
👉 HTTP/HTTPS routing using Ingress Controller Q20: Difference between Horizontal Pod Autoscaler (HPA) and Vertical Pod Autoscaler (VPA)? * HPA → Scale pods * VPA → Adjust resources 🧠 9. Real-Time Scenario Questions (VERY IMPORTANT) Q21: Desired pods = 5 but running = 3. What will you do? kubectl get pods kubectl describe pod kubectl get nodes 👉 Check: * Resource issue * Scheduling issue * Node failure Q22: How do you debug networking issue between pods? kubectl exec -it pod -- ping kubectl exec -it pod -- curl Q23: How to handle high traffic in Kubernetes? * HPA * LoadBalancer * CDN * Pod optimization

Comments