Selecting nodes for pod placement

You can restrict pod placement to specific nodes using the nodeSelector parameter. This is a simple Kubernetes tool that allows you to assign pods only to nodes with certain labels.

Before configuring the nodeSelector parameter, please read the BRIX Enterprise advanced settings article to learn about all the pod placement tools and recommendations for using them together.

How to configure the nodeSelector parameter

For basic pod placement on nodes using the nodeSelector parameter, follow the steps:

  1. Add labels on the nodes.
     
    To place pods in specific Kubernetes cluster nodes, set labels for the desired nodes, e.g. environment = production.
  1. Configure verification of label matching.
     
    In the pod manifest, specify a nodeSelector parameter with the added labels. If a node does not have a matching label, the pod is not scheduled for that node.

Let's look at an example. Suppose there are two environments configured: develop and production. The load of the production environment is distributed on the node-1 node, and the load of the develop environment is distributed on the node-2 node. To do this:

  1. Add environment labels to the nodes:
  • environment = production on node-1.
  • environment = develop on node-2.

To do this, run the commands:

kubectl label nodes node-1 environment=production
kubectl label nodes node-2 environment=development

  1. Specify the labels created for the pods so that they run in the correct nodes. In each environment, open the values-elma365.yaml file and set the value for the nodeSelector parameter:
  • for production environment:

global:
 nodeSelector:
   environment

  • for development environment:

global:
 nodeSelector:
   environment: develop

  1. Once the parameter is configured, apply it as described in the Modify BRIX Enterprise parameters article.

As a result:

  1. All pods with the environment = production configuration will run only on the nodes labeled environment = production.
  2. All pods with the environment = develop configuration will only run on the nodes labeled environment = develop.

Default values for the nodeSelector parameter

By default, no values are set in the .Values.global.nodeSelector field. Therefore, pods are allocated to any available nodes in the cluster without restriction.