Kubernetes/Cluster/Node Roles

From Omnia
Revision as of 22:11, 22 December 2023 by Kenneth (talk | contribs) (Created page with "== Node Roles == kubeadm - How to add roles to nodes in Kubernetes? - Stack Overflow https://stackoverflow.com/questions/48854905/how-to-add-roles-to-nodes-in-kubernetes S...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Node Roles

kubeadm - How to add roles to nodes in Kubernetes? - Stack Overflow
https://stackoverflow.com/questions/48854905/how-to-add-roles-to-nodes-in-kubernetes

Show Labels:

k get nodes --show-labels

Show nodes and roles:

k get nodes

Add Role:

k label node kube4 node-role.kubernetes.io/worker=

Remove Label (or role): [1]

k label node kube4 node-role.kubernetes.io/worker=-
root@kube3:~# k get nodes
NAME    STATUS   ROLES           AGE   VERSION
kube1   Ready    control-plane   18h   v1.29.0
kube2   Ready    control-plane   15h   v1.29.0
kube3   Ready    control-plane   15h   v1.29.0
kube4   Ready    <none>          21s   v1.29.0
kube5   Ready    <none>          14s   v1.29.0
# k get nodes
NAME    STATUS   ROLES           AGE     VERSION
kube1   Ready    control-plane   18h     v1.29.0
kube2   Ready    control-plane   15h     v1.29.0
kube3   Ready    control-plane   15h     v1.29.0
kube4   Ready    worker          8m48s   v1.29.0
kube5   Ready    worker          8m41s   v1.29.0
root@kube3:~# k get nodes --show-labels
NAME    STATUS   ROLES           AGE     VERSION   LABELS
kube1   Ready    control-plane   18h     v1.29.0   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=kube1,kubernetes.io/os=linux,node-role.kubernetes.io/control-plane=,node.kubernetes.io/exclude-from-external-load-balancers=
kube2   Ready    control-plane   15h     v1.29.0   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=kube2,kubernetes.io/os=linux,node-role.kubernetes.io/control-plane=,node.kubernetes.io/exclude-from-external-load-balancers=
kube3   Ready    control-plane   15h     v1.29.0   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=kube3,kubernetes.io/os=linux,node-role.kubernetes.io/control-plane=,node.kubernetes.io/exclude-from-external-load-balancers=
kube4   Ready    worker          7m44s   v1.29.0   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=kube4,kubernetes.io/os=linux,node-role.kubernetes.io/worker=
kube5   Ready    worker          7m37s   v1.29.0   beta.kubernetes.io/arch=amd64,beta.kubernetes.io/os=linux,kubernetes.io/arch=amd64,kubernetes.io/hostname=kube5,kubernetes.io/os=linux,node-role.kubernetes.io/worker=