Model answers for 4 Kubernetes questions
Typical round: object basics, a broken-pod scenario, a design question
Q: A pod is Pending. What do you check? A: kubectl describe pod for scheduling events. Usual causes are insufficient CPU or memory on nodes, unbound PersistentVolumeClaims, node selectors or taints that no node matches, or a full quota in the namespace.
Q: A service isn't reaching its pods. Why? A: Compare the service selector with the pod labels, check kubectl get endpoints, confirm the targetPort matches the container port, verify the pods are Ready, and check network policies.
Q: Liveness vs readiness probe? A: Readiness decides whether a pod receives traffic; failing it removes the pod from service endpoints. Liveness decides whether the container should be restarted. A wrong liveness probe can cause restart loops, so it should be less aggressive.
Q: How does the Horizontal Pod Autoscaler work? A: It reads metrics like CPU utilisation relative to resource requests, from the metrics server or custom metrics, and adjusts the replica count of a deployment between min and max. Without requests set, CPU-based scaling can't work properly.