If you’re also using HCL to write your Kubernetes manifests and you’re getting stuck with node affinity rules heres the rule I have to making sure that a node preferentially gets scheduled on a particular node. In this case the node name is “green-pi”, that’s my Pi with a mounted Zigbee dongle.
Here you go:
affinity = {
nodeAffinity = {
preferredDuringSchedulingIgnoredDuringExecution = [
{
weight = 1
preference = {
"matchExpressions" = [
{
key = "kubernetes.io/hostname"
operator = "In"
values = ["green-pi"]
},
]
}
},
]
}