单节点docker run安装rancher2.7.5后,本地集群报错,请大佬们帮忙看看

Rancher Server 设置

  • Rancher 版本:v2.7.5-rc5
  • 安装选项 (Docker install/Helm Chart): docker install
  • 在线或离线部署:半在线(物理机属于离线,但是yum仓库和docker仓库均是通过代理库走,可以下载所有镜像)
  • docker版本 :Docker version 24.0.2, build cb74dfc

下游集群信息
还未新建集群

用户信息

  • 登录用户的角色是什么?
    管理员

主机操作系统:
CentOS Linux release 7.9.2009 (Core)
问题描述:
单节点docker run安装rancher2.7.5后,本地集群报错:
Failed to create pod sandbox: rpc error: code = DeadlineExceeded desc = failed to get sandbox image “rancher/mirrored-pause:3.6”: failed to pull image “rancher/mirrored-pause:3.6”: failed to pull and unpack image “docker.io/rancher/mirrored-pause:3.6”: failed to resolve reference “docker.io/rancher/mirrored-pause:3.6”: failed to do request: Head “https://registry-1.docker.io/v2/rancher/mirrored-pause/manifests/3.6”: dial tcp 3.216.34.172:443: i/o timeout

重现步骤:
安装好docker后,使用如下命令启动rancher:
docker run --privileged -d --restart=always --name rancher -p 80:80 -p 443:443
-v /myapp/data/rancher/home:/var/lib/rancher -v /myapp/data/rancher/log:/var/log -v /myapp/data/rancher/cni:/var/lib/cni -v /myapp/data/rancher/kubelet:/var/lib/kubelet
-e CATTLE_SYSTEM_DEFAULT_REGISTRY=dockerg.x -e CATTLE_SYSTEM_CATALOG=bundled rancher/rancher:v2.7.5-rc5
结果:
rancher启动成功,能正常登陆,但是local集群事件中报错。
预期结果:
正常启动,不报错
截图:

其他上下文信息:
我在一台离线的机器上安装了docker(已配置好代理库,yum与docker均能通过代理库下载外网内容),使用docker run运行单机rancher2.7.5,但是运行起来后,local集群始终报错,报错如图。我修改了全局配置的docker仓库,还是拉取不了,一直走的默认网址,但是本身docker拉取是没有问题,就rancher拉取有问题。我也尝试低版本的,如2.5.7也是一样的问题,请大家看看如何解决,感谢。

k3s.log 部分日志:
E0626 13:23:08.691510 47 controller.go:156] Unable to perform initial Kubernetes service initialization: Service “kubernetes” is invalid: spec.clusterIPs: Invalid value: string{“10.43.0.1”}: failed to allocate IP 10.43.0.1: cannot allocate resources of type serviceipallocations at this time
E0626 13:23:55.577455 47 remote_runtime.go:176] “RunPodSandbox from runtime service failed” err=“rpc error: code = DeadlineExceeded desc = failed to get sandbox image “rancher/mirrored-pause:3.6”: failed to pull image “rancher/mirrored-pause:3.6”: failed to pull and unpack image “docker.io/rancher/mirrored-pause:3.6”: failed to resolve reference “docker.io/rancher/mirrored-pause:3.6”: failed to do request: Head “https://registry-1.docker.io/v2/rancher/mirrored-pause/manifests/3.6”: dial tcp 34.205.13.154:443: i/o timeout”
E0626 13:23:55.577567 47 kuberuntime_sandbox.go:72] “Failed to create sandbox for pod” err=“rpc error: code = DeadlineExceeded desc = failed to get sandbox image “rancher/mirrored-pause:3.6”: failed to pull image “rancher/mirrored-pause:3.6”: failed to pull and unpack image “docker.io/rancher/mirrored-pause:3.6”: failed to resolve reference “docker.io/rancher/mirrored-pause:3.6”: failed to do request: Head “https://registry-1.docker.io/v2/rancher/mirrored-pause/manifests/3.6”: dial tcp 34.205.13.154:443: i/o timeout” pod=“kube-system/coredns-59b4f5bbd5-f2dkt”
E0626 13:23:55.577612 47 kuberuntime_manager.go:782] “CreatePodSandbox for pod failed” err=“rpc error: code = DeadlineExceeded desc = failed to get sandbox image “rancher/mirrored-pause:3.6”: failed to pull image “rancher/mirrored-pause:3.6”: failed to pull and unpack image “docker.io/rancher/mirrored-pause:3.6”: failed to resolve reference “docker.io/rancher/mirrored-pause:3.6”: failed to do request: Head “https://registry-1.docker.io/v2/rancher/mirrored-pause/manifests/3.6”: dial tcp 34.205.13.154:443: i/o timeout” pod=“kube-system/coredns-59b4f5bbd5-f2dkt”
E0626 13:23:55.577738 47 pod_workers.go:965] “Error syncing pod, skipping” err=“failed to “CreatePodSandbox” for “coredns-59b4f5bbd5-f2dkt_kube-system(5e052014-c5a1-4809-bb10-7647d405a859)” with CreatePodSandboxError: “Failed to create sandbox for pod \“coredns-59b4f5bbd5-f2dkt_kube-system(5e052014-c5a1-4809-bb10-7647d405a859)\”: rpc error: code = DeadlineExceeded desc = failed to get sandbox image \“rancher/mirrored-pause:3.6\”: failed to pull image \“rancher/mirrored-pause:3.6\”: failed to pull and unpack image \“docker.io/rancher/mirrored-pause:3.6\”: failed to resolve reference \“docker.io/rancher/mirrored-pause:3.6\”: failed to do request: Head \“https://registry-1.docker.io/v2/rancher/mirrored-pause/manifests/3.6\”: dial tcp 34.205.13.154:443: i/o timeout”” pod=“kube-system/coredns-59b4f5bbd5-f2dkt” podUID=5e052014-c5a1-4809-bb10-7647d405a859

  1. 通过 docker run 方式启动的 rancher 只适合测试使用,不适用于生产环境,推荐使用高可用安装方式。
  2. 我看到你使用的镜像是 rc 版本(v2.7.5-rc5),rc 版是发布前的小版本,不是正式的发布版本,也适用于测试,不适合生产。推荐使用 stable 版本。
  3. 针对以上你提出的问题是因为 通过 docker run 启动的 rancher,rancher 容器中内置了一个 k3s 集群作为支撑 rancher 运行,这个 k3s 集群是封装在容器之中的,所以你在本地配置 http 代理,针对内置的k3s集群没有任何效果,如果你非得要这样用,你可以参考:高级选项和配置 | K3s K3s 的环境变量加载到 rancher 容器内

感谢解答,我本来是学习用,发现这样对环境的依赖还挺大,我在https://mp.weixin.qq.com/s/AgKpijFXDZ40t06JHGqquw 找到了答案,不过还有一些其他问题,我还是老实的按照推荐的来吧,再次感谢 @ksd