Kubernetes Node Affinity Tester

Describe your nodes and paste a pod, and see which nodes it can land on and why the rest cannot. Required rules exclude and preferred rules only score, which is the distinction that leaves a pod Pending or in the wrong zone.

One node per line: name: key=value,key=value. kubectl get nodes --show-labels gives you these.

Paste below, or drop a file anywhere on this panel

Or drop a file anywhere on this panel. Nothing is uploaded: the analysis runs in this tab.

The answer appears here

Paste on the left and press Test. Nothing leaves this tab.

Examples

Real input you can load into the tool above. Each one shows a different thing going wrong, because that is what the tool is for.

A pod that cannot schedule

Required affinity naming a zone no node has, which is Pending with no obvious cause

affinity:
  nodeAffinity:
    requiredDuringSchedulingIgnoredDuringExecution:
      nodeSelectorTerms:
        - matchExpressions:
            - key: zone
              operator: In
              values: [eu-west-1c]

Preferred affinity

A preference that does not block scheduling, only influences it

affinity:
  nodeAffinity:
    preferredDuringSchedulingIgnoredDuringExecution:
      - weight: 100
        preference:
          matchExpressions:
            - key: type
              operator: In
              values: [on-demand]

Common mistakes

These are the ones that fail silently. The config is accepted, nothing raises an error, and the consequence arrives later.

  1. Using required affinity for a preference

    requiredDuringScheduling means the pod stays Pending forever if nothing matches. There is no fallback.

    Instead:Use preferred unless the pod genuinely cannot run elsewhere.

  2. Expecting affinity to re-evaluate

    IgnoredDuringExecution means a running pod stays put even when the node stops matching.

    Instead:Nothing re-evaluates. Evict deliberately if placement must change.

  3. Confusing nodeSelector with nodeAffinity

    nodeSelector is exact-match only and cannot express In, NotIn or Exists.

    Instead:Use nodeAffinity for anything beyond equality.

Required excludes, preferred only scores

A required rule that matches nothing leaves the pod Pending forever with no error at apply time. A preferred rule that matches nothing changes nothing at all and the pod schedules anywhere. Both look almost identical in YAML.

Terms are ORed, expressions inside a term are ANDed

nodeSelectorTerms is a list and a node qualifies if it satisfies ANY term. Inside one term, every matchExpression must hold. This reads backwards from most selector syntax, where a list of conditions is usually ANDed, and it is why splitting two conditions into two terms quietly widens a rule instead of narrowing it.

nodeSelector is equality only, and it is ANDed with affinity

A nodeSelector cannot express In, NotIn or Exists: it is a flat map compared for equality. When both a nodeSelector and node affinity are present, a node has to satisfy both. Gt and Lt exist in node affinity and nowhere else, and they compare integers, so a label whose value is not an integer never matches them.

What this cannot see

Taints, which are a separate mechanism and exclude pods that these rules would allow: the taint and toleration tester on this site covers those. Resource requests, so a node that qualifies here may still have no room. And pod affinity, which depends on what is already running rather than on labels.

More kubernetes tools

Kubernetes YAML Generator Answer a few questions, get a manifest Kubernetes YAML Validator Is this YAML valid, and where is it wrong? Kubernetes Rollout & Probe Timing Restart loops, capacity dips and stuck drains Kubernetes Service Checker Will this Service have any endpoints? Kubernetes Network Policy Viewer What can reach what, and what just broke Kubernetes Manifest Diff What actually changed Kubernetes Resource Calculator What these manifests actually reserve Kubernetes RBAC Viewer Who can actually do what Kubernetes Deployment Generator See the capacity dip before you deploy Kubernetes Service Generator port, targetPort, and which one you meant Kubernetes StatefulSet Generator Stable names, and volumes that outlive you Kubernetes QoS Class Calculator And where you sit in the eviction order Kubernetes Node Capacity Planner Allocatable is not capacity Kubernetes Max Pods per Node Calculator The ENI limit, not the 110 default Kubernetes Label Selector Tester Which key failed, not just that one did Kubernetes Taint & Toleration Tester Tolerations permit, they do not attract Kubernetes Resource Name Validator RFC 1123 subdomain, label, or 1035 Kubernetes Label & Annotation Validator Why your image tag is not a legal label Kubernetes CrashLoopBackOff Guide The status is a timer, not a cause Kubernetes TLS Certificate Decoder When it expires, and what it covers Kubernetes ServiceAccount Token Decoder Bound or legacy, and when it dies Kubernetes imagePullSecret Generator The registry URL nobody gets right Kubernetes cert-manager Certificates Issuer scope, and the rate limit that costs a week Kubernetes Flux HelmRelease Generator With the source it cannot work without Kubernetes Helm Chart Generator Chart.yaml, values, and working templates Kubernetes Argo CD Application Generator The defaults that are off, turned on Kubernetes Ingress Generator pathType, and the TLS secret that fails quietly Kubernetes HPA Generator Why it says unknown and never scales Kubernetes SecurityContext Generator Pod level, container level, and which wins Kubernetes Probe Generator How long it gets to start before liveness kills it Kubernetes PVC Generator Access modes your storage can actually do Kubernetes ResourceQuota Generator And the LimitRange that stops it breaking deploys Kubernetes CronJob Generator The fields that decide whether it runs Kubernetes NetworkPolicy Generator With the DNS rule already in it Kubernetes RBAC Generator And what it actually grants Kubernetes PodDisruptionBudget Generator Can this budget ever be satisfied? Kubernetes API Deprecation Checker What breaks on the next upgrade Kubernetes Kubeconfig Viewer Read it without handing it to anyone Kubernetes Quantity Parser What 512Mi, 100m and 1e3 actually mean Kubernetes Multi-Document YAML Splitter One file per object, in apply order Kubernetes .env to ConfigMap & Secret Split the credentials out on the way Kubernetes Secret Decoder See what is actually in there Kubernetes Ingress to Gateway API Which annotations silently stop working Kubernetes Manifest Visualizer What points at what, and what points at nothing Kubernetes Patch Tester Which --type, and what it deletes Kubernetes kubectl JSONPath Tester kubectl's dialect, not generic JSONPath Kubernetes Helm Values Diff A missing key is a third value Kubernetes Pod and Service CIDR Fixed at cluster creation Kubernetes Secret Encoder base64 is not encryption Kubernetes API Version Checker Will this apply on that cluster Kubernetes Go Template Tester Go truthiness is not JavaScript's Kubernetes Cluster Cost Estimator At your rates, not a price table Kubernetes Kustomize Build Transformers run in kustomize's order Kubernetes Helm Chart Validator version is SemVer, appVersion is not

Elsewhere on the site