kubeadm初始化集群报错:

  报错信息如下:

[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 127.0.0.1:10248: connect: connection refused.connection refused.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服务启动正常

# systemctl status kubelet
● kubelet.service - kubelet: The Kubernetes Node AgentLoaded: loaded (/lib/systemd/system/kubelet.service; enabled; vendor preset: enabled)Drop-In: /etc/systemd/system/kubelet.service.d└─10-kubeadm.confActive: activating (auto-restart) (Result: exit-code) since Tue 2022-03-15 01:31:50 UTC; 9s agoDocs: https://kubernetes.io/docs/home/Process: 108175 ExecStart=/usr/bin/kubelet $KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS (code=exited, status=1/FAILURE)Main PID: 108175 (code=exited, status=1/FAILURE)

    查询系统日志可知:“Failed to run kubelet” err="failed to run Kubelet: misconfiguration: kubelet driver: “cgroupfs” is different from docker cgroup driver: “systemd”

# journalctl -xeu kubeletFlag --network-plugin has been deprecated, will be removed along with dockershim.Flag --fail-swap-on has been deprecated, This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.Flag --network-plugin has been deprecated, will be removed along with dockershim.Flag --fail-swap-on has been deprecated, This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.
server.go:440] "Kubelet version" kubeletVersion="v1.22.7"
server.go:868] "Client rotation is on, will bootstrap in background"
certificate_store.go:130] Loading cert/key pair from "/var/lib/kubelet/pki/kubelet-client-current.pem".
dynamic_cafile_content.go:155] "Starting controller" name="client-ca-bundle::/etc/kubernetes/pki/ca.crt"
server.go:687] "--cgroups-per-qos enabled, but --cgroup-root was not specified.  defaulting to /"
container_manager_linux.go:280] "Container manager verified user specified cgroup-root exists" cgroupRoot=[]
container_manager_linux.go:285] "Creating Container Manager object based on Node Config" nodeConfig={RuntimeCgroupsName: SystemCgroupsName: KubeletCgroupsName: ContainerRuntime:docker CgroupsPerQOS:true CgroupRoot:/ CgroupDriver:systemd KubeletRootDir:/var/lib/kubelet ProtectKernelDefaults:false NodeAllocatableConfig:{KubeReservedCgroupName: SystemReservedCgroupName: ReservedSystemCPUs: EnforceNodeAllocatable:map[pods:{}] KubeReserved:map[] SystemReserved:map[] HardEvictionThresholds:[{Signal:memory.available Operator:LessThan Value:{Quantity:100Mi Percentage:0} GracePeriod:0s MinReclaim:<nil>} {Signal:nodefs.available Operator:LessThan Value:{Quantity:<nil> Percentage:0.1} GracePeriod:0s MinReclaim:<nil>} {Signal:nodefs.inodesFree Operator:LessThan Value:{Quantity:<nil> Percentage:0.05} GracePeriod:0s MinReclaim:<nil>} {Signal:imagefs.available Operator:LessThan Value:{Quantity:<nil> Percentage:0.15} GracePeriod:0s MinReclaim:<nil>}]} QOSReserved:map[] ExperimentalCPUManagerPolicy:none ExperimentalCPUManagerPolicyOptions:map[] ExperimentalTopologyManagerScope:container ExperimentalCPUManagerReconcilePeriod:10s ExperimentalMemoryManagerPolicy:None ExperimentalMemoryManagerReservedMemory:[] ExperimentalPodPidsLimit:-1 EnforceCPULimits:true CPUCFSQuotaPeriod:100ms ExperimentalTopologyManagerPolicy:none}
topology_manager.go:133] "Creating topology manager with policy per scope" topologyPolicyName="none" topologyScopeName="container"
container_manager_linux.go:320] "Creating device plugin manager" devicePluginEnabled=true
state_mem.go:36] "Initialized new in-memory state store"
kubelet.go:314] "Using dockershim is deprecated, please consider using a full-fledged CRI implementation"
client.go:78] "Connecting to docker on the dockerEndpoint" endpoint="unix:///var/run/docker.sock"
client.go:97] "Start docker client with request timeout" timeout="2m0s"
docker_service.go:570] "Hairpin mode is set but kubenet is not enabled, falling back to HairpinVeth" hairpinMode=promiscuous-bridge
docker_service.go:242] "Hairpin mode is set" hairpinMode=hairpin-veth
cni.go:239] "Unable to update cni config" err="no networks found in /etc/cni/net.d"
cni.go:239] "Unable to update cni config" err="no networks found in /etc/cni/net.d"
docker_service.go:257] "Docker cri networking managed by the network plugin" networkPluginName="cni"
cni.go:239] "Unable to update cni config" err="no networks found in /etc/cni/net.d"
docker_service.go:263] "Docker Info" dockerInfo=&{ID:X6CY:RCM7:27L7:GQQ2:NNQZ:T2NN:CCSV:KJC2:TXO5:LRZH:EUZO:X6GA 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:false 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:2022-03-15T01:04:23.235473573Z LoggingDriver:json-file CgroupDriver:cgroupfs CgroupVersion:1 NEventsListener:0 KernelVersion:5.4.0-65-generic OperatingSystem:Ubuntu 20.04.2 LTS OSVersion:20.04 OSType:linux Architecture:x86_64 IndexServerAddress:https://index.docker.io/v1/ RegistryConfig:0xc000b7e380 NCPU:2 MemTotal:16792035328 GenericResources:[] DockerRootDir:/var/lib/docker HTTPProxy: HTTPSProxy: NoProxy: Name:k8s-master Labels:[] ExperimentalBuild:false ServerVersion:20.10.13 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:2a1d4dbdb2a1030dc5b01e96fb110a9d9f150ecc Expected:2a1d4dbdb2a1030dc5b01e96fb110a9d9f150ecc} RuncCommit:{ID:v1.0.3-0-gf46b6ba Expected:v1.0.3-0-gf46b6ba} InitCommit:{ID:de40ad0 Expected:de40ad0} SecurityOptions:[name=apparmor name=seccomp,profile=default] ProductLicense: DefaultAddressPools:[] Warnings:[WARNING: No swap limit support]}
server.go:294] "Failed to run kubelet" err="failed to run Kubelet: misconfiguration: kubelet cgroup driver: \"systemd\" is different from docker cgroup driver: \"cgroupfs\""
Mar 15 01:04:23 k8s-master systemd[1]: kubelet.service: Main process exited, code=exited, status=1/FAILURE

  解决方法:
    方法一:只修改docker配置:把docker cgroup driver: "systemd"改为kubelet driver: “cgroupfs”,请参考方法二
    方法二:修改docker和kubelet配置
      docker配置添加 “exec-opts”: [“native.cgroupdriver=systemd”]

# vim /etc/docker/daemon.json

      kubelet配置/var/lib/kubelet/config.yaml添加cgroupDriver(不同版本在哪修改,望指教)

cat > /var/lib/kubelet/config.yaml <<EOF
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
cgroupDriver: systemd
EOF

      kubelet配置/var/lib/kubelet/kubeadm-flags.env,KUBELET_KUBEADM_ARGS中添加 --cgroup-driver=systemd(初始化之后就没了,不添加能成功不?望指教)

vim /var/lib/kubelet/kubeadm-flags.env
KUBELET_KUBEADM_ARGS="--cgroup-driver=systemd --network-plugin=cni --pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.5"

  重启docker和kubelet

systemctl daemon-reload
systemctl restart docker
systemctl restart kubelet

  检查 docker info|grep “Cgroup Driver” 是否输出 Cgroup Driver: systemd

# docker info|grep "Cgroup Driver"Cgroup Driver: systemd

  kubeadm重置后初始化,我这里能成功

kubeadm初始化集群报错:kubelet driver: “cgroupfs“ is different from docker cgroup driver: “systemd“相关推荐

  1. spark 序列化错误 集群提交时_【问题解决】本地提交任务到Spark集群报错:Initial job has not accepted any resources...

    本地提交任务到Spark集群报错:Initial job has not accepted any resources 错误信息如下: 18/04/17 18:18:14 INFO TaskSched ...

  2. HBase停止集群报错,pid: No such file or directory

    HBase停止集群报错,pid不存在的问题 停止HBase集群时报错如下: [plain]  stopping hbasecat: /tmp/hbase-mango-master.pid: No su ...

  3. redis创建集群报错can‘t connect to node 192.168.163.203

    [README] 创建集群报错 can't connect to node 192.168.163.203 [root@centos201 ~]# /usr/local/redis-cluster/b ...

  4. dfs.datanode.max.xcievers参数导致hbase集群报错

    2013/08/09 转发自http://bkeep.blog.163.com/blog/static/123414290201272644422987/ [案例]dfs.datanode.max.x ...

  5. quartz集群报错but has failed to stop it. This is very likely to create a memory leak.

    quartz集群报错but has failed to stop it. This is very likely to create a memory leak. 在一台配置1核2G内存的阿里云服务器 ...

  6. nginx集群报错“upstream”directive is not allow here 错误 [

    nginx集群报错"upstream"directive is not allow here 错误 搭建了一个服务器, 采用的是nginx + apache(多个) + php + ...

  7. k8s join 集群报错之error execution phase kubelet-start: error uploading crisocket:

    [问题描述1] 主节点上误删了/etc/kubernetes下的文件,当做kubeadm init的时候,找不到对应的key文件 invalid or incomplete external CA: ...

  8. Worker节点加入K8S集群报错:error execution phase preflight: couldn‘t validate the identity of the API Server

    问题描述 在使用kubeadm的join命令,想要将Worker节点加入到K8S集群,命令如下: kubeadm join cluster-endpoint:6443 --token x5g4uy.w ...

  9. 代码操作redis集群报错:(error) MOVED 解决方法

    记录一下今天搭建完本地redis集群以后,使用C++代码测试redis集群搭建是否成功. 在初始化.链接等一系列成功后,我开开心心进行写操作: 这时候报错: Run 382 Redis Set Err ...

最新文章

  1. 微型计算机显示器引线,微型计算机的显示器通常有两组引线,即分别是( )...
  2. 《数据结构与算法Python语言描述》习题第二章第二题(python版)
  3. 宝塔更换域名_阿里云如何建站、域名、搭建网站?
  4. Spring学习笔记—最小化Spring XML配置
  5. php 判断是否文件,利用PHP判断文件是否为图片的方法总结
  6. word中表格占满一页,在后面出现一个空白页 删除方法
  7. Linux 能否拿下苹果 M1 阵地?
  8. 自定义控件使用InnerDefaultProperty提示“内不允许包含文字内容”
  9. HCS12XEP100 ADC与SCI2的冲突解决 (2011-4-15)
  10. matlab天线阵列分析,基于Matlab的阵列天线数值分析
  11. 双管道(CreatePipe)与本地cmd.exe进程通信(附源代码及编译好的程序,免费下载)
  12. mysql 地理空间数据库_地理空间数据库
  13. 专精特新企业数据库-专精特新企业名单及汇总
  14. 计算机桌面文件删除不掉是怎么了,电脑删除不了文件怎么办?教你几种好的处理方法,一学就会...
  15. 【已解决】docker overlay2占用大量磁盘空间处理方法
  16. WPF编程;上位机编程;C#编程;仿QQ基础实现(一)之界面预览
  17. php画奥运五环颜色,php趣味 - php 奥运五环
  18. 前后端分离电商B2C模式之_后端_商品评论功能
  19. Linux系统centos7关闭防火墙命令
  20. 各国立法组织、立法程序、法律法规形式、信息安全涉及主管部门分析-欧盟篇

热门文章

  1. 你还在为博客访问量少而发愁么?
  2. Python的提交表单功能
  3. 最新爬取携程酒店信息上:思路讲解
  4. Swift基础之封装一个WebViewController
  5. vmware使用u盘安装系统
  6. 当代教育实践与教学研究杂志社当代教育实践与教学研究编辑部2022年第24期目录
  7. Cramer-Rao Lower Bound的推导
  8. 动态规划之线性DP题集
  9. 桌面提醒 android,如何让手机桌面上显示便签提醒事项?
  10. JWT 创建Token 提示:secret key byte array cannot be null or empty.