我将从一个例子开始。假设我有一个带有三个节点的AKS集群。这些节点中的每个节点都运行一组Pod,例如5个Pod。总共有15个Pod在我的群集上运行,每个节点5个Pod,3个节点。
现在让我们说我的节点根本没有得到充分利用,我决定缩小到2个节点,而不是3个。
当我选择在Azure中执行此操作并将节点数从3更改为2时,Azure将关闭第3个节点。但是,它还将删除在第三个节点上运行的所有Pod。如何使集群将Pod从第3个节点重新安排到第1个或第2个节点,以免丢失它们及其内容?
我现在可以放心地按比例缩小节点的唯一方法是手动进行重新安排。
答案 0 :(得分:2)
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.