All Tools View Categories About Contact Privacy

Affinity / Anti-affinity YAML Generator

Build a valid Kubernetes Pod (v1) with nodeAffinity and podAntiAffinity rules.

Runs entirely in your browser - nothing is uploaded and no cluster connection is made.
0
node exprs
0
pod exprs
Your generated Pod YAML will appear here.

About Affinity / Anti-affinity YAML Generator

Affinity and anti-affinity control pod placement in a cluster. The Affinity YAML Generator writes a Pod with an affinity block from a form so you do not have to recall the core/v1 schema.

You set the Pod name and container, choose a nodeAffinity mode (required or preferred) with match expressions, and optionally a podAntiAffinity mode with a topology key and match expressions. The resulting YAML is a valid core/v1 Pod.

Names and expression keys/values are validated as RFC 1123 labels. Problems are reported in a clear panel. Everything runs locally and nothing is uploaded.

Features

  • nodeAffinity - required or preferred node selector terms.
  • podAntiAffinity - preferred/required with topologyKey.
  • matchExpressions - key, operator and values.
  • core/v1 - correct Pod schema.
  • Validation - RFC 1123 names and label keys/values.
  • Copy / Download / Print - get pod.yaml wherever you need it.

How to Use

  1. Name the Pod and container.
  2. Set nodeAffinity mode and expressions.
  3. Optionally set podAntiAffinity mode, topology key and expressions.
  4. Watch the preview and export.

Examples

Example 1 - node gpu. nodeAffinity required gpu=true.

Example 2 - spread. podAntiAffinity preferred by hostname.

Example 3 - zone. nodeAffinity required topology zone.

Benefits

  • Correct schema - valid core/v1 Pod with affinity.
  • Placement control - node and pod affinity/anti-affinity.
  • Validated - names and label keys/values checked.
  • Clean output - empty fields omitted.
  • Private - everything runs in the browser.
  • Copy, download or print - get the manifest where you need it.

Frequently Asked Questions

What is affinity?
Affinity lets you constrain which nodes pods are scheduled on, using rules about node labels (nodeAffinity) or other pods (podAffinity / podAntiAffinity).
Required vs preferred?
Required rules must be satisfied for scheduling to succeed; preferred rules are best-effort and scored with a weight.
What is a topologyKey?
For pod affinity/anti-affinity it is the node label that defines the topological domain (e.g. kubernetes.io/hostname) the rule applies within.
Is the name validated?
Yes. The Pod name, container name and any label keys/values used in expressions are validated as RFC 1123.
Does this connect to a cluster?
No. Everything is assembled in your browser and nothing is uploaded.
Can I download it?
Yes. Copy the YAML, download pod.yaml, or print it.