1

We have a cluster setup with kubespray/ansible. We now want to start adding node affinity and therefor I'd like to label each worker-node with a label describing on which physical host it's running. I don't want to do it manually with kubectl because you can forget to add it easily. When adding new nodes, I'd like to add the node in inventory.ini and add its label (somewhere), then run the playbook to join the cluster with that label. I can't find how to do this unfortunately. Does anyone have a solution for this? Many thanks in advance!

Wies Werk
  • 11
  • 1
  • 1
    This is a requirement not a question. SO is a place to ask questions and provide answers about programming related issues, not a developer marketplace. Please edit your question, adding at the very least what you have already done, to make your question [on-topic](/help/on-topic). Before you start editing you will want to read [how to ask](/help/how-to-ask) and [how to create a minimal, complete, verifiable example](/help/mcve) – Zeitounator Jul 13 '22 at 12:33
  • This is clearly a question, and asked really well. – Edik Mkoyan Aug 31 '23 at 14:56

1 Answers1

1

From documentation:

node_labels - Labels applied to nodes via kubelet --node-labels parameter. For example, labels can be set in the inventory as variables or more widely in group_vars. node_labels can only be defined as a dict:

node_labels:
  label1_name: label1_value
  label2_name: label2_value
kool
  • 3,214
  • 1
  • 10
  • 26