It would be useful for me to be able to define at a higher level a way to determine a set of nodes that a set of pods should run ontop of.
Is there a way to use kustomize so that i can specify what nodeSelectors a deployment should have?
I think you can tain nodes. This kind of nodes are reserved for specific pod.
Node affinity, is a property of pods that attracts them to a set of nodes (either as a preference or a hard requirement). Taints are the opposite – they allow a node to repel a set of pods.
Taints and tolerations work together to ensure that pods are not scheduled onto inappropriate nodes. One or more taints are applied to a node; this marks that the node should not accept any pods that do not tolerate the taints. Tolerations are applied to pods, and allow (but do not require) the pods to schedule onto nodes with matching taints.
Taints and tolerations are a flexible way to steer pods away from nodes or evict pods that shouldn’t be running. Here are examples few of them:
More information you can find here: Kubernetes node for specific pods.
Interesting documentation: taint-toleration-dedicated.
i ended up just defining a patch:
in kustomization.yaml
:
patchesStrategicMerge:
- nodeSelectors.yaml
in nodeSelectors.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mysql
spec:
template:
spec:
nodeSelector:
group: infra
slurm: mysql
bit long winded; but i guess it gives the most flexibility in terms of defining which pods i care ping and where.