如何将Pod移动到新的节点池/实例组 [英] How do I move pods to a new node pool/ instance group
问题描述
我有一个附加了一个节点池的Gke集群
I have a Gke cluster with one node pool attached
我想对节点池进行一些更改,例如添加标签等
I want to make some changes to the node pool though- like adding tags, etc
因此,我使用新配置创建了一个新的节点池,并将其附加到集群.所以集群现在有2个节点池.
So I created a new node pool with my new config and attached to the cluster. so now cluster has 2 node pools.
这时我想将吊舱移至新的节点池并销毁旧的节点池
At this point I want to move the pods to the new node pool and destroy the old one
该过程如何完成?我这样做正确吗?
How is this process done? Am I doing this right?
推荐答案
有多种方法可以将吊舱移动到新的节点池.
There are multiple ways to move your pods to the new node pool.
一种方法是,使用Pod规范中的标签选择器将Pod引导到新的节点池,如宣布了节点池的Google博客帖子(需要警告的是,您必须强行终止现有的广告连播,以便对其进行重新安排).这样一来,群集中的所有节点都将保持正常运行,并且您可以使用节点池上的标签轻松地在池之间来回移动Pod(GKE自动将节点池名称添加为标签,以简化操作).
One way is to steer your pods to the new node pool using a label selector in your pod spec, as described in the "More fun with node pools" in the Google blog post that announced node pools (with the caveat that you need to forcibly terminate the existing pods for them to be rescheduled). This leaves all nodes in your cluster functional, and you can easily shift the pods back and forth between pools using the labels on the node pools (GKE automatically adds the node pool name as a label to make this easier).
另一种方法是遵循有关
Another way is to follow the tutorial for Migrating workloads to different machine types, which describes how to cordon / drain nodes to shift workloads to the new node pool.
最后,您可以只使用GKE删除旧的节点池. GKE会在删除节点之前自动清空节点,这将导致您的工作负载转移到新池中,而无需您自己运行任何其他命令.
Finally, you can just use GKE to delete your old node pool. GKE will automatically drain nodes prior to deleting them, which will cause your workload to shift to the new pool without you needing to run any extra commands yourself.
这篇关于如何将Pod移动到新的节点池/实例组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!