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:
- Add labels on the nodes.
To place pods in specific Kubernetes cluster nodes, set labels for the desired nodes, e.g.environment = production
.
- Configure verification of label matching.
In the pod manifest, specify anodeSelector
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:
- Add environment labels to the nodes:
environment = production
onnode-1
.environment = develop
onnode-2
.
To do this, run the commands:
kubectl label nodes node-1 environment=production
kubectl label nodes node-2 environment=development
- 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 thenodeSelector
parameter:
- for production environment:
global:
nodeSelector:
environment
- for development environment:
global:
nodeSelector:
environment: develop
- Once the parameter is configured, apply it as described in the Modify BRIX Enterprise parameters article.
As a result:
- All pods with the
environment = production
configuration will run only on the nodes labeledenvironment = production
. - All pods with the
environment = develop
configuration will only run on the nodes labeledenvironment = 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.