Definition:

  • select objects based on labels
  • unlike names and UIDs, objects are not expected to have same labels

Equity-based requirement:

  • environment = prod
  • environment == prod
  • environment != prod

Set-based requirement

  • environment in (production, qa)
  • tier notin (frontend, backend)
  • partition if label exist
  • !partition: if label doesnt exist

API

  • matchExpressions
    • key
    • operator (In, NotIn, Exists, DoesNotExist)
    • values
  • matchLabels: map[string]string