Rancher2.7.6

环境信息:
RKE2 版本: v1.26.10+rke2r2

问题描述:
1.crictl的拉取得镜像怎么推送到harbor仓库里
2./run/k3s/containerd/ 目录怎么更改
3./etc/rancher/rke2/registries.yaml 每次重启这个配置都会没掉

求大佬指点

  1. 如果你是用rancher-ui来创建下游rke2集群, 那么/etc/rancher/rke2/registries.yaml就会被覆盖
    1.得有上面的配置,然后 crictl info 查看是否使用了以上配置

2.没改过,只会docker的修改

我目前也是用2.7.6离线安装 k3s+rancher 下游rke2

可以使用 nerdctl,参考 K3s 上的用法:https://mp.weixin.qq.com/s/NydEZH0PtIDyHE9iuQsWFQ

这个我试过了,推不到Harbor上面,要配置登录harbor地址吗,我在网上找的在/etc/containerd/config.toml 这个配置里加了仓库地址都没用

新版太难用了 :expressionless:

我自己测试没问题,我不知道你是咋弄的,说不好用,步骤如下:

  1. 在rke2 节点上 安装 nertctl,参考:https://github.com/containerd/nerdctl#install
  2. 配置环境变量:export CONTAINERD_ADDRESS="unix:///run/k3s/containerd/containerd.sock"
  3. 镜像打 tag,上传镜像等:
root@RancherWorker-3:/home/ubuntu# nerdctl -n k8s.io image tag nginx wanghl041/nginx-delete
root@RancherWorker-3:/home/ubuntu# nerdctl login
Enter Username: wanghl041
Enter Password:
WARNING: Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded
root@RancherWorker-3:/home/ubuntu# nerdctl -n k8s.io image push wanghl041/nginx-delete
INFO[0000] pushing as a reduced-platform image (application/vnd.docker.distribution.manifest.list.v2+json, sha256:a713720fede42ff207cb8cc88e344c078b26cd98461b322b7942116111d19c75)
index-sha256:a713720fede42ff207cb8cc88e344c078b26cd98461b322b7942116111d19c75:    done           |++++++++++++++++++++++++++++++++++++++|
manifest-sha256:3c4c1f42a89e343c7b050c5e5d6f670a0e0b82e70e0e7d023f10092a04bbb5a7: done           |++++++++++++++++++++++++++++++++++++++|
config-sha256:a6bd71f48f6839d9faae1f29d3babef831e76bc213107682c5cc80f0cbb30866:   done           |++++++++++++++++++++++++++++++++++++++|
elapsed: 4.2 s                                                                    total:  10.0 K (2.4 KiB/s)
root@RancherWorker-3:/home/ubuntu# rke2 -v
rke2 version v1.27.7+rke2r2 (b0106a62b46c557e73512a02b2e4348e30dac7d7)
go version go1.20.10 X:boringcrypto

另外,如果你想配置 rke2 的 containerd,你可以参考:Advanced Options and Configuration | RKE2


这是什么问题啊 大佬

/etc/rancher/{k3s/rke2}/registries.yaml

这个都配过了 不行
image

你的configs 一个节点可以了,把tls放上去

mirrors:
  "192.168.199.124":
    endpoint:
      - "https://192.168.199.124"
configs:
  "192.168.199.124":
    auth:
      username: admin
      password: Harbor12345
    tls:
      insecure_skip_verify: true

需要重启systemctl restart rke2-server / rke2-agent,然后就会生效