1.25.0+k3s1生效
离线安装v1.25.0+k3s1
mv k3s /usr/local/bin
chmod +x /usr/local/bin/k3s
mkdir -p /var/lib/rancher/k3s/agent/images/
cp ./k3s-airgap-images-amd64.tar.gz /var/lib/rancher/k3s/agent/images/
chmod +x install.sh
INSTALL_K3S_SKIP_DOWNLOAD=true ./install.sh
配置镜像仓库v1.25.0+k3s1-生效
ps -ef | grep containerd
cat > /etc/rancher/k3s/registries.yaml <<EOF
mirrors:
docker.io:
endpoint:
- "https://fsp2sfpr.mirror.aliyuncs.com/"
- "https://registry.cn-hangzhou.aliyuncs.com/"
EOF
systemctl restart k3s
crictl info | grep -A 5 "registry"
/usr/local/bin/k3s-uninstall.sh
v1.28.7k3s1失败
在线安装 v1.28.7k3s1
curl –sfL \
https://rancher-mirror.oss-cn-beijing.aliyuncs.com/k3s/k3s-install.sh | \
sed 's/rancher.cn/oss-cn-beijing.aliyuncs.com/g' | \
INSTALL_K3S_MIRROR=cn sh -
配置镜像仓库v1.28.7k3s1-失败1
ps -ef | grep containerd
cat > /etc/rancher/k3s/registries.yaml <<EOF
mirrors:
docker.io:
endpoint:
- "https://fsp2sfpr.mirror.aliyuncs.com/"
- "https://registry.cn-hangzhou.aliyuncs.com/"
EOF
systemctl restart k3s
crictl info | grep -A 5 "registry"
配置镜像仓库v1.28.7k3s1-失败2
cp /var/lib/rancher/k3s/agent/etc/containerd/config.toml /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl
vi /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl #追加
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
endpoint = ["https://fsp2sfpr.mirror.aliyuncs.com/","https://registry.cn-hangzhou.aliyuncs.com/"]
systemctl restart k3s
crictl info | grep -A 5 registry
配置镜像仓库v1.28.7k3s1-configs可以 mirros不行
rm -rf /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl
cat > /etc/rancher/k3s/registries.yaml <<EOF
mirrors:
docker.io:
endpoint:
- "https://fsp2sfpr.mirror.aliyuncs.com/"
- "https://registry.cn-hangzhou.aliyuncs.com/"
registry.my.io: # 这里并不是像官方写的那样,docker.io 为 key endpoint 为私有仓库其实是一种镜像加速的意思
endpoint:
- "http://registry.my.io"
configs:
"registry.my.io": # 如果仓库是完全开放没有私有项目的则不需要配置 configs
auth:
username: admin
password: Harbor12345
EOF
systemctl restart k3s
crictl info | grep -A 5 registry
参考文档: