deployment not in nodeSelector kubernetes

6/16/2020

I have a cluster having 2 nodes and one of the nodes is labelled as "SS" for node selector.

I have three services and one service should be deployed in node selector node(which is happening properly) and the other two services should be deployed in another node

How to deploy the remaining services should be deployed in a node(which is not been labelled)?

I don't want to use a node selector also for the other two services.

-- rakeshh92
amazon-web-services
kubernetes
nodeselector

1 Answer

6/16/2020

You can use Node Affinity

spec:
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: <label-key>
            operator: NotIn
            values:
            - SS
-- hoque
Source: StackOverflow