Assigning Pods to Nodes
This is internal documentation. This document can be used only if it was recommended by the Support Team.
Prerequisites
- The kubectl command-line tool
- Access to a Kubernetes cluster with installed Release
Tested with:
- xl-release 22.2.0-x
- xl-cli 10.3.9
- Azure cluster
Intro
All running pods, deployed with xl-release, have no defined:
- pod tolerations
- node labels in the
nodeSelector - node (anti-)affinity
If you need to apply on pods custom scheduling to the appropriate node you can use following files to change that in your operator package:
-
digitalai-release/kubernetes/dairelease_cr.yamlIn the file search all places where is
tolerations: []ornodeSelector: {}and add appropriate values there. -
digitalai-release/kubernetes/template/deployment.yamlIn the file add to the path
spec.template.specappropriate values withtolerations: []ornodeSelector: {}.
In next sections we will display few cases that could be applied.
Removing Pods from Specific Node
If you need that specific node should not run any xl-release pods, you can apply taint to that node with effect NoExecute, for example:
❯ kubectl taint nodes node_name key1=value1:NoExecute
All pods that do not have that specific toleration will be immediately removed from nodes with that specific taint.
Assigning XLR Pods to the Specific Nodes
If you need to have just XLR pods, and no other pod, on the specific node you need to do following, for example:
- Add to nodes specific taints that will remove all other pods without same tolerations:
❯ kubectl taint nodes node_name app=dai:NoExecute
- Add label to the same nodes so XLR when deployed use just that specific nodes:
❯ kubectl label nodes node_name app_label=dai_label
- In the
digitalai-release/kubernetes/dairelease_cr.yamlupdate all places withtolerations:
tolerations:
- key: "app"
operator: "Equal"
value: "dai"
effect: "NoExecute"
And update all places with nodeSelector:
nodeSelector:
app_label: dai_label
- In the
digitalai-release/kubernetes/template/deployment.yamladd following lines underspec.template.spec:
tolerations:
- key: "app"
operator: "Equal"
value: "dai"
effect: "NoExecute"
nodeSelector:
app_label: dai_label