2.9 如何安装nginx 设置registry.cn-hangzhou.aliyuncs.com

rancher 已经成功安装上了但是安装nginx 无法拉去呀如何解决能给指个明路吗?

环境信息:
RKE2 版本: 2.9

节点 CPU 架构,操作系统和版本:

集群配置:

问题描述:

集群已经配置好了。集群使用的镜像也配置好了。为什么创建nginx 就拉取失败呢?

看什么视频,文档资料可以学习一步步创建nginx 部署整个过程呀?

处理日志

重现步骤:

  • 安装 RKE2 的命令:

预期结果:
能够成功拉去安装nginx

实际结果:
超时

日志

配置文件添加:
system-default-registry: “docker.1panel.live”

另外需要配置这个:

没明白啥意思呀

你平时如何从 dockerhub 如何拉镜像?

平时只用单机版docker,集群才开始学。 rancher 不太了解,才开始用,已经安装好了启动起来现在想安装nginx 老是拉取失败不知道如何下手修改什么!对rancher 不够了解。docker 单机版本使用就是修改配置json修改源,多次下载啦取就能成功。

那你把在 docker 中的配置发过来,我告诉你在 rancher 中如何配置

官方文档写的挺清楚的:

每个rke2节点上创建一个文件 /etc/rancher/rke2/registries.yaml
内容为:

mirrors:
  docker.io:
    endpoint:
      - "https://docker.1panel.live"
  k8s.gcr.io:
    endpoint:
      - "https://registry.example.com:5000"

上面设置了2个镜像站点
1 使用镜像站点 https://docker.1panel.live 替代 docker.io
2 使用镜像站点 https://registry.example.com:5000 替代 k8s.gcr.io

自己需要找一些可用的 Mirror 站点,替代掉上面例子中的 Endpoint,docker 还算比较好找,gcr, github 什么的,就自己想办法自建吧

[root@localhost trojan]# docker system info
Client: Docker Engine - Community
 Version:    27.3.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.17.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.29.7
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 3
  Running: 1
  Paused: 0
  Stopped: 2
 Images: 1
 Server Version: 27.3.1
 Storage Driver: overlay2
  Backing Filesystem: xfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 57f17b0a6295a39009d861b89e3b3b87b005ca27
 runc version: v1.1.14-0-g2c9f560
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.14.0-427.42.1.el9_4.x86_64
 Operating System: Rocky Linux 9.4 (Blue Onyx)
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 15.37GiB
 Name: localhost.localdomain
 ID: e8f66707-244c-4b1a-975a-9d170ace14c4
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Registry Mirrors:
  https://docker.m.daocloud.io/
  https://dockerproxy.com/
  https://docker.mirrors.ustc.edu.cn/
  https://docker.nju.edu.cn/
 Live Restore Enabled: false

/etc/rancher/rke2/registries.yaml 默认配置是JSON格式的呀

{"configs":{},"mirrors":null}

修改配置一样失败