缩小Azure Kubernetes Service(AKS)中的节点后如何重新安排pod的时间? [英] How to reschedule my pods after scaling down a node in Azure Kubernetes Service (AKS)?

查看:75
本文介绍了缩小Azure Kubernetes Service(AKS)中的节点后如何重新安排pod的时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将从一个例子开始.假设我有一个带有三个节点的AKS集群.这些节点中的每一个都运行一组Pod,例如5个Pod.总共有15个Pod在我的集群上运行,每个节点5个Pod,3个节点.

I am going to start with an example. Say I have an AKS cluster with three nodes. Each of these nodes runs a set of pods, let's say 5 pods. That's 15 pods running on my cluster in total, 5 pods per node, 3 nodes.

现在让我们说我的节点根本没有得到充分利用,我决定缩小到2个节点,而不是3个.

Now let's say that my nodes are not fully utilized at all and I decide to scale down to 2 nodes instead of 3.

当我选择在Azure中执行此操作并将节点数从3更改为2时,Azure将关闭第3个节点.但是,它还将删除在第3个节点上运行的所有Pod.如何使集群将Pod从第3个节点重新安排到第1个或第2个节点,以免丢失它们及其内容?

When I choose to do this within Azure and change my node count from 3 to 2, Azure will close down the 3rd node. However, it will also delete all pods that were running on the 3rd node. How do I make my cluster reschedule the pods from the 3rd node to the 1st or 2nd node so that I don't lose them and their contents?

我现在可以放心地按比例缩小节点的唯一方法是手动进行重新安排.

The only way I feel safe to scale down on nodes right now is to do the rescheduling manually.

推荐答案

假设您正在使用Kubernetes部署(或副本集),那么它应该为您执行此操作.部署中配置了一定数量的副本,以便在删除节点时为每个Pod创建一个副本,调度程序将看到当前活动数量小于所需数量,并创建新副本.

Assuming you are using Kubernetes deployments (or replica sets) then it should do this for you. Your deployment is configured with a set number of replicas to create for each pod when you remove a node the scheduler will see that the current active number is less than the desired number and create new ones.

如果仅部署Pod而没有部署,则不会发生这种情况,唯一的解决方案是手动重新部署,这就是为什么要使用部署.

If you are just deploying pods without a deployment, then this won't happen and the only solution is manually redeploying, which is why you want to use a deployment.

请记住,创建的是新容器,您并没有移动先前运行的容器.您先前的Pod上没有保留的任何状态都将消失.这就是它的预期工作方式.

Bear in mind though, what you get created are new pods, you are not moving the previously running pods. Any state you had on the previous pods that is not persisted will be gone. This is how it is intended to work.

这篇关于缩小Azure Kubernetes Service(AKS)中的节点后如何重新安排pod的时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆