Placing pods on particular nodes

The Kubernetes scheduler is used to place a pod on particular nodes. You can use node affinity to declare a pod to specific nodes with particular labels and annotations.

About this task

Node affinity is used to specify where to deploy the Cloud Pak for Business Automation pods.

The following example shows the pods for the "cpe" component are put on worker nodes that are located in the "topology.kubernetes.io/zone: antarctica-east1" and "topology.kubernetes.io/zone: antarctica-west1" zones.

ecm_configuration:
  cpe:
    node_affinity:
      custom_node_selector_match_expression:
        - key: topology.kubernetes.io/zone:   **   
          operator: In
          values:
          - antarctica-east1
          - antarctica-west1

Using custom labels and annotations to specify where to deploy a pod is versatile. The following example shows the worker node selection for the "cpe" pods is done by region. The node selection, for example, might help track resource usage by pods in region1 and region2.

ecm_configuration:
  cpe:
    node_affinity:
      custom_node_selector_match_expression:
       - key: topology.kubernetes.io/region:   **   
         operator: In
         values:
         - region1
         - region2

The operator parameter represents the relationship between the label on the node and the set of values in the custom_node_selector_match_expression parameters. The value of the operator parameter can be In or NotIn, Exists or DoesNotExist, Lt or Gt.

The value of the key parameter (label) must be matched to apply the operator value (rule).