部署k8s所遇问题记录
原因:因为执行禁用swap命令,我只vim进入/etc/fstab把/dev/mapper/centos-swap swap swap defaults 0 0加#号注释了,却没有重启(或者执行mount -a。解决方法:Win+R打开运行框-->输入services.msc后回车-->在服务列表中找到软件名+Service这个服务(显示被禁用了)-->右键选择“属性”-->将启动类型改为“自动”
问题一:电脑打开某软件报错: “当前服务进程已退出关闭,请尝试重新启动SecoClientService服务或重新安装客户端!”
原因:后台服务未运行
解决方法:Win+R打开运行框-->输入services.msc后回车-->在服务列表中找到软件名+Service这个服务(显示被禁用了)-->右键选择“属性”-->将启动类型改为“自动”-->确定
问题二:kubectl初始化失败
报错:pod43195cb4486390800518511f0ab05660.slice: unknown” pod=“kube-system/kube-scheduler-master”
May 23 10:44:00 master kubelet[106272]: E0523 10:44:00.235720 106272 kuberuntime_manager.go:782] “CreatePodSandbox for pod failed” err=“rpc error: code = Unknown desc = failed to start sandbox container for pod "kube-scheduler-master": Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: invalid slice name: /kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod43195cb4486390800518511f0ab05660.slice: unknown” pod=“kube-system/kube-scheduler-master”
May 23 10:44:00 master kubelet[106272]: E0523 10:44:00.235752 106272 pod_workers.go:965] “Error syncing pod, skipping” err=“failed to "CreatePodSandbox" for "kube-scheduler-master_kube-system(43195cb4486390800518511f0ab05660)" with CreatePodSandboxError: "Failed to create sandbox for pod \"kube-scheduler-master_kube-system(43195cb4486390800518511f0ab05660)\": rpc error: code = Unknown desc = failed to start sandbox container for pod \"kube-scheduler-master\": Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: invalid slice name: /kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod43195cb4486390800518511f0ab05660.slice: unknown"” pod=“kube-system/kube-scheduler-master” podUID=43195cb4486390800518511f0ab05660
原因:使用不兼容的 cgroup 造成的
解决方法:
在/etc/docker/daemon.json文件中加入"exec-opts": ["native.cgroupdriver=systemd"]这行
然后执行:
mv /etc/docker/daemon.json /etc/docker/daemon.bak
systemctl stop docker
systemctl start docker
systemctl restart kubelet
问题三:k8s kubelet 服务无法启动报 code=exited, status=1/FAILURE错误
原因:通过 journalctl -f -u kubelet 查看日志发现没有禁用swap分区导致kubectl启动失败
解决方法:
执行:swapoff -a
然后重启kubectl:systemctl restart kubelet
问题四:Couldn’t get current server API group list: Get “http://localhost:8080/api?timeout=32s”: dial tcp 127.0.0.1:8080: connect: connection refused
原因:需要配置kubectl
解决方法,在master执行如下命令修复错误:
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
问题五:某次运行kubectl get pods,报错connection refuse
原因: 通过 journalctl -f -u kubelet 查看日志发现找不到/etc/kubenetes/kube-config文件
解决方法:手动重新生成了一个
问题六:kubectl无法与apiserver服务器通信
原因:这个错误原因比较低级,k8s没有安装api-server插件
解决方法:安装api-server插件
PS:这些问题有的解决方法并不详细,本人明天补充(有些资料在另一个电脑上)
更多推荐
所有评论(0)