小妖不下班
1
环境信息:
RKE2 版本: rke2 version v1.27.12+rke2r1
节点 CPU 架构,操作系统和版本:centos7 &3.10
集群配置:
3server,2agents
问题描述:
对于官网的rke2进制安装方式https://docs.rancher.cn/docs/rke2/install/airgap/_index,rke2进制安装,3:用所需的参数运行二进制文件。例如,如果使用私有镜像仓库方式,你的配置文件将有以下内容
====
我已经创建了一个/etc/rancher/rke2/registries.yaml
,内容如下:
mirrors:
harbor.zoesoft.com.cn:
endpoint:
- "https://harbor.zoesoft.com.cn"
rewrite:
"^rancher/(.*)": "rke2/rancher/$1"
configs:
"https://harbor.zoesoft.com.cn":
auth:
useradmin: ****
password: *****
tls:
ca_file: /etc/docker/certs.d/harbor.zoesoft.com.cn/ca.crt
cert_file: /etc/docker/certs.d/harbor.zoesoft.com.cn/harbor.zoesoft.com.cn.cert
key_file: /etc/docker/certs.d/harbor.zoesoft.com.cn/harbor.zoesoft.com.cn.key
及 /etc/rancher/rke2/config.yaml
,内容如下:
token: zoesoft-k8s
write-kubeconfig-mode: "0644"
node-name: 192.168.4.107
tls-san:
- zysoft.com
system-default-registry: "harbor.zoesoft.com.cn"
kube-proxy-arg:
- proxy-mode=ipvs
- ipvs-strict-arp=true
这边所需的参数是指什么呢,搜索了文档及论坛并没有2进制的直接启动参数。是需要我用install.sh去做吗?如果我想直接用/usr/local/bin/rke2 直接启动,那我应该启动命令是什么呢?那我需不需要将该2进制直接做成systemd的方式启动呢?
重现步骤:
预期结果:
实际结果:
日志
ksd
2
没明白你要问的内容,而且,论坛支持 markdown 语法,把上面的内容格式改改吧
小妖不下班
4
就是我离线部署的话,不是有2种选项吗,第一种是rke2 二进制方式部署,第二种是 RKE2 Install.sh 脚本安装。
如果我选择第一种方式,那我应该怎么启动呢?直接去/usr/local/bin/下去启动rke2吗?
ksd
8
如果你直接用二进制安装,你就得手写 systemd 的配置才能启动,否则你只能通过 ./k3s
这样通过进程启动,还不如下载 install.sh 的脚本,然后通过 install.sh 去生成 systemd。
小妖不下班
10
那意思就是我直接把rke-adm64的这个二进制放在/usr/local/bin 下面,然后直接用install.sh去启动server跟agent,然后用systemctl enable --now 去启动对应的server跟agent的吗?
rke2-images.linux-amd64.tar.zst rke2.linux-amd64.tar.gz sha256sum-amd64.txt这3个文件就不需要了是吧
ksd
11
小妖不下班
12
我使用的启动命令是这个
INSTALL_RKE2_ARTIFACT_PATH=/zoesoft/rke2/ INSTALL_RKE2_TYPE="agent" sh install.sh
然后我的/zoesoft/rke2/
路径下有如下文件:install.sh rke2.linux-amd64.tar.gz sha256sum-amd64.txt
,但是在启动日志上面,看样子像是拉不到我自己的私仓镜像
Apr 16 11:09:49 slave01 rke2[27677]: time="2024-04-16T11:09:49+08:00" level=info msg="Checking local image archives in /var/lib/rancher/rke2/agent/images for harbor.zoesoft.com.cn:443/rancher/rke2-runtime:v1.27.12-rke2r1"
Apr 16 11:09:49 slave01 rke2[27677]: time="2024-04-16T11:09:49+08:00" level=warning msg="Failed to load runtime image harbor.zoesoft.com.cn:443/rancher/rke2-runtime:v1.27.12-rke2r1 from tarball: no local imageavailable for harbor.zoesoft.com.cn:443/rancher/rke2-runtime:v1.27.12-rke2r1: not found in any file in /var/lib/rancher/rke2/agent/images: image not found"
Apr 16 11:09:49 slave01 rke2[27677]: time="2024-04-16T11:09:49+08:00" level=info msg="Using private registry config file at /etc/rancher/rke2/registries.yaml"
Apr 16 11:09:49 slave01 rke2[27677]: time="2024-04-16T11:09:49+08:00" level=info msg="Pulling runtime image harbor.zoesoft.com.cn:443/rancher/rke2-runtime:v1.27.12-rke2r1"
Apr 16 11:09:49 slave01 rke2[27677]: time="2024-04-16T11:09:49+08:00" level=warning msg="Failed to get image from endpoint: Get \"https://harbor.zoesoft.com.cn:443/v2/\": tls: failed to verify certificate: x509: certificate signed by unknown authority"
Apr 16 11:09:49 slave01 rke2[27677]: time="2024-04-16T11:09:49+08:00" level=fatal msg="failed to get runtime image harbor.zoesoft.com.cn:443/rancher/rke2-runtime:v1.27.12-rke2r1: all endpoints failed: Get \"https://harbor.zoesoft.com.cn:443/v2/\": tls: failed to verify certificate: x509: certificate signed by unknown authority"
Apr 16 11:09:49 slave01 systemd[1]: rke2-agent.service: main process exited, code=exited, status=1/FAILURE
Apr 16 11:09:49 slave01 systemd[1]: Failed to start Rancher Kubernetes Engine v2 (agent).
Apr 16 11:09:49 slave01 systemd[1]: Unit rke2-agent.service entered failed state.
Apr 16 11:09:49 slave01 systemd[1]: rke2-agent.service failed.
/etc/rancher/rke2/registries.yaml
内容还是跟上面的一样,如下:
mirrors:
harbor.zoesoft.com.cn:
endpoint:
- "https://harbor.zoesoft.com.cn"
rewrite:
"^rancher/(.*)": "rke2/rancher/$1"
configs:
"https://harbor.zoesoft.com.cn":
auth:
useradmin: ****
password: *****
tls:
ca_file: /etc/docker/certs.d/harbor.zoesoft.com.cn/ca.crt
cert_file: /etc/docker/certs.d/harbor.zoesoft.com.cn/harbor.zoesoft.com.cn.cert
key_file: /etc/docker/certs.d/harbor.zoesoft.com.cn/harbor.zoesoft.com.cn.key
harbor私仓的镜像是这样的
不知道是不是我的理解有问题,我以为rewrite能把我的镜像重定向到rke2/rancher/$i,但是目前来看好像失败了。