How to add a label in Kubernetes Node?
How to add a label in Kubernetes Node?
1. Check the nodes.
[root@kubemaster ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
kubemaster Ready master 94d v1.13.1
kubenode1 Ready <none> 94d v1.13.1
kubenode2 Ready <none> 94d v1.13.1
[root@kubemaster ~]#
NAME STATUS ROLES AGE VERSION
kubemaster Ready master 94d v1.13.1
kubenode1 Ready <none> 94d v1.13.1
kubenode2 Ready <none> 94d v1.13.1
[root@kubemaster ~]#
2. Choose the node and Labele it.
root@master01> kubectl label nodes kubemaster kubenode1 kubenode2 capability=monitoring
node/kubemaster labeled
node/kubenode1 labeled
node/kubenode2 labeled
root@master01>
node/kubemaster labeled
node/kubenode1 labeled
node/kubenode2 labeled
root@master01>
3. Check the labels. You should get an output similar to this.
root@master01> kubectl get nodes --show-labels
NAME STATUS ROLES AGE VERSION LABELS
kubemaster Ready master 94d v1.13.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,capability=monitoring,kubernetes.io/hostname=kubemaster,node-role.kubernetes.io/master=
kubenode1 Ready <none> 94d v1.13.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,capability=monitoring,kubernetes.io/hostname=kubenode1
kubenode2 Ready <none> 94d v1.13.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,capability=monitoring,kubernetes.io/hostname=kubenode2
root@master01>
NAME STATUS ROLES AGE VERSION LABELS
kubemaster Ready master 94d v1.13.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,capability=monitoring,kubernetes.io/hostname=kubemaster,node-role.kubernetes.io/master=
kubenode1 Ready <none> 94d v1.13.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,capability=monitoring,kubernetes.io/hostname=kubenode1
kubenode2 Ready <none> 94d v1.13.1 beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,capability=monitoring,kubernetes.io/hostname=kubenode2
root@master01>
Other Interesting Articles on Kubernetes:
Kubernetes : Kubernetes Node Management, Maintenance, Delete
How to add a New Worker Node to a existing kubernetes Cluster
MinIO Client Installation and Quickstart
PLEG is not healthy: Kubernetes Worker Node is in "NotReady" state
Backup MySQL databases in Kubernetes
How to Run Automated Tasks in Kubernetes with a cronjob
How to Completely remove Kubernetes
No comments