Node Affinity feature in Kubernetes

The primary purpose of the Node Affinity feature is to ensure that Pods are hosted on particular nodes. The Node Affinity provides us advanced capabilities to place Pods on specific nodes.

Example:

spec:
  affinity:
    nodeAffinity:
      requiredDuringSchedulingIgnoredDuringExecution:
        nodeSelectorTerms:
        - matchExpressions:
          - key: size
            operator: In # you can use NotIn or Exists (in this case you won't need the values section)
            values:
            - Large
	    - Medium