How to add roles to nodes in Kubernetes?

浪子不回头ぞ 提交于 2019-12-03 08:40:38

问题


When I provision a Kubernetes cluster using kubeadm and I get my nodes tagged as none. It's a know bug in Kubernetes and currently a PR is in-progress. However, I would like to know if there is an option to add a Role name manually for the node?

root@ip-172-31-14-133:~# kubectl get nodes
NAME               STATUS    ROLES     AGE       VERSION
ip-172-31-14-133   Ready     master    19m       v1.9.3
ip-172-31-6-147    Ready     <none>    16m       v1.9.3

回答1:


A node role is just a label with the format node-role.kubernetes.io/<role>

You can add this yourself with kubectl label




回答2:


This worked for me:

kubectl label node cb2.4xyz.couchbase.com node-role.kubernetes.io/worker=worker

NAME                                          STATUS    ROLES           AGE       VERSION
cb2.4xyz.couchbase.com                          Ready     custom,worker   35m       v1.11.1
cb3.5xyz.couchbase.com                          Ready     worker          29m       v1.11.1

I could not delete/update the old label, but I can live with it.



来源:https://stackoverflow.com/questions/48854905/how-to-add-roles-to-nodes-in-kubernetes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!