Kubernetes coredns豆荚处于待处理状态.无法启动仪表板 [英] Kubernetes coredns pods stuck in Pending status. Cannot start the dashboard
问题描述
我正在按照教程构建Kubernetes集群. >,并且在访问Kubernetes仪表板时遇到了麻烦.我已经对此提出了另一个问题,您可以在这里此处查看到我的集群中,我认为问题可能出在其他地方,这就是为什么我创建一个新问题.
I am building a Kubernetes cluster following this tutorial, and I have troubles to access the Kubernetes dashboard. I already created another question about it that you can see here, but while digging up into my cluster, I think that the problem might be somewhere else and that's why I create a new question.
我通过运行以下命令来启动我的主服务器:
I start my master, by running the following commands:
> kubeadm reset
> kubeadm init --apiserver-advertise-address=[MASTER_IP] > file.txt
> tail -2 file.txt > join.sh # I keep this file for later
> kubectl apply -f https://git.io/weave-kube/
> kubectl -n kube-system get pod
NAME READY STATUS RESTARTS AGE
coredns-fb8b8dccf-kb2zq 0/1 Pending 0 2m46s
coredns-fb8b8dccf-nnc5n 0/1 Pending 0 2m46s
etcd-kubemaster 1/1 Running 0 93s
kube-apiserver-kubemaster 1/1 Running 0 93s
kube-controller-manager-kubemaster 1/1 Running 0 113s
kube-proxy-lxhvs 1/1 Running 0 2m46s
kube-scheduler-kubemaster 1/1 Running 0 93s
在这里我们可以看到我有两个coredns
吊舱永远处于挂起状态,当我运行命令时:
Here we can see that I have two coredns
pods stuck in Pending state forever, and when I run the command :
> kubectl -n kube-system describe pod coredns-fb8b8dccf-kb2zq
我可以在事件"部分看到以下警告:
I can see in the Events part the following Warning :
Failed Scheduling : 0/1 nodes are available 1 node(s) had taints that the pod didn't tolerate.
由于这是一个警告,而不是错误,并且作为Kubernetes的新手,所以taints
对我来说意义不大,所以我尝试将节点连接到主节点(使用先前保存的命令):
Since it is a Warning and not and Error, and that as a Kubernetes newbie, taints
does not mean much to me, I tried to connect a node to the master (using the previously saved command) :
> cat join.sh
kubeadm join [MASTER_IP]:6443 --token [TOKEN] \
--discovery-token-ca-cert-hash sha256:[ANOTHER_TOKEN]
> ssh [USER]@[WORKER_IP] 'bash' < join.sh
This node has joined the cluster.
在主服务器上,我检查节点是否已连接:
On the master, I check that the node is connected:
> kubectl get nodes
NAME STATUS ROLES AGE VERSION
kubemaster NotReady master 13m v1.14.1
kubeslave1 NotReady <none> 31s v1.14.1
然后我检查我的吊舱:
> kubectl -n kube-system get pod
NAME READY STATUS RESTARTS AGE
coredns-fb8b8dccf-kb2zq 0/1 Pending 0 14m
coredns-fb8b8dccf-nnc5n 0/1 Pending 0 14m
etcd-kubemaster 1/1 Running 0 13m
kube-apiserver-kubemaster 1/1 Running 0 13m
kube-controller-manager-kubemaster 1/1 Running 0 13m
kube-proxy-lxhvs 1/1 Running 0 14m
kube-proxy-xllx4 0/1 ContainerCreating 0 2m16s
kube-scheduler-kubemaster 1/1 Running 0 13m
我们可以看到已经创建了另一个kube-proxy pod,并停留在ContainerCreating状态.
We can see that another kube-proxy pod have been created and is stuck in ContainerCreating status.
当我再次进行描述时:
kubectl -n kube-system describe pod kube-proxy-xllx4
我可以在事件"部分看到多个相同的警告:
I can see in the Events part multiple identical Warnings :
Failed create pod sandbox : rpx error: code = Unknown desc = failed pulling image "k8s.gcr.io/pause:3.1": Get https://k8s.gcr.io/v1/_ping: dial tcp: lookup k8s.gcr.io on [::1]:53 read up [::1]43133->[::1]:53: read: connection refused
这是我的存储库:
docker image ls
REPOSITORY TAG
k8s.gcr.io/kube-proxy v1.14.1
k8s.gcr.io/kube-apiserver v1.14.1
k8s.gcr.io/kube-controller-manager v1.14.1
k8s.gcr.io/kube-scheduler v1.14.1
k8s.gcr.io/coredns 1.3.1
k8s.gcr.io/etcd 3.3.10
k8s.gcr.io/pause 3.1
因此,对于仪表板部分,我尝试使用命令
And so, for the dashboard part, I tried to start it with the command
> kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/master/aio/deploy/recommended/kubernetes-dashboard.yaml
但是仪表板容器处于挂起"状态.
But the dashboard pod is stuck in Pending state.
kubectl -n kube-system get pod
NAME READY STATUS RESTARTS AGE
coredns-fb8b8dccf-kb2zq 0/1 Pending 0 40m
coredns-fb8b8dccf-nnc5n 0/1 Pending 0 40m
etcd-kubemaster 1/1 Running 0 38m
kube-apiserver-kubemaster 1/1 Running 0 38m
kube-controller-manager-kubemaster 1/1 Running 0 39m
kube-proxy-lxhvs 1/1 Running 0 40m
kube-proxy-xllx4 0/1 ContainerCreating 0 27m
kube-scheduler-kubemaster 1/1 Running 0 38m
kubernetes-dashboard-5f7b999d65-qn8qn 1/1 Pending 0 8s
因此,尽管我最初的问题是我无法访问仪表板,但我认为真正的问题比那更深.
So, event though my problem originaly was that I cannot access to my dashboard, I guess that the real problem is deeper thant that.
我知道我只是在这里放了很多信息,但是我是k8s的初学者,对此我完全迷失了.
I know that I just put a lot of information here, but I am a k8s beginner and I am completely lost on this.
推荐答案
在设置您自己的集群时,我遇到了coredns
pod处于挂起模式的问题.我通过添加Pod网络来解决.
There is an issue I experienced with coredns
pods stuck in a pending mode when setting up your own cluster; which I resolve by adding pod network.
由于未安装网络插件,因此节点被污染为not-ready
.安装插件会删除污点,并且Pod可以安排时间.就我而言,添加绒布解决了该问题.
Looks like because there is no Network Addon installed, the nodes are taint as not-ready
. Installing the Addon would remove the taints and the Pods will be able to schedule. In my case adding flannel fixed the issue.
必须先部署网络,然后再部署任何应用程序. 此外,CoreDNS 在安装网络之前不会启动. 仅适用于kubeadm 支持基于容器网络接口(CNI)的网络(并且 不支持kubenet).
The network must be deployed before any applications. Also, CoreDNS will not start up before a network is installed. kubeadm only supports Container Network Interface (CNI) based networks (and does not support kubenet).
这篇关于Kubernetes coredns豆荚处于待处理状态.无法启动仪表板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!