Cart

    Sorry, we could not find any results for your search querry.

    Kubernetes matchExpressions

    Kubernetes matchExpressions is a type of selector that has more advanced conditional options than a matchLabel selector. A matchLabel can only be used for cases where labels must match exactly, while a matchExpression can set one or more conditions. For example, a matchExpression selector looks like this:

    selector:
      matchExpressions:
        - {key: name, operator: In, values: [hr, web]}
        - {key: environment, operator: NotIn, values: [dev]}

    Each expression must contain a key, operator, and a list of one or more values. There are four operators available:

    • In: The value of a label of another object must match the value specified here.
    • NotIn: The value of a label of another object must not match the value specified here.
    • Exists: The key of a label of another object must match the key specified here. The value doesn't matter and can be left empty.
    • DoesNotExist: The key of a label of another object must not match the key specified here. The value doesn't matter and can be left empty under matchExpressions.

    If multiple expressions are specified, all expressions must be evaluated and met for a resource to be matched.

    Need help?

    Receive personal support from our supporters

    Contact us