[英]Re Scheduling pods from one node to another
So, I am writing a custom auto-rescheduler for my clusters and I am using Python Client library to do so. 所以,我正在为我的集群编写一个自定义自动重新调度程序,我正在使用Python客户端库来执行此操作。 As the rescheduler is still in proposal and nothing has been done for it, the only known way is to delete the pod from overused node and let the replication controller and scheduler take care of the rest (make a new pod and assign it to an appropriate node).
由于重新安排程序仍处于提案状态并且没有为此做任何事情,唯一已知的方法是从过度使用的节点中删除该pod,并让复制控制器和调度程序处理其余部分(创建一个新的pod并将其分配给适当的节点)。 What I want to know is can I use the client library to move the pods from one node to another without deleting the pod.
我想知道的是我可以使用客户端库将pod从一个节点移动到另一个节点而不删除pod。 Basically, I want to create a pod in an appropriate node first and then delete the pod in the over-used node.
基本上,我想首先在适当的节点中创建一个pod,然后删除过度使用的节点中的pod。 Is that possible?
那可能吗?
Using node label you can start the container in matching nodes. 使用节点标签可以在匹配的节点中启动容器。 for this first you need set the node label and update the deployment file and apply it.
首先,您需要设置节点标签并更新部署文件并应用它。
Here is the sample yml file I used for blue green deployment, see this help. 以下是我用于蓝绿色部署的示例yml文件,请参阅此帮助。
apiVersion: extensions/v1beta1 kind: Deployment metadata: name: webserver-blue spec: replicas: 2 template: metadata: labels: type: webserver color: blue spec: containers: - image: nginx:1.12.0 name: webserver-container ports: - containerPort: 80 name: http-server nodeSelector: svrtype: web
apiVersion: extensions/v1beta1 kind: Deployment metadata: name: webserver-green spec: replicas: 2 template: metadata: labels: type: webserver color: green spec: containers: - image: nginx:1.13.0 name: webserver-container ports: - containerPort: 80 name: http-server nodeSelector: svrtype: newweb
After testing you can remove the old one. 测试后,您可以删除旧的。 the issue here is you can direct the traffic to only one deployment at a time.
这里的问题是您可以一次只将流量定向到一个部署。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.