IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 系统运维 -> kubeasz错误问题(failed to run Kubelet: misconfiguration: kubelet cgroup driver) -> 正文阅读

[系统运维]kubeasz错误问题(failed to run Kubelet: misconfiguration: kubelet cgroup driver)

运行环境

  • Ubuntu 20.04

  • DOCKER 19.03.15

  • KUBEASZ 3.1.0

  • K8S_BIN 1.21.0

1 错误1

1.1 事件还原

由于使用 kubeasz(地址:https://github.com/easzlab/kubeasz
部署二进制的 k8s ,为了便于操作,我提前将 k8s-master1,k8s-master2,k8s-master3,k8s-node1,k8s-node2,k8s-node3 都安装了 docker,这样在执行 ezctl setup k8s-01 03 的时候,发现每台机器都安装了 docker 就不会再执行安装 docker 的操作了,相应的也不会再修改 /etc/docker/daemon.json 文件,直接导致 docker 运行的命名空间和默认的命名空间不一致,所以无法启动 kubelet 服务

执行 [root@k8s-master1 kubeasz]# ./ezctl setup k8s-01 04

报错如下:

TASK [kube-node : 轮询等待kubelet启动] *******************************************************************************************************
changed: [172.18.60.202]
changed: [172.18.60.201]
FAILED - RETRYING: 轮询等待node达到Ready状态 (8 retries left).
FAILED - RETRYING: 轮询等待node达到Ready状态 (8 retries left).
FAILED - RETRYING: 轮询等待node达到Ready状态 (7 retries left).
FAILED - RETRYING: 轮询等待node达到Ready状态 (7 retries left).
FAILED - RETRYING: 轮询等待node达到Ready状态 (6 retries left).
FAILED - RETRYING: 轮询等待node达到Ready状态 (6 retries left).
FAILED - RETRYING: 轮询等待node达到Ready状态 (5 retries left).
FAILED - RETRYING: 轮询等待node达到Ready状态 (5 retries left).
FAILED - RETRYING: 轮询等待node达到Ready状态 (4 retries left).
FAILED - RETRYING: 轮询等待node达到Ready状态 (4 retries left).
FAILED - RETRYING: 轮询等待node达到Ready状态 (3 retries left).
FAILED - RETRYING: 轮询等待node达到Ready状态 (3 retries left).
FAILED - RETRYING: 轮询等待node达到Ready状态 (2 retries left).
FAILED - RETRYING: 轮询等待node达到Ready状态 (2 retries left).
FAILED - RETRYING: 轮询等待node达到Ready状态 (1 retries left).
FAILED - RETRYING: 轮询等待node达到Ready状态 (1 retries left).

TASK [kube-node : 轮询等待node达到Ready状态] ***************************************************************************************************
fatal: [172.18.60.201]: FAILED! => {"attempts": 8, "changed": true, "cmd": "/usr/bin/kubectl get node 172.18.60.201|awk 'NR>1{print $2}'", "delta": "0:00:00.263088", "end": "2021-09-01 12:26:16.691810", "rc": 0, "start": "2021-09-01 12:26:16.428722", "stderr": "Error from server (NotFound): nodes \"172.18.60.201\" not found", "stderr_lines": ["Error from server (NotFound): nodes \"172.18.60.201\" not found"], "stdout": "", "stdout_lines": []}
fatal: [172.18.60.202]: FAILED! => {"attempts": 8, "changed": true, "cmd": "/usr/bin/kubectl get node 172.18.60.202|awk 'NR>1{print $2}'", "delta": "0:00:00.283975", "end": "2021-09-01 12:26:17.056414", "rc": 0, "start": "2021-09-01 12:26:16.772439", "stderr": "Error from server (NotFound): nodes \"172.18.60.202\" not found", "stderr_lines": ["Error from server (NotFound): nodes \"172.18.60.202\" not found"], "stdout": "", "stdout_lines": []}

PLAY RECAP *****************************************************************************************************************************
172.18.60.201              : ok=53   changed=28   unreachable=0    failed=1    skipped=1    rescued=0    ignored=0
172.18.60.202              : ok=50   changed=26   unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

[root@k8s-master1 kubeasz]# 

使用 journalctl -u kubelet 查看日志

为了便于查看,我们可以将日志重定向到一个文件中

journalctl -u kubelet > /tmp/kubelet.log

发现错误

Sep 02 08:52:33 k8s-master1.example.com kubelet[612230]: E0902 08:52:33.526931  612230 server.go:292] "Failed to run kubelet" err="failed to run Kubelet: misconfiguration: kubelet cgroup driver: \"systemd\" is different from docker cgroup driver: \"cgroupfs\""
Sep 02 08:52:33 k8s-master1.example.com systemd[1]: kubelet.service: Main process exited, code=exited, status=1/FAILURE
Sep 02 08:52:33 k8s-master1.example.com systemd[1]: kubelet.service: Failed with result 'exit-code'.

1.2 解决办法

[root@k8s-master1 ~]# cat /etc/docker/daemon.json
{
  "data-root": "/var/lib/docker",
  "exec-opts": ["native.cgroupdriver=systemd"],
  "registry-mirrors": [
    "https://docker.mirrors.ustc.edu.cn",
    "http://hub-mirror.c.163.com"
  ],
  "insecure-registries": ["127.0.0.1/8","172.18.8.214","172.18.8.215"],
  "max-concurrent-downloads": 10,
  "live-restore": true,
  "log-driver": "json-file",
  "log-level": "warn",
  "log-opts": {
    "max-size": "50m",
    "max-file": "1"
    },
  "storage-driver": "overlay2"
}
[root@k8s-master1 ~]#
[root@k8s-master1 ~]# docker info|grep "Cgroup Driver"
WARNING: No swap limit support
 Cgroup Driver: systemd
[root@k8s-master1 ~]#

注意:Ubuntu18 的 /etc/docker/daemon.json 文件如下

root@k8s-master-1:~# docker info|grep "Cgroup Driver"
 Cgroup Driver: cgroupfs
WARNING: No swap limit support
root@k8s-master-1:~# cat /etc/docker/daemon.json
{
  "data-root": "/var/lib/docker",
  "exec-opts": ["native.cgroupdriver=cgroupfs"],
  "insecure-registries": ["127.0.0.1/8","172.18.8.214"],
  "max-concurrent-downloads": 10,
  "live-restore": true,
  "log-driver": "json-file",
  "log-level": "warn",
  "log-opts": {
    "max-size": "50m",
    "max-file": "1"
    },
  "storage-driver": "overlay2"
}

2 错误2

Sep 02 16:31:17 k8s-master2.com kubelet[87623]: W0902 16:31:17.259389   87623 cni.go:204] Error validating CNI config list {"cniVersion":"0.3.1","name":"mynet","plugins":[{"bridge":"mynet0","cniVersion":"0.3.1","hairpinMode":true,"ipMasq":true,"ipam":{"subnet":"10.200.0.0/16","type":"host-local"},"isDefaultGateway":true,"name":"mynet","type":"bridge"}]}: [failed to find plugin "bridge" in path [/opt/cni/bin]]
Sep 02 16:31:17 k8s-master2.com kubelet[87623]: W0902 16:31:17.260166   87623 cni.go:204] Error validating CNI config list {
Sep 02 16:31:17 k8s-master2.com kubelet[87623]:   "name": "cbr0",
Sep 02 16:31:17 k8s-master2.com kubelet[87623]:   "cniVersion": "0.3.1",
Sep 02 16:31:17 k8s-master2.com kubelet[87623]:   "plugins": [
Sep 02 16:31:17 k8s-master2.com kubelet[87623]:     {
Sep 02 16:31:17 k8s-master2.com kubelet[87623]:       "type": "flannel",
Sep 02 16:31:17 k8s-master2.com kubelet[87623]:       "delegate": {
Sep 02 16:31:17 k8s-master2.com kubelet[87623]:         "hairpinMode": true,
Sep 02 16:31:17 k8s-master2.com kubelet[87623]:         "isDefaultGateway": true
Sep 02 16:31:17 k8s-master2.com kubelet[87623]:       }
Sep 02 16:31:17 k8s-master2.com kubelet[87623]:     },
Sep 02 16:31:17 k8s-master2.com kubelet[87623]:     {
Sep 02 16:31:17 k8s-master2.com kubelet[87623]:       "type": "portmap",
Sep 02 16:31:17 k8s-master2.com kubelet[87623]:       "capabilities": {
Sep 02 16:31:17 k8s-master2.com kubelet[87623]:         "portMappings": true
Sep 02 16:31:17 k8s-master2.com kubelet[87623]:       }
Sep 02 16:31:17 k8s-master2.com kubelet[87623]:     }
Sep 02 16:31:17 k8s-master2.com kubelet[87623]:   ]
Sep 02 16:31:17 k8s-master2.com kubelet[87623]: }
Sep 02 16:31:17 k8s-master2.com kubelet[87623]: : [failed to find plugin "flannel" in path [/opt/cni/bin] failed to find plugin "portmap" in path [/opt/cni/bin]]
Sep 02 16:31:17 k8s-master2.com kubelet[87623]: W0902 16:31:17.260197   87623 cni.go:239] Unable to update cni config: no valid networks found in /etc/cni/net.d
Sep 02 16:31:17 k8s-master2.com kubelet[87623]: E0902 16:31:17.328048   87623 kubelet.go:2243] node "k8s-master2.com" not found

2.1 原因及解决办法

此台机器使用过 kubeadm 安装过 k8s,kubeadm 默认采用 flannel 的网络模式,再次使用二进制安装 k8s 需要重新安装操作系统

  系统运维 最新文章
配置小型公司网络WLAN基本业务(AC通过三层
如何在交付运维过程中建立风险底线意识,提
快速传输大文件,怎么通过网络传大文件给对
从游戏服务端角度分析移动同步(状态同步)
MySQL使用MyCat实现分库分表
如何用DWDM射频光纤技术实现200公里外的站点
国内顺畅下载k8s.gcr.io的镜像
自动化测试appium
ctfshow ssrf
Linux操作系统学习之实用指令(Centos7/8均
上一篇文章      下一篇文章      查看所有文章
加:2021-09-03 12:21:05  更:2021-09-03 12:23:02 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/15 13:57:31-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码