How to reschedule my pods after scaling down a node in Azure Kubernetes Service (AKS)?

强颜欢笑 提交于 2021-01-28 19:25:42

问题


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.

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.

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.


回答1:


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.

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.

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.



来源:https://stackoverflow.com/questions/54201501/how-to-reschedule-my-pods-after-scaling-down-a-node-in-azure-kubernetes-service

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