我使用的是k8v1.7和Python Clientv2.0。我的自定义调度程序检测到一个挂起的pod并成功地调度它。然而,在将pod分配给一个节点之后,它会抱怨pod已经被分配给了一个节点,尽管它只是由调度器自己分配的。这有什么值得关注的吗?或者我该怎么解决这个问题?在
错误信息
create_namespaced_binding: (409)
Reason: Conflict
HTTP response headers: HTTPHeaderDict({'Date': 'Tue, 19 Jun 2018 16:14:57 GMT', 'Content-Length': '289', 'Content-Type': 'application/json'})
HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Operation cannot be fulfilled on pods/binding \"ps0-16-r935x\": pod ps0-16-r935x is already assigned to node \"blipp65\"","reason":"Conflict","details":{"name":"ps0-16-r935x","kind":"pods/binding"},"code":409}
在计划程序.py在
^{pr2}$POD YML文件
apiVersion: v1
kind: Pod
metadata:
name: shoeb-pod
spec:
schedulerName: my-custom-scheduler-v1
containers:
- name: redis
image: redis
于2019-06-03更新
我刚刚添加了更新的main方法(根据@VAS的回答,谢谢),以找到尚未安排的正确的PENDING
pod。请看我的答案。在
创建pod时,调度程序将获得三个“挂起”事件:
'node_name': None, 'status': {'conditions': None,...}
)'node_name': 'some_node_name','status': {'conditions': [...,'status': True, 'type':'PodScheduled'],...}
)'node_name': 'minikube','status': {'conditions': [...,'status': True, 'type':'Initialized'], ... ,'status': False, 'type':'Ready']}
)因此,您的自定义调度程序应该在第一个事件上将pod绑定到节点,检查pod的状态并确保它在第二个事件出现时被调度,然后检查pod是否在第三个事件出现时初始化。在
如果出了问题,调度程序可能需要考虑以前的错误,并可能尝试将pod调度到不同的节点。在
在您的情况下,您的调度程序威胁所有三个事件,如第一个事件,并尝试一次又一次地调度pod。这就是为什么你看到“
pod xxx is already assigned to node yyy
”错误。在下面是更新后的main方法(根据@VAS的回答,谢谢)来找到尚未被调度的正确的
PENDING
pod。在相关问题 更多 >
编程相关推荐