centos8安装kubernets,k8s 1.18.6 后,重启系统后,k8s,kubelet没法启动问题
centos8安装kubernets,k8s 1.18.6 后,重启系统后,k8s没有启动。
查看docker ps 也没有容器实例启动。
journalctl -xe 或是cat /var/log/messages |tail -30
Aug 12 00:07:14 centosk8s kubelet[8011]: I0812 00:07:14.166570 8011 topology_manager.go:126] [topologymanager] Cre
Aug 12 00:07:14 centosk8s kubelet[8011]: I0812 00:07:14.166608 8011 container_manager_linux.go:301] [topologymanag
Aug 12 00:07:14 centosk8s kubelet[8011]: I0812 00:07:14.166633 8011 container_manager_linux.go:306] Creating devic
Aug 12 00:07:14 centosk8s kubelet[8011]: I0812 00:07:14.166870 8011 client.go:75] Connecting to docker on unix:///
Aug 12 00:07:14 centosk8s kubelet[8011]: I0812 00:07:14.166910 8011 client.go:92] Start docker client with request
Aug 12 00:07:14 centosk8s kubelet[8011]: W0812 00:07:14.170784 8011 docker_service.go:561] Hairpin mode set to "pro "hairpin-veth"
Aug 12 00:07:14 centosk8s kubelet[8011]: I0812 00:07:14.170861 8011 docker_service.go:238] Hairpin mode set to "ha
Aug 12 00:07:14 centosk8s kubelet[8011]: W0812 00:07:14.171157 8011 cni.go:237] Unable to update cni config: no ne
Aug 12 00:07:14 centosk8s kubelet[8011]: W0812 00:07:14.179737 8011 cni.go:237] Unable to update cni config: no ne
Aug 12 00:07:14 centosk8s kubelet[8011]: I0812 00:07:14.179879 8011 docker_service.go:253] Docker cri networking m
Aug 12 00:07:14 centosk8s kubelet[8011]: W0812 00:07:14.180105 8011 cni.go:237] Unable to update cni config: no ne
Aug 12 00:07:14 centosk8s kubelet[8011]: I0812 00:07:14.207741 8011 docker_service.go:258] Docker Info: &{ID:DDVQ:iners:10 ContainersRunning:0 ContainersPaused:0 ContainersStopped:10 Images:7 Driver:overlay2 DriverStatus:[[Backing true]] SystemStatus:[] Plugins:{Volume:[local] Network:[bridge host macvlan null overlay] Authorization:[] Log:[awslosplunk syslog]} MemoryLimit:true SwapLimit:true KernelMemory:true KernelMemoryTCP:false CPUCfsPeriod:true CPUCfsQuotaing:true BridgeNfIptables:true BridgeNfIP6tables:true Debug:false NFd:24 OomKillDisable:true NGoroutines:37 SystemTim CgroupDriver:systemd NEventsListener:0 KernelVersion:4.18.0-193.14.2.el8_2.x86_64 OperatingSystem:CentOS Linux 8 (Cos://index.docker.io/v1/ RegistryConfig:0xc000242770 NCPU:2 MemTotal:1364574208 GenericResources:[] DockerRootDir:/varabels:[] ExperimentalBuild:false ServerVersion:18.09.1 ClusterStore: ClusterAdvertise: Runtimes:map[runc:{Path:runc AodeState:inactive ControlAvailable:false Error: RemoteManagers:[] Nodes:0 Managers:0 Cluster:<nil> Warnings:[]} LiveRnerdCommit:{ID:7ad184331fa3e55e52b890ea95e65ba581ae3429 Expected:7ad184331fa3e55e52b890ea95e65ba581ae3429} RuncCommit8a3303feef5b3839f4323d9beb36df0a9dd} InitCommit:{ID:fec3683 Expected:fec3683} SecurityOptions:[name=seccomp,profile=d
Aug 12 00:07:14 centosk8s kubelet[8011]: F0812 00:07:14.208006 8011 server.go:274] failed to run Kubelet: misconfim docker cgroup driver: "systemd"
Aug 12 00:07:14 centosk8s systemd[1]: kubelet.service: Main process exited, code=exited, status=255/n/a
Aug 12 00:07:14 centosk8s systemd[1]: kubelet.service: Failed with result 'exit-code'.
1 问题描述
启动 kubelet 报错,总是报如下错误:
failed to run Kubelet: failed to create kubelet: misconfiguration: kubelet cgroup driver: "systemd" is different from docker cgroup driver: "cgroupfs"
2 解决方案:
修改 /etc/docker/daemon.json 文件,添加如下内容:
"exec-opts": ["native.cgroupdriver=systemd"]
systemctl restart docker
保证 kubelet 跟 docker 的 cgroup driver 一致即可。查看 docker 所使用的 cgroup driver:
docker info
查看 kubelet 启动时的 cgroup-driver 配置,编辑 vim /var/lib/kubelet/kubeadm-flags.env 文件:
最后再重新启动
systemctl restart kubelet
再次查看docker已经有容器在运行了。
目录 返回
首页