1. 程式人生 > 實用技巧 >kubernetes報錯集錦

kubernetes報錯集錦

1. 啟動kubelet失敗

systemctl start kubelet

檢視報錯資訊:

journalctl -xefu kubelet

  kubelet不斷重啟

 kubelet.service: main process exited, code=exited, status=255/n/a

  

# kubeadm init
[init] Using Kubernetes version: v1.20.1
[preflight] Running pre-flight checks
	[WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driver is "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
	[WARNING SystemVerification]: this Docker version is not on the list of validated versions: 20.10.2. Latest validated version: 19.0
3
error execution phase preflight: [preflight] Some fatal errors occurred: [ERROR Swap]: running with swap on is not supported. Please disable swap [ERROR Port-2379]: Port 2379 is in use [ERROR Port-2380]: Port 2380 is in use [ERROR DirAvailable--var-lib-etcd]: /var/lib/etcd is not empty [preflight] If you know what you are doing, you can make a check non-fatal with `--ignore-preflight-errors=...` To see the stack trace of this error execute with --v=5 or higher

  docker版本太高。

# rpm -qa|grep docker
# rpm -e docker-ce-cli-20.10.2-3.el7.x86_64 --nodeps
# rpm -e docker-ce-rootless-extras-20.10.2-3.el7.x86_64 --nodeps
# rpm -qa|grep docker
# yum -y install yum-utils
# yum-config-manager     --add-repo    https://download.docker.com/linux/centos/docker-ce.repo
# yum list docker-ce.x86_64 --showduplicates | sort -r
# yum -y install docker-ce-19.03.9-3.el7

  關閉Swap

# 關閉Swap,機器重啟後不生效
# swapoff -a
# cp -p /etc/fstab /etc/fstab.bak$(date '+%Y%m%d%H%M%S')
# sed -i "s/\/dev\/mapper\/centos-swap/\#\/dev\/mapper\/centos-swap/g" /etc/fstab
# systemctl daemon-reload
# systemctl restart kubelet

  kubeadm init 之前拉取aliyun映象

# kubeadm config images list
# kubeadm config images pull --image-repository=registry.aliyuncs.com/google_containerd --kubernetes-version=v1.20.1

  

2.