K8S镜像加速方案

K8S镜像加速方案

一、 直接配置容器引擎加速(containerd为例)

1.1 containerd 镜像源配置

编辑 containerd 配置文件:

vim /etc/containerd/config.toml

1.2 containerd 镜像源配置

1.2.1 在配置文件中添加以下内容,配置镜像源地址:
[plugins."io.containerd.grpc.v1.cri".registry]
  [plugins."io.containerd.grpc.v1.cri".registry.mirrors]
    [plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
      endpoint = ["https://docker.1ms.run"]
    [plugins."io.containerd.grpc.v1.cri".registry.mirrors."k8s.gcr.io"]
      endpoint = ["https://k8s.1ms.run"]
    [plugins."io.containerd.grpc.v1.cri".registry.mirrors."gcr.io"]
      endpoint = ["https://gcr.1ms.run"]
    [plugins."io.containerd.grpc.v1.cri".registry.mirrors."ghcr.io"]
      endpoint = ["https://ghcr.1ms.run"]
1.2.2 重启 containerd 服务

配置完成后,重启 containerd 服务使配置生效:

systemctl restart containerd

Bash

验证服务状态:

systemctl status containerd

二、docker镜像加速方案

##配置DockerHub 国内镜像源

#编辑/etc/docker/daemon.json,添加如下内容
[root@localhost ~]# vi /etc/docker/daemon.json
{
   "data-root": "/data/docker",
   "registry-mirrors": [
        "https://docker.1ms.run",
        "https://docker.xuanyuan.me"
    ]
}
[root@localhost ~]#

##重启
systemctl daemon-reload
systemctl restart docker 


 
 
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值