kubernetes 抢占:0/1个节点可用:1抢占对调度没有帮助

iaqfqrcu  于 2022-11-02  发布在  Kubernetes
关注(0)|答案(1)|浏览(1148)

在Mac with kind上,我创建了一个单节点集群,然后尝试按照https://kind.sigs.k8s.io/docs/user/ingress/中的说明安装nginx入口

kind create cluster --name devops

kubectl apply --filename https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yaml

kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller --timeout=180s

它超时;而对于节点来说,没有污点

kubectl get node
NAME                   STATUS   ROLES           AGE   VERSION
devops-control-plane   Ready    control-plane   16m   v1.25.2

kubectl describe node devops-control-plane | grep Taint
Taints:             <none>

超时是由于无法将pod放置在主节点上

kubectl -n ingress-nginx describe pod ingress-nginx-controller-7d68cdddd8-tkzzz
...
Node-Selectors:              ingress-ready=true
                             kubernetes.io/os=linux
Tolerations:                 node-role.kubernetes.io/control-plane:NoSchedule
                             node-role.kubernetes.io/master:NoSchedule
                             node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
                             node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
  Type     Reason            Age   From               Message
  ----     ------            ----  ----               -------
  Warning  FailedScheduling  104s  default-scheduler  0/1 nodes are available: 1 node(s) didn't match Pod's node affinity/selector. preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling.

我做错了什么?

9udxz4iz

9udxz4iz1#

请阅读有关assigning Pods to nodes的文档!我发现您的pod上有一些节点选择器。这可能是调度失败的原因。您可以删除节点选择器或向节点添加所需的标签(我猜缺少ingress-ready标签):

kubectl label nodes devops-control-plane ingress-ready=true

相关问题