Interview Prep/Real-World Interview/Kubernetes cluster-level

Pods are Pending, but Cluster Autoscaler won't add nodes; the pod events say "pod didn't trigger scale-up: 2 node(s) didn't match Pod's node affinity/selector, 1 max node group size reached".

IntermediateTroubleshootingKubernetes cluster-level
Answer

Likely causes → Cluster Autoscaler only scales node groups whose template could fit the pod. Here one group is at its max, and the other groups don't match the pod's nodeSelector/affinity (or lack the toleration for their taints, or are in the wrong AZ for a zonal volume).

Diagnose →

kubectl describe pod <pod> | grep -A3 'Events'
kubectl -n kube-system logs deploy/cluster-autoscaler | grep -iE 'scale-up|max size|NotTriggerScaleUp' | tail
kubectl get configmap cluster-autoscaler-status -n kube-system -o yaml
aws autoscaling describe-auto-scaling-groups --query 'AutoScalingGroups[].[AutoScalingGroupName,DesiredCapacity,MaxSize]'

Fix → Raise the max size of the matching group, or fix the selector/tolerations so the pod fits a group that can grow. For node groups that scale from zero, tag the ASG with its labels and taints (k8s.io/cluster-autoscaler/node-template/label/...) so CA knows what the nodes will look like.

Prevent → Alert on cluster_autoscaler_unschedulable_pods_count and on node groups at max size; Karpenter avoids much of this by choosing instance types per pod.

All Real-World Interview questions Roadmap: Interview readiness

More on Kubernetes cluster-level