安装kubesphere的 devops 插件报错

发布于:2024-04-04 ⋅ 阅读:(12) ⋅ 点赞:(0)

安装kubesphere的 devops 插件报错
ks-minio 报错:

TASK [common : Kubesphere | Check minio] ***************************************
changed: [localhost]

TASK [common : Kubesphere | Deploy minio] **************************************
fatal: [localhost]: FAILED! => {"changed": true, "cmd": "/usr/local/bin/helm upgrade --install ks-minio /etc/kubesphere/minio-ha -f /etc/kubesphere/custom-values-minio.yaml --set fullnameOverride=minio --namespace kubesphere-system --wait --timeout 1800\n", "delta": "0:00:00.283695", "end": "2024-03-29 02:47:43.891112", "msg": "non-zero return code", "rc": 1, "start": "2024-03-29 02:47:43.607417", "stderr": "Error: UPGRADE FAILED: \"ks-minio\" has no deployed releases", "stderr_lines": ["Error: UPGRADE FAILED: \"ks-minio\" has no deployed releases"], "stdout": "", "stdout_lines": []}
...ignoring

TASK [common : debug] **********************************************************
ok: [localhost] => {
    "msg": [
        "1. check the storage configuration and storage server", 
        "2. make sure the DNS address in /etc/resolv.conf is available.", 
        "3. execute 'helm del --purge ks-minio && kubectl delete job -n kubesphere-system ks-minio-make-bucket-job'", 
        "4. Restart the installer pod in kubesphere-system namespace"
    ]
}

TASK [common : fail] ***********************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "It is suggested to refer to the above methods for troubleshooting problems ."}

PLAY RECAP *********************************************************************
localhost                  : ok=35   changed=20   unreachable=0    failed=1    skipped=73   rescued=0    ignored=4


UPGRADE FAILED: \"ks-minio\" has no deployed releases

以及有些 pod 一直处于 ContainerCreating 和 Error 状态。
在这里插入图片描述

解决方法:

先一步步排查问题:

查看 pod 状态:

kubectl get pods --all-namespaces

在这里插入图片描述
然后使用 kubectl describe 命令查看 异常的 pod 日志:

# 示例:
 kubectl describe pod ks-devops-db-init-job-j94hh -n kubesphere-devops-system

在这里插入图片描述
在这里插入图片描述
发现有些镜像一直在 pull, pull 很久都没进展。

这个极有可能是网络问题,所以就先排查网络问题。

因为它从 hub.docker.com 下载镜像,我在浏览器打开这个网址发现访问不了,然后挂了VPN就可以访问,所以很明显被墙了。以前不用VPN都能正常访问,现在不知道为什么要用VPN才能访问了。

回到系统里,使用ping命令测试:

ping hub.docker.com

没有结果返回。但是它把 IP 显示出来了,我再 ping 了一下这个IP,发现可以 ping 通。
在这里插入图片描述

所以我就直接把 域名和 IP 在 /etc/hosts 文件中做一个 IP 和 域名的映射:
在这里插入图片描述
再次执行 ping hub.docker.com 就可以正常 ping 通了。

之后,我遇到了另一个问题是因为我用第一个手机开的热点,很多镜像都下不下来,

在这里插入图片描述

图中有一个 layer 一直处于 waiting 拉不下来。

之后我换了一个手机开热点,就没问题了。

当你使用 kubectl apply 的方式部署 pod,要经常使用 kubectl describe 命令查看日志,当看到 日志 一直卡在 pulling image 的那行时,你可以手动到对应的 node 节点上直接使用 docker pull 的方式把镜像拉取下来。

在这里插入图片描述

如果手动都拉取不下来,那就要进一步排查网络问题了。


你可能在操作的过程中需要删除某些 pod, 可以参考这篇文章《最小化安装Kubesphere报错问题解决方法》.

删除某个 namespace 下的所有 pod.

kubectl delete deploy <namespace> --all