可以看到执行了 kubeadm init 之后,貌似一直卡住 kubelet 这个进程的健康检查上,日志如下。

[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
I1031 14:44:25.770815   10034 local.go:65] [etcd] wrote Static Pod manifest for a local etcd member to "/etc/kubernetes/manifests/etcd.yaml"
I1031 14:44:25.770828   10034 waitcontrolplane.go:89] [wait-control-plane] Waiting for the API server to be healthy
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
[kubelet-check] Initial timeout of 40s passed.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp [::1]:10248: connect: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp [::1]:10248: connect: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp [::1]:10248: connect: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp [::1]:10248: connect: connection refused.
[kubelet-check] It seems like the kubelet isn't running or healthy.
[kubelet-check] The HTTP call equal to 'curl -sSL http://localhost:10248/healthz' failed with error: Get "http://localhost:10248/healthz": dial tcp [::1]:10248: connect: connection refused.

进一步,按照提示,尝试看看 kubelet 启动的时候是不是遇到什么问题。

 Unfortunately, an error has occurred:timed out waiting for the conditionThis 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.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'

详细看看 kubelet 启动的信息。

[root@VM-23-145-centos ~]# systemctl status kubelet
● kubelet.service - kubelet: The Kubernetes Node AgentLoaded: loaded (/usr/lib/systemd/system/kubelet.service; enabled; vendor preset: disabled)Drop-In: /usr/lib/systemd/system/kubelet.service.d└─10-kubeadm.confActive: activating (auto-restart) (Result: exit-code) since Sun 2021-10-31 18:53:46 CST; 6s agoDocs: https://kubernetes.io/docs/Process: 15696 ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS (code=exited, status=1/FAILURE)Main PID: 15696 (code=exited, status=1/FAILURE)Oct 31 18:53:46 VM-23-145-centos systemd[1]: Unit kubelet.service entered failed state.
Oct 31 18:53:46 VM-23-145-centos systemd[1]: kubelet.service failed.

最后发现是下面这个原因,导致启动失败。

Oct 31 18:54:17 VM-23-145-centos kubelet[16036]: I1031 18:54:17.310044   16036 docker_service.go:264] "Docker Info" dockerInfo=&{ID:AU55:ZTZU:4WX2:CKY5:KCPE:OPOQ:EUEZ:AXZY:GP7R:7CZV:6LBL:V6WA Containers:0 ContainersRunning:0 ContainersPaused:0 ContainersStopped:0 Images:7 Driver:overlay2 DriverStatus:[[Backing Filesystem extfs] [Supports d_type true] [Native Overlay Diff true] [userxattr false]] SystemStatus:[] Plugins:{Volume:[local] Network:[bridge host ipvlan macvlan null overlay] Authorization:[] Log:[awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog]} MemoryLimit:true SwapLimit:true KernelMemory:true KernelMemoryTCP:true CPUCfsPeriod:true CPUCfsQuota:true CPUShares:true CPUSet:true PidsLimit:true IPv4Forwarding:true BridgeNfIptables:true BridgeNfIP6tables:true Debug:false NFd:25 OomKillDisable:true NGoroutines:34 SystemTime:2021-10-31T18:54:17.30101368+08:00 LoggingDriver:json-file CgroupDriver:cgroupfs CgroupVersion:1 NEventsListener:0 KernelVersion:3.10.0-1160.31.1.el7.x86_64 OperatingSystem:CentOS Linux 7 (Core) OSVersion:7 OSType:linux Architecture:x86_64 IndexServerAddress:https://index.docker.io/v1/ RegistryConfig:0xc000b7c310 NCPU:8 MemTotal:16655941632 GenericResources:[] DockerRootDir:/var/lib/docker HTTPProxy: HTTPSProxy: NoProxy: Name:VM-23-145-centos Labels:[] ExperimentalBuild:false ServerVersion:20.10.10 ClusterStore: ClusterAdvertise: Runtimes:map[io.containerd.runc.v2:{Path:runc Args:[] Shim:<nil>} io.containerd.runtime.v1.linux:{Path:runc Args:[] Shim:<nil>} runc:{Path:runc Args:[] Shim:<nil>}] DefaultRuntime:runc Swarm:{NodeID: NodeAddr: LocalNodeState:inactive ControlAvailable:false Error: RemoteManagers:[] Nodes:0 Managers:0 Cluster:<nil> Warnings:[]} LiveRestoreEnabled:false Isolation: InitBinary:docker-init ContainerdCommit:{ID:5b46e404f6b9f661a205e28d59c982d3634148f8 Expected:5b46e404f6b9f661a205e28d59c982d3634148f8} RuncCommit:{ID:v1.0.2-0-g52b36a2 Expected:v1.0.2-0-g52b36a2} InitCommit:{ID:de40ad0 Expected:de40ad0} SecurityOptions:[name=seccomp,profile=default] ProductLicense: DefaultAddressPools:[] Warnings:[]}
Oct 31 18:54:17 VM-23-145-centos kubelet[16036]: E1031 18:54:17.310092   16036 server.go:294] "Failed to run kubelet" err="failed to run Kubelet: misconfiguration: kubelet cgroup driver: \"systemd\" is different from docker cgroup driver: \"cgroupfs\""
Oct 31 18:54:17 VM-23-145-centos systemd[1]: kubelet.service: main process exited, code=exited, status=1/FAILURE
Oct 31 18:54:17 VM-23-145-centos systemd[1]: Unit kubelet.service entered failed state.
Oct 31 18:54:17 VM-23-145-centos systemd[1]: kubelet.service failed.

这个解决起来比较容易,修改下面的配置,然后重启 docker。

[root@VM-23-145-centos ~]# cat /etc/docker/daemon.json
{
"exec-opts": ["native.cgroupdriver=systemd"]
}

然后重新 kubeadm init 一下,就可以看到 kubelet 正常启动了。

[root@VM-23-145-centos ~]# systemctl status kubelet
● kubelet.service - kubelet: The Kubernetes Node AgentLoaded: loaded (/usr/lib/systemd/system/kubelet.service; enabled; vendor preset: disabled)Drop-In: /usr/lib/systemd/system/kubelet.service.d└─10-kubeadm.confActive: active (running) since Sun 2021-10-31 18:58:15 CST; 30s agoDocs: https://kubernetes.io/docs/Main PID: 19917 (kubelet)Tasks: 18Memory: 37.0MCGroup: /system.slice/kubelet.service└─19917 /usr/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config...Oct 31 18:58:26 VM-23-145-centos kubelet[19917]: I1031 18:58:26.059691   19917 cni.go:239] "Unable to update cni config" err="no networks fo...i/net.d"
Oct 31 18:58:26 VM-23-145-centos kubelet[19917]: E1031 18:58:26.209071   19917 kubelet.go:2337] "Container runtime network not ready" networ...ialized"
Oct 31 18:58:31 VM-23-145-centos kubelet[19917]: I1031 18:58:31.060399   19917 cni.go:239] "Unable to update cni config" err="no networks fo...i/net.d"
Oct 31 18:58:31 VM-23-145-centos kubelet[19917]: E1031 18:58:31.217841   19917 kubelet.go:2337] "Container runtime network not ready" networ...ialized"
Oct 31 18:58:36 VM-23-145-centos kubelet[19917]: I1031 18:58:36.060914   19917 cni.go:239] "Unable to update cni config" err="no networks fo...i/net.d"
Oct 31 18:58:36 VM-23-145-centos kubelet[19917]: E1031 18:58:36.225707   19917 kubelet.go:2337] "Container runtime network not ready" networ...ialized"
Oct 31 18:58:41 VM-23-145-centos kubelet[19917]: I1031 18:58:41.062031   19917 cni.go:239] "Unable to update cni config" err="no networks fo...i/net.d"
Oct 31 18:58:41 VM-23-145-centos kubelet[19917]: E1031 18:58:41.232789   19917 kubelet.go:2337] "Container runtime network not ready" networ...ialized"
Oct 31 18:58:46 VM-23-145-centos kubelet[19917]: I1031 18:58:46.063112   19917 cni.go:239] "Unable to update cni config" err="no networks fo...i/net.d"
Oct 31 18:58:46 VM-23-145-centos kubelet[19917]: E1031 18:58:46.240827   19917 kubelet.go:2337] "Container runtime network not ready" networ...ialized"
Hint: Some lines were ellipsized, use -l to show in full.

最后,如果你是 root 用户,执行下面的命令,就可以正常工作了。

[root@VM-23-145-centos ~]# export KUBECONFIG=/etc/kubernetes/admin.conf
[root@VM-23-145-centos ~]# kubectl get pods
No resources found in default namespace.
[root@VM-23-145-centos ~]# kubectl get pods -n kube-system
NAME                                       READY   STATUS    RESTARTS   AGE
coredns-78fcd69978-4rs67                   0/1     Pending   0          15m
coredns-78fcd69978-tjq2q                   0/1     Pending   0          15m
etcd-vm-23-145-centos                      1/1     Running   0          15m
kube-apiserver-vm-23-145-centos            1/1     Running   0          15m
kube-controller-manager-vm-23-145-centos   1/1     Running   0          15m
kube-proxy-j9pdn                           1/1     Running   0          15m
kube-scheduler-vm-23-145-centos            1/1     Running   0          15m

【k8s-5】kubeadm init过程的错误相关推荐

  1. 阿里云搭建k8s kubeadm init失败的原因

    使用阿里云搭建k8s时,在主节点执行kubeadm init时候卡在 Waiting for the kubelet to boot up the control plane as static Po ...

  2. kubeadm join时出现错误:[ERROR Port-10250]: Port 10250 is in use [ERROR FileAvailable--etc-kubernetes-pki

    kubeadm join时出现错误:[ERROR Port-10250]: Port 10250 is in use:[ERROR FileAvailable--etc-kubernetes-pki- ...

  3. K8s 集群搭建过程中遇到的问题的解决方法

    1.K8s集群创建的时候,在主节点使用kubeadm init命令,如果第一次失败了,再次执行此命令发现提示端口已占用,文件已存在,怎么办?使用kubeadm reset 命令清空,然后重新init: ...

  4. Kubernetes Kubeadm init 与 join 原理分析

    一.kubeadm概述 kubeadm是社区维护的Kubernetes集群一键部署利器,使用两条命令即可完成k8s集群中master节点以及node节点的部署,其底层原理是利用了k8s TLS boo ...

  5. kubeadm工作原理-kubeadm init原理分析-kubeadm join原理分析

    kubeadm概述 kubeadm是社区维护的Kubernetes集群一键部署利器,使用两条命令即可完成k8s集群中master节点以及node节点的部署,其底层原理是利用了k8s TLS boots ...

  6. k8s集群安装过程中的相关问题和解决

    前言 断点续传模式~ 记录 我用的是ubuntu16.04,首先要做的是配置apt源,这里推荐阿里云的源地址 https://mirrors.aliyun.com/kubernetes/apt/doc ...

  7. 第148天学习打卡(Kubernetes kubeadm init 成功部署 部署网络插件 部署容器化应用)

    继续安装 c3j9i2htclj6thlta6Z ~]# clear [root@iZ2vc3j9i2htclj6thlta6Z ~]# systemctl stop firewalld [root@ ...

  8. 如何创建一个用户、授权操作k8s集群的过程?

    本篇带给大家如何创建一个用户.授权操作k8s集群的过程.希望对你有所帮助! 背景 172.16.99.128是的我k8s集群的master节点,此处是从这里获取集群的证书. 创建访问architech ...

  9. 【云原生之k8s】kubeadm搭建k8s集群

    [云原生之k8s]kubeadm搭建k8s集群 前言 一.集群介绍 (1)集群搭建方法 (2)集群架构 二.集群部署 (1)环境部署 ①所有节点,关闭防火墙规则,关闭selinux,关闭swap交换 ...

最新文章

  1. 从天气项目看Spring Cloud微服务治理
  2. mybatis+postgresql+insert返回主键,action,service侧
  3. python官网下载步骤64位-windows下载并安装Python的具体步骤
  4. linux setsockopt详解
  5. EdgeBERT:极限压缩,比ALBERT再轻13倍!树莓派上跑BERT的日子要来了?
  6. pythonjavascript一起开发_Python开发【第十一篇】:JavaScript
  7. 移动安全-iOS(三)
  8. H3C BGP基本配置
  9. unittest 测试
  10. 手动实现一维离散数据小波分解与重构
  11. 企业如何通过TPM管理降低设备维修费用?
  12. 单片机入门3.驱动蜂鸣器
  13. 分享:大讲台在线学习平台怎么样,靠谱吗?
  14. Daily Scrum Meeting 10.31
  15. 网站服务器 64位,如何将win7系统从32位升级到64位_网站服务器运行维护,win7,32位,64位...
  16. java swing桌面程序打包成.exe文件
  17. 用C实现每天一个小游戏——第一天(飞机大战)
  18. 专题分纲目录 MEM/MBA数学强化
  19. Abaqus子程序Vumat报错Bad material definition
  20. postgresql之数据字典

热门文章

  1. [Ubuntu] LightDM 轻量级桌面显示管理器
  2. 彻底解决 gcr、quay、DockerHub 镜像下载难题
  3. 傅里叶变换性质和常见信号的傅里叶变换
  4. 以太网二层技术——VPLS详解
  5. 机器学习习题(17)
  6. disallow .php,一次解决discuz只收录首页,不收录内页的问题,景安虚拟主机discuz帖子伪静态设置解决办法...
  7. 适用于Android手机的汉信码识别SDK
  8. Mac上启动、关闭、重启MySQL服务
  9. 2022第三届云原生编程挑战赛--Serverless VSCode WebIDE使用体验
  10. 四川职业技术学院linux,2019年四川交通职业技术学院单招中职(信息技术一类)专业技能测试大纲...