How to set node labels?

0123

You can set node labels in Kubernetes using the kubectl label command. Here’s the syntax:

kubectl label nodes <node-name> <label-key>=<label-value>

Example

To label a node named node1 with a label disktype set to ssd, you would run:

kubectl label nodes node1 disktype=ssd

Verify the Label

To check if the label has been applied successfully, you can describe the node:

kubectl describe nodes node1

Or list all nodes with their labels:

kubectl get nodes --show-labels

This will help you confirm that the label is set correctly. If you have any further questions or need assistance, feel free to ask!

0 Comments

no data
Be the first to share your comment!