Kubernetes
Label & Selector Builder
Build matchLabels and matchExpressions alongside the kubectl -l form, with validation.
Equality labels
These become matchLabels, and key=value on the command line.
Recommended labels
Set-based rules
Selector
Command line
kubectl -lkubectl get pods -l 'app.kubernetes.io/name=api,app.kubernetes.io/component=backend,environment in (staging,production)'Manifest
Deployment, Service, NetworkPolicyselector:
matchLabels:
app.kubernetes.io/name: api
app.kubernetes.io/component: backend
matchExpressions:
- key: environment
operator: In
values:
- staging
- productionLabels to apply
on the objects this should matchlabels:
app.kubernetes.io/name: api
app.kubernetes.io/component: backendValidKeys and values satisfy the API server's rules.