本文介绍了kubeadm init 在控制平面设置失败`等待条件超时`的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在运行 armbian(基于 ubuntu 仿生的内核 4.19)的单板计算机(非树莓派)上设置单节点集群.我根据 官方指南 设置了所有内容,但是当我尝试运行 kubeadm init 它在启动控制平面时失败,timed out waiting for the condition.

I am trying to setup a single-node cluster on my single board computer (non raspberry), running armbian (ubuntu bionic based kernel 4.19). I set up everything according to the official guides, but when I try to run kubeadm init it fails with timed out waiting for the condition when it's starting the control plane.

我阅读了有关此问题的所有问题和疑问,但似乎对我没有任何作用.我也尝试了不同的 kubernetes 版本,但得到了相同的结果.

I read all the issues and questions about this problem, but nothing seems to be working for me. I also tried different kubernetes versions, but got the same results.

这是我的所有日​​志(在最后一次运行中,我尝试了 k8 v1.12,但结果与 v1.13 中的结果相同):

Here are all my logs (on this last run i tried k8 v1.12 but the results were the same as in v1.13):

 > kubeadm init --node-name node_name --pod-network-cidr=192.168.0.0/16
[init] using Kubernetes version: v1.12.5
[preflight] running pre-flight checks
[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 etcd/ca certificate and key.
[certificates] Generated etcd/peer certificate and key.
[certificates] etcd/peer serving cert is signed for DNS names [node_name localhost] and IPs [192.168.0.104 127.0.0.1 ::1]
[certificates] Generated etcd/healthcheck-client certificate and key.
[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 [node_name localhost] and IPs [127.0.0.1 ::1]
[certificates] Generated ca certificate and key.
[certificates] Generated apiserver certificate and key.
[certificates] apiserver serving cert is signed for DNS names [node_name kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 192.168.0.104]
[certificates] Generated apiserver-kubelet-client certificate and key.
[certificates] Generated front-proxy-ca certificate and key.
[certificates] Generated front-proxy-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

Unfortunately, an error has occurred:
        timed out waiting for the condition

This error is likely caused by:
        - The kubelet is not running
        - The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)

If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
        - 'systemctl status kubelet'
        - 'journalctl -xeu kubelet'

Additionally, a control plane component may have crashed or exited when started by the container runtime.
To troubleshoot, list all containers using your preferred container runtimes CLI, e.g. docker.
Here is one example how you may list all Kubernetes containers running in docker:
        - 'docker ps -a | grep kube | grep -v pause'
        Once you have found the failing container, you can inspect its logs with:
        - 'docker logs CONTAINERID'
couldn't initialize a Kubernetes cluster



> systemctl status kubelet
Feb 24 20:32:27 node_name kubelet[14903]: W0224 20:32:27.775295   14903 raw.go:87] Error while processing event ("/sys/fs/cgroup/blkio/libcontainer_19396_systemd_test_default.slice": 0x40000100 == IN_CREATE|I
Feb 24 20:32:27 node_name kubelet[14903]: W0224 20:32:27.775729   14903 raw.go:87] Error while processing event ("/sys/fs/cgroup/memory/libcontainer_19396_systemd_test_default.slice": 0x40000100 == IN_CREATE|
Feb 24 20:32:27 node_name kubelet[14903]: W0224 20:32:27.776032   14903 raw.go:87] Error while processing event ("/sys/fs/cgroup/devices/libcontainer_19396_systemd_test_default.slice": 0x40000100 == IN_CREATE
Feb 24 20:32:27 node_name kubelet[14903]: E0224 20:32:27.878076   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:32:27 node_name kubelet[14903]: E0224 20:32:27.978967   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:32:28 node_name kubelet[14903]: E0224 20:32:28.079610   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:32:28 node_name kubelet[14903]: W0224 20:32:28.135637   14903 raw.go:87] Error while processing event ("/sys/fs/cgroup/devices/libcontainer_19403_systemd_test_default.slice": 0x40000100 == IN_CREATE
Feb 24 20:32:28 node_name kubelet[14903]: E0224 20:32:28.181134   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:32:28 node_name kubelet[14903]: E0224 20:32:28.289467   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:32:28 node_name kubelet[14903]: E0224 20:32:28.397310   14903 kubelet.go:2236] node "node_name" not found




> journalctl -xeu kubelet
Feb 24 20:33:17 node_name kubelet[14903]: E0224 20:33:17.135443   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:17 node_name kubelet[14903]: E0224 20:33:17.238032   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:17 node_name kubelet[14903]: E0224 20:33:17.278975   14903 certificate_manager.go:348] Failed while requesting a signed certificate from the master: cannot create certificate signing request: Pos
Feb 24 20:33:17 node_name kubelet[14903]: E0224 20:33:17.340747   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:17 node_name kubelet[14903]: E0224 20:33:17.536187   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:17 node_name kubelet[14903]: E0224 20:33:17.640348   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:17 node_name kubelet[14903]: E0224 20:33:17.739648   14903 helpers.go:135] readString: Failed to read "/sys/fs/cgroup/cpu,cpuacct/libcontainer_19713_systemd_test_default.slice/cpu.cfs_period_us":
Feb 24 20:33:17 node_name kubelet[14903]: E0224 20:33:17.782521   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:17 node_name kubelet[14903]: E0224 20:33:17.894575   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:17 node_name kubelet[14903]: E0224 20:33:17.996389   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:18 node_name kubelet[14903]: W0224 20:33:18.058222   14903 raw.go:87] Error while processing event ("/sys/fs/cgroup/devices/libcontainer_19719_systemd_test_default.slice": 0x40000100 == IN_CREATE
Feb 24 20:33:18 node_name kubelet[14903]: E0224 20:33:18.110161   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:18 node_name kubelet[14903]: E0224 20:33:18.210797   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:18 node_name kubelet[14903]: E0224 20:33:18.314310   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:18 node_name kubelet[14903]: E0224 20:33:18.418032   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:18 node_name kubelet[14903]: E0224 20:33:18.518919   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:18 node_name kubelet[14903]: E0224 20:33:18.622878   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:18 node_name kubelet[14903]: E0224 20:33:18.730465   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:18 node_name kubelet[14903]: E0224 20:33:18.850900   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:18 node_name kubelet[14903]: E0224 20:33:18.857937   14903 eviction_manager.go:243] eviction manager: failed to get get summary stats: failed to get node info: node "node_name" not found
Feb 24 20:33:18 node_name kubelet[14903]: E0224 20:33:18.958122   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:19 node_name kubelet[14903]: E0224 20:33:19.059025   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:19 node_name kubelet[14903]: E0224 20:33:19.160009   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:19 node_name kubelet[14903]: E0224 20:33:19.262647   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:19 node_name kubelet[14903]: W0224 20:33:19.287875   14903 raw.go:87] Error while processing event ("/sys/fs/cgroup/blkio/libcontainer_19734_systemd_test_default.slice": 0x40000100 == IN_CREATE|I
Feb 24 20:33:19 node_name kubelet[14903]: W0224 20:33:19.288793   14903 raw.go:87] Error while processing event ("/sys/fs/cgroup/memory/libcontainer_19734_systemd_test_default.slice": 0x40000100 == IN_CREATE|
Feb 24 20:33:19 node_name kubelet[14903]: W0224 20:33:19.289280   14903 raw.go:87] Error while processing event ("/sys/fs/cgroup/devices/libcontainer_19734_systemd_test_default.slice": 0x40000100 == IN_CREATE
Feb 24 20:33:19 node_name kubelet[14903]: W0224 20:33:19.335495   14903 cni.go:188] Unable to update cni config: No networks found in /etc/cni/net.d
Feb 24 20:33:19 node_name kubelet[14903]: E0224 20:33:19.336909   14903 kubelet.go:2167] Container runtime network not ready: NetworkReady=false reason:NetworkPluginNotReady message:docker: network plugin is
Feb 24 20:33:19 node_name kubelet[14903]: E0224 20:33:19.390642   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:19 node_name kubelet[14903]: E0224 20:33:19.491380   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:19 node_name kubelet[14903]: E0224 20:33:19.592135   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:19 node_name kubelet[14903]: E0224 20:33:19.693309   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:19 node_name kubelet[14903]: E0224 20:33:19.794236   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:19 node_name kubelet[14903]: E0224 20:33:19.903073   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:20 node_name kubelet[14903]: E0224 20:33:20.004302   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:20 node_name kubelet[14903]: E0224 20:33:20.114988   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:20 node_name kubelet[14903]: E0224 20:33:20.226253   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:20 node_name kubelet[14903]: E0224 20:33:20.328382   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:20 node_name kubelet[14903]: E0224 20:33:20.440179   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:20 node_name kubelet[14903]: E0224 20:33:20.521245   14903 helpers.go:135] readString: Failed to read "/sys/fs/cgroup/memory/libcontainer_19753_systemd_test_default.slice/memory.memsw.limit_in_by
Feb 24 20:33:20 node_name kubelet[14903]: E0224 20:33:20.548871   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:20 node_name kubelet[14903]: E0224 20:33:20.650039   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:20 node_name kubelet[14903]: E0224 20:33:20.790947   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:20 node_name kubelet[14903]: W0224 20:33:20.816400   14903 raw.go:87] Error while processing event ("/sys/fs/cgroup/devices/libcontainer_19761_systemd_test_default.slice": 0x40000100 == IN_CREATE
Feb 24 20:33:20 node_name kubelet[14903]: E0224 20:33:20.891646   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:21 node_name kubelet[14903]: E0224 20:33:21.054233   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:21 node_name kubelet[14903]: E0224 20:33:21.155294   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:21 node_name kubelet[14903]: E0224 20:33:21.259447   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:21 node_name kubelet[14903]: E0224 20:33:21.361964   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:21 node_name kubelet[14903]: E0224 20:33:21.463981   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:21 node_name kubelet[14903]: I0224 20:33:21.498734   14903 kubelet_node_status.go:276] Setting node annotation to enable volume controller attach/detach
Feb 24 20:33:21 node_name kubelet[14903]: I0224 20:33:21.524654   14903 kubelet_node_status.go:70] Attempting to register node node_name
Feb 24 20:33:21 node_name kubelet[14903]: E0224 20:33:21.564999   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:21 node_name kubelet[14903]: E0224 20:33:21.666157   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:21 node_name kubelet[14903]: E0224 20:33:21.767965   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:21 node_name kubelet[14903]: E0224 20:33:21.870418   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:21 node_name kubelet[14903]: E0224 20:33:21.972369   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:22 node_name kubelet[14903]: E0224 20:33:22.073104   14903 kubelet.go:2236] node "node_name" not found
Feb 24 20:33:22 node_name kubelet[14903]: E0224 20:33:22.174562   14903 kubelet.go:2236] node "node_name" not found



> docker logs <id>
Flag --insecure-port has been deprecated, This flag will be removed in a future version.
I0224 20:31:13.598834       1 server.go:681] external host was not specified, using 192.168.0.104
I0224 20:31:13.602481       1 server.go:152] Version: v1.12.5
I0224 20:31:27.566073       1 plugins.go:158] Loaded 8 mutating admission controller(s) successfully in the following order: NamespaceLifecycle,LimitRanger,ServiceAccount,NodeRestriction,Priority,DefaultTolerationSeconds,DefaultStorageClass,MutatingAdmissionWebhook.
I0224 20:31:27.566393       1 plugins.go:161] Loaded 6 validating admission controller(s) successfully in the following order: LimitRanger,ServiceAccount,Priority,PersistentVolumeClaimResize,ValidatingAdmissionWebhook,ResourceQuota.
I0224 20:31:27.584264       1 plugins.go:158] Loaded 8 mutating admission controller(s) successfully in the following order: NamespaceLifecycle,LimitRanger,ServiceAccount,NodeRestriction,Priority,DefaultTolerationSeconds,DefaultStorageClass,MutatingAdmissionWebhook.
I0224 20:31:27.584469       1 plugins.go:161] Loaded 6 validating admission controller(s) successfully in the following order: LimitRanger,ServiceAccount,Priority,PersistentVolumeClaimResize,ValidatingAdmissionWebhook,ResourceQuota.
I0224 20:31:28.579683       1 master.go:240] Using reconciler: lease
W0224 20:32:03.553674       1 genericapiserver.go:325] Skipping API batch/v2alpha1 because it has no resources.
W0224 20:32:10.861340       1 genericapiserver.go:325] Skipping API rbac.authorization.k8s.io/v1alpha1 because it has no resources.
W0224 20:32:10.985660       1 genericapiserver.go:325] Skipping API scheduling.k8s.io/v1alpha1 because it has no resources.
W0224 20:32:11.379405       1 genericapiserver.go:325] Skipping API storage.k8s.io/v1alpha1 because it has no resources.
W0224 20:32:22.680967       1 genericapiserver.go:325] Skipping API admissionregistration.k8s.io/v1alpha1 because it has no resources.
[restful] 2019/02/24 20:32:23 log.go:33: [restful/swagger] listing is available at https://192.168.0.104:6443/swaggerapi
[restful] 2019/02/24 20:32:23 log.go:33: [restful/swagger] https://192.168.0.104:6443/swaggerui/ is mapped to folder /swagger-ui/
[restful] 2019/02/24 20:32:47 log.go:33: [restful/swagger] listing is available at https://192.168.0.104:6443/swaggerapi
[restful] 2019/02/24 20:32:47 log.go:33: [restful/swagger] https://192.168.0.104:6443/swaggerui/ is mapped to folder /swagger-ui/
I0224 20:32:49.058392       1 plugins.go:158] Loaded 8 mutating admission controller(s) successfully in the following order: NamespaceLifecycle,LimitRanger,ServiceAccount,NodeRestriction,Priority,DefaultTolerationSeconds,DefaultStorageClass,MutatingAdmissionWebhook.
I0224 20:32:49.059791       1 plugins.go:161] Loaded 6 validating admission controller(s) successfully in the following order: LimitRanger,ServiceAccount,Priority,PersistentVolumeClaimResize,ValidatingAdmissionWebhook,ResourceQuota.

我只是想学习 kubernetes,所以如果有人知道 kubeadm 以外的不同安装方法,它适用于 armv7,我也将不胜感激.

I just wanna learn kubernetes, so if anyone knows a different installation method other than kubeadm, that works on armv7, I would appreciate that too.

推荐答案

试试下面的命令

kubeadm init --apiserver-advertise-address $(hostname -i) --pod-network-cidr 192.168.0.0/16

注意:您可能需要运行 kubeadm reset 来删除所有从以前的 'kubeadm init' 命令创建的旧内容

Note: You might have to run kubeadm reset to remove all the old stuff that was created from previous 'kubeadm init' commands

这篇关于kubeadm init 在控制平面设置失败`等待条件超时`的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-01 12:27