Is it possible to exclude labels with nodeSelector?

10/17/2015

i want to do something like

nodeSelector:
  role: "!database"

in order to schedule pods on nodes which don't host the database.

Thank you

-- Smana
kubernetes

2 Answers

10/18/2015

Not right now.

Such a form was initially discussed in issue #341 and you can follow issue #15494 to track progress on a more configurable label selector.

-- Robert Bailey
Source: StackOverflow

11/23/2019

from here: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/

apiVersion: v1
kind: Pod
metadata:
  name: with-node-affinity
spec:
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: role
            operator: NotIn
            values:
            - database
-- avloss
Source: StackOverflow