Node Affinity Calculator
Estimate how many nodes in a cluster match a nodeAffinity label selector, and the resulting impact on scheduling flexibility.
Inputs
Percent of nodes carrying the label(s) required by nodeAffinity (e.g. instance type, GPU, zone).
Matching Nodes
12nodes
Max Schedulable Pods
48pods
Can Schedule All Required Replicas
true
Shortfall (If Any)
0pods
Step by step
Matching nodes = total × match%
30 × 40%
= 12 nodes
Max schedulable pods
12 × 4
= 48 pods
How it works
nodeAffinity restricts scheduling to nodes carrying specific labels (instance type, GPU presence, availability zone, custom taints-free pools). The narrower the matching label set, the fewer nodes are eligible, directly capping how many replicas can be scheduled regardless of overall cluster size. This calculator estimates matching node count from a match percentage and checks whether that's enough capacity for your required replica count.
Formula
matchingNodes = floor(totalNodes × labelMatchPercent / 100)
- N
- Total nodes in the cluster
- L
- Percentage of nodes matching the label selector
- M
- Number of nodes matching the affinity rule
Frequently Asked Questions
What's the difference between requiredDuringScheduling and preferredDuringScheduling?
requiredDuringSchedulingIgnoredDuringExecution is a hard constraint — pods that can't find a matching node stay Pending. preferredDuringSchedulingIgnoredDuringExecution is a soft weighted preference the scheduler tries to honor but will violate rather than leave a pod unscheduled.
Why would matching nodes be less than expected?
Label match percentage often shrinks unexpectedly when combined with other constraints — a GPU-labeled node pool might also be tainted for a different workload, or already saturated by another team's pods, netting out effective availability lower than raw label matching alone suggests.
How does this interact with the cluster autoscaler?
The autoscaler only adds nodes from node groups capable of satisfying a Pending pod's affinity rules — if no node group carries the required labels, autoscaling won't help and the pod stays Pending indefinitely.