machine.nodeLabels
to the Kubernetes Node object.
These labels are written using the nodeβs kubelet identity, which is restricted by the Kubernetes NodeRestriction admission controller.
With NodeRestriction in place, a kubelet is only allowed to modify a small, whitelisted set of labels, such as:
topology.kubernetes.io/region
topology.kubernetes.io/zone
kubernetes.io/hostname
kubernetes.io/arch
kubernetes.io/os
- some
node.kubernetes.io/*
labels
node-role.kubernetes.io/<role>
, are rejected by the API server when requested by the node itself.
This prevents a worker node from assigning itself a privileged role.
Apply nodeLabels
You can add labels to a node by specifying them undermachine.nodeLabels
in the machine configuration. For example:
Role Labels
If you need to assign role labels, for example,node-role.kubernetes.io/worker
or node-role.kubernetes.io/ingress
, you must set them with a cluster-admin account:
node-role.kubernetes.io/*
form if required.