#357 · Developer Tool

Kubernetes Label Selector Builder

Create a Kubernetes label selector from one requirement per line and preview both command-line and structured forms. Use equality, inequality, set membership, exclusion, existence, and non-existence operators. The builder validates label keys and values, removes duplicate set values, and produces a selector string plus matchLabels and matchExpressions YAML where the conversion is unambiguous.

Developer Input

YAML or line input

Ad space

How to use this developer tool

  1. Paste the requested YAML or key/value input.
  2. Adjust the available options for the target output.
  3. Select Build Selector or press Ctrl/Cmd + Enter.
  4. Review findings, then copy or download the result.

What this developer tool does

Parses human-editable selector requirements and renders a canonical kubectl selector string together with Kubernetes selector YAML.

Supported forms are key=value, key==value, key!=value, key in (a,b), key notin (a,b), key, and !key. Equality becomes matchLabels; other operators become matchExpressions.

The result is generated locally and should be reviewed before deployment.

Example

The Sample button loads a representative input. Running it produces the same structured output displayed in the result panel, including counts and any findings.

app=web
environment in (production,staging)
tier!=frontend
release

Use cases

  • Pre-commit configuration review
  • Pull request documentation
  • Migration inventory preparation
  • Training and troubleshooting

Tips for reliable output

  • Use spaces instead of tab indentation in YAML.
  • Keep multi-document separators on their own line.
  • Review generated files before applying them.
  • Confirm static findings with official CLI validation.
  • Avoid pasting production secrets into shared devices.

Processing details

Supported forms are key=value, key==value, key!=value, key in (a,b), key notin (a,b), key, and !key. Equality becomes matchLabels; other operators become matchExpressions.

A selector cannot express OR between independent requirements. matchLabels output may be partial when the same key has conflicting equality rules.

Frequently asked questions

Which operators can I use in a Kubernetes label selector?

The result follows the static rules described on this page. Review finding 1 in context and confirm it with the relevant Docker or Kubernetes command before deployment.

How are equality selectors converted into matchLabels?

The result follows the static rules described on this page. Review finding 2 in context and confirm it with the relevant Docker or Kubernetes command before deployment.

Can Kubernetes label selectors express OR between two applications?

The result follows the static rules described on this page. Review finding 3 in context and confirm it with the relevant Docker or Kubernetes command before deployment.

What is the difference between key and !key selector requirements?

Input is processed in your browser. The page does not make a network request with the configuration, but downloaded output and browser history should still be handled according to your security policy.

Why is a label key with a DNS prefix rejected?

The result follows the static rules described on this page. Review finding 5 in context and confirm it with the relevant Docker or Kubernetes command before deployment.