简体   繁体   English

重新调度从一个节点到另一个节点的窗格

[英]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文件,请参阅此帮助。

  1. web server running on node labeled web 在标记为web的节点上运行的Web服务器
 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 
  1. set another node label as newweb and update and deployment with different name and node label the config. 将另一个节点标签设置为newweb,并使用不同的名称和节点标记配置进行更新和部署。
 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.

相关问题 Pod 从一个节点迁移到另一个节点 - Pods migration from one node to another Kubeadm和主节点上的Pod调度风险(Pod总是等待) - Kubeadm and the Risks of Scheduling Pods on Master Node (Pods always Pending) 在同一台服务器上运行 Kubernetes 主节点和节点(在 Kubernetes 主节点上调度 pod) - Running Kubernetes master and node on the same server (scheduling pods on Kubernetes master) 等待运河吊舱,然后在新节点上安排吊舱 - Wait for canal pod before scheduling pods on new node 将 pod 从一个包含 2 个节点的节点组移动到另一个包含 3 个节点的节点组 - Move pods from one nodegroup of 2 nodes to another nodegroup of 3 nodes 在 kubernetes 中调度和扩展 Pod - Scheduling and scaling pods in kubernetes kubernetes正在调度Pod来掌握 - kubernetes is scheduling pods to master kubernetes集群Pod无法在另一个节点上ping Pod - kubernetes cluster pods not able to ping pods on another node 如何在一个节点上安装 Pv 并将相同的 PV 用于另一个阳极中的 pod - How can I mount Pv on one node and use that same PV for pods in another anode 无法在一个Virtualbox来宾VM上使用kubernetes master启动nginx pods,在另一台VM上使用kubernetes节点启动 - Unable to start nginx pods with kubernetes master on one Virtualbox guest VM and kubernetes node on another VM
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM