强制将Pod从一个工作节点移动到另一个工作节点 [英] Force moving a Pod from one worker Node to another

查看:208
本文介绍了强制将Pod从一个工作节点移动到另一个工作节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


为了进行一些性能测试,我需要强制将Pod从一个Openshift节点移动到另一个节点.根据我的测试,从文档中看来,在Deployment config中设置nodeSelector是可行的方法,但是它不起作用. 这是我尝试进行的测试:


I'd need to force moving a Pod from one Openshift Node to another, in order to do some performance tests. From the documentation it seems that setting the nodeSelector in the Deployment config is the way to go, but it doesn't work, according to my tests. Here is what I have tried as a test:

创建nginx Pod

oc new-app -f https://raw.githubusercontent.com/sclorg/nginx-ex/master/openshift/templates/nginx.json

该Pod在"ip-10-0-121-229.us-east-2.compute.internal"节点上运行. 现在,我修补节点选择器,设置目标节点:

The Pod is running on "ip-10-0-121-229.us-east-2.compute.internal" Node. Now I patch the node selector, setting a target Node:

oc patch dc nginx-example  -p '{"spec":{"template":{"spec":{"nodeSelector":{"kubernetes.io/hostname": "ip-10-0-169-74.us-east-2.compute.internal"}}}}}'

但是Pod仍在同一节点上运行.即使杀死Pod,它也会重新附着在那. 有什么建议吗? 谢谢

However the Pod is still running on the same Node. Even by killing the Pod it re-attaches there. Any suggestion? Thanjs

推荐答案

您可以在Pod规范中使用nodeName字段自行安排Pod,而不是由Scheduler进行.

You can use nodeName field in your pod spec to schedule the pod yourself, rather than scheduler do it.

oc explain pod.spec.nodeName


FIELD:    nodeName <string>

DESCRIPTION:
     NodeName is a request to schedule this pod onto a specific node. If it is
     non-empty, the scheduler simply schedules this pod onto that node, assuming
     that it fits resource requirements.

您可以用类似的方式对其进行修补.不要忘记删除nodeSelctor字段

you can patch it in similar way. Don't forget to delete nodeSelctor fields

oc patch dc nginx-example -p '{"spec":{"template":{"spec":{"nodeName": "ip-10-0-169-74.us-east-2.compute.internal"}}}}'

这篇关于强制将Pod从一个工作节点移动到另一个工作节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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