当前位置: 首页 > 面试题库 >

错误标记主机:等待条件超时[kubernetes]

吕高雅
2023-03-14
问题内容

我刚开始学习Kubernetes。我已经通过Kubernetes
YUM存储库安装了带有SELinux禁用的kubectl,kubeadm和kubelet的CentOS 7.5。

但是,当我要启动kubeadm init命令时。我收到此错误消息:

[init] using Kubernetes version: v1.12.2
[preflight] running pre-flight checks
    [WARNING Firewalld]: firewalld is active, please ensure ports [6443 10250] are open or your cluster may not function correctly
[preflight/images] Pulling images required for setting up a Kubernetes cluster
[preflight/images] This might take a minute or two, depending on the speed of your internet connection
[preflight/images] You can also perform this action in beforehand using 'kubeadm config images pull'
[kubelet] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[preflight] Activating the kubelet service
[certificates] Generated front-proxy-ca certificate and key.
[certificates] Generated front-proxy-client certificate and key.
[certificates] Generated etcd/ca certificate and key.
[certificates] Generated etcd/peer certificate and key.
[certificates] etcd/peer serving cert is signed for DNS names [vps604805.ovh.net localhost] and IPs [51.75.201.75 127.0.0.1 ::1]
[certificates] Generated apiserver-etcd-client certificate and key.
[certificates] Generated etcd/server certificate and key.
[certificates] etcd/server serving cert is signed for DNS names [vps604805.ovh.net localhost] and IPs [127.0.0.1 ::1]
[certificates] Generated etcd/healthcheck-client certificate and key.
[certificates] Generated ca certificate and key.
[certificates] Generated apiserver certificate and key.
[certificates] apiserver serving cert is signed for DNS names [vps604805.ovh.net kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 51.75.201.75]
[certificates] Generated apiserver-kubelet-client certificate and key.
[certificates] valid certificates and keys now exist in "/etc/kubernetes/pki"
[certificates] Generated sa key and public key.
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/admin.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/kubelet.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/controller-manager.conf"
[kubeconfig] Wrote KubeConfig file to disk: "/etc/kubernetes/scheduler.conf"
[controlplane] wrote Static Pod manifest for component kube-apiserver to "/etc/kubernetes/manifests/kube-apiserver.yaml"
[controlplane] wrote Static Pod manifest for component kube-controller-manager to "/etc/kubernetes/manifests/kube-controller-manager.yaml"
[controlplane] wrote Static Pod manifest for component kube-scheduler to "/etc/kubernetes/manifests/kube-scheduler.yaml"
[etcd] Wrote Static Pod manifest for a local etcd instance to "/etc/kubernetes/manifests/etcd.yaml"
[init] waiting for the kubelet to boot up the control plane as Static Pods from directory "/etc/kubernetes/manifests" 
[init] this might take a minute or longer if the control plane images have to be pulled
[apiclient] All control plane components are healthy after 26.003496 seconds
[uploadconfig] storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
[kubelet] Creating a ConfigMap "kubelet-config-1.12" in namespace kube-system with the configuration for the kubelets in the cluster
[markmaster] Marking the node vps604805.ovh.net as master by adding the label "node-role.kubernetes.io/master=''"
[markmaster] Marking the node vps604805.ovh.net as master by adding the taints [node-role.kubernetes.io/master:NoSchedule]
error marking master: timed out waiting for the condition

根据Linux Foundation课程,我不需要执行更多命令即可将第一个启动集群创建到VM中。

错误?

Firewalld确实有进入防火墙的开放端口。6443 / tcp和10248-10252


问题答案:

我建议按照官方文档中的说明引导Kubernetes集群。我已经进行了一些步骤,以在相同的CentOS版本上构建集群CentOS Linux release 7.5.1804 (Core)并将与您共享它们,希望它对您在安装过程中摆脱该问题有帮助。

首先清除您当前的集群安装:

# kubeadm reset -f && rm -rf /etc/kubernetes/

添加Kubernetes回购进一步kubeadmkubeletkubectl安装:

[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
exclude=kube*
EOF

检查是否SELinux处于许可模式:

# getenforce
Permissive

确保net.bridge.bridge-nf-call-iptables在您的sysctl中将其设置为1:

# cat <<EOF >  /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sysctl --system

安装必需的Kubernetes组件并启动服务:

# yum update && yum upgrade && yum install -y docker kubelet kubeadm kubectl --disableexcludes=kubernetes

# systemctl start docker kubelet && systemctl enable docker kubelet

通过kubeadm以下方式部署集群:

kubeadm init --pod-network-cidr=10.244.0.0/16

尽管我有一些先决条件才能正确安装Pod网络,但我更喜欢将其安装FlannelCNI群集中的主服务器,但我已经将flag
传递给了command。--pod-network-cidr=10.244.0.0/16``kubeadm init

为您的用户创建Kubernetes主目录并存储config文件:

$ mkdir -p $HOME/.kube
$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
$ sudo chown $(id -u):$(id -g) $HOME/.kube/config

安装Pod网络,以我为例Flannel

$ kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/bc79dd1505b0c8681ece4de4c0d86c5cd2643275/Documentation/kube- flannel.yml

最后检查Kubernetes核心Pod状态:

$ kubectl get pods --all-namespaces

NAMESPACE     NAME                                 READY   STATUS    RESTARTS   AGE
kube-system   coredns-576cbf47c7-4x7zq             1/1     Running   0          36m
kube-system   coredns-576cbf47c7-666jm             1/1     Running   0          36m
kube-system   etcd-centos-7-5                      1/1     Running   0          35m
kube-system   kube-apiserver-centos-7-5            1/1     Running   0          35m
kube-system   kube-controller-manager-centos-7-5   1/1     Running   0          35m
kube-system   kube-flannel-ds-amd64-2bmw9          1/1     Running   0          33m
kube-system   kube-proxy-pcgw8                     1/1     Running   0          36m
kube-system   kube-scheduler-centos-7-5            1/1     Running   0          35m

如果您仍有任何疑问,只需在此答案下方写下评论。



 类似资料:
  • 问题内容: 我不时使用量角器1.7中引入的“预期条件”功能。 用例 : 页面对象在哪里。 如果在10秒钟内不可见,将引发错误: 这不是很可读,需要一些时间来理解和一些研究。 题: 是否可以自定义这种等待超时错误? 问题答案: 我相信有3个参数:条件,可选的超时和可选的描述消息。(我很确定这是文档:http : //angular.github.io/protractor/#/api? view=

  • 在Bash脚本中,我想做如下操作: 一、 例如,在后台启动两个应用程序,并给他们60秒时间完成工作。然后,如果他们没有在这段时间内完成,就杀了他们。 不幸的是,上面的方法行不通,因为< code>timeout是一个可执行文件,而< code>wait是一个shell命令。我试着把它改成: 但是这仍然不起作用,因为< code>wait只能在同一个shell中启动的PID上调用。 有什么想法吗?

  • 问题内容: 与传统的等待通知机制相比,使用Condition接口/实现的优点是什么?在这里,我引用道格·李(Doug Lea)的评论: 条件将对象监视方法(wait,notify和notifyAll)分解为不同的对象,从而通过与任意Lock实现结合使用,从而使每个对象具有多个等待集。如果Lock替换了同步方法和语句的使用,而Condition替换了Object监视器方法的使用。 我看到这是实现等待

  • 我第一次做硒测试。在主页上,我调用了一些AJAX,我希望Selenium等待元素加载完成。我不确定它是否有效,但我只是键入selenium,waitForCondition可以选择。 无论我选择什么,它总是返回“false”。我现在连等待条件都不工作吗? 我如何测试它是否有效?在这些代码中我做错了什么? 如果由自己的类实现,则返回“true” isElementPresent(By.xpath(“

  • 问题内容: 在Bash脚本中,我想执行以下操作: 即,在后台启动两个应用程序,并给它们60秒以完成其工作。然后,如果他们没有在该时间间隔内完成,请杀死他们。 不幸的是,上述内容不起作用,因为它是可执行文件,而它是Shell命令。我尝试将其更改为: 但这仍然行不通,因为只能在同一外壳程序内启动的PID上进行调用。 有任何想法吗? 问题答案: 将PID写入文件并像这样启动应用程序: 这将创建另一个hi

  • 问题内容: 我使用Node.js和TypeScript,并且使用。这是我的测试用例: 我想为整个功能设置一个超时时间。即如果要花费2秒,花费0.5秒,花费5秒,我想在3秒钟后让我抛出错误的超时。 正常调用是一个问题,因为范围丢失了: 而且我不能用普通的方式抓住它: 有关如何解决的任何想法? 问题答案: 您可以使用超时: 您必须将其包装在诺言中才能使用。