[英]Add or edit label on existing node pool in GKE
I created GKE cluster with node pool, but I forgot to label the nodes... In Google Cloud Platform UI I can't edit or add Kubernetes labels for the existing node pool... How can I do it without recreating whole node pool?我创建了带有节点池的 GKE 集群,但我忘记标记节点...在 Google Cloud Platform UI 中,我无法为现有节点池编辑或添加 Kubernetes 标签...如何在不重新创建整个节点池的情况下做到这一点?
It isn't possible to edit the labels without recreating nodes, so GKE does not support updating labels on node pools.不重新创建节点就无法编辑标签,因此 GKE 不支持更新节点池上的标签。
In GKE, the Kubernetes labels are applied to nodes by the kubelet
binary which receives them as flags passed in via the node startup script.在 GKE 中,Kubernetes 标签由
kubelet
二进制文件应用于节点,该二进制文件将它们作为通过节点启动脚本传入的标志接收。 As it is just as disruptive (or more disruptive) to recreate all nodes in a node pool as to create a new node pool, updating the labels isn't a supported operation for updating a node pool.由于重新创建节点池中的所有节点与创建新节点池一样具有破坏性(或更破坏性),因此更新标签不是更新节点池的受支持操作。
You can edit your node configuration, including labels, with kubectl
:您可以使用
kubectl
编辑节点配置,包括标签:
kubectl edit node <your node name>
Use kubectl get node
to get a list of your nodes.使用
kubectl get node
列表。 If you're having trouble connecting to your GKE cluster check out the docs here .如果您在连接到 GKE 集群时遇到问题,请查看此处的文档。
Make a new node pool that is the way you want, and then migrate your workload to it.创建一个您想要的新节点池,然后将您的工作负载迁移到它。 Then destroy the old pool.
然后销毁旧池。
Depending on your workload, there could be a "blip" in your service as pods are moved to the new node.根据您的工作负载,当 pod 被移动到新节点时,您的服务中可能会出现“暂时现象”。
I define two node pools: blue and green.我定义了两个节点池:蓝色和绿色。 At any given time only one pool is up.
在任何给定时间,只有一个池启动。
If I need to make a change:如果我需要做出改变:
And I'm ready for my next change.我已经为我的下一次改变做好了准备。
David大卫
kubectl label node <node_id> <label_key>:<label_value>
这将允许您为任何已经运行的节点添加标签。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.