Containerd 私有仓库配置
约 174 字小于 1 分钟
Kubernetes 从 v1.20 开始弃用 Docker,并推荐用户切换到基于容器运行时接口(CRI)的容器引擎,如 containerd、cri-o 等。
docker 配置
sudo vi /etc/docker/daemon.json
{
"insecure-registries":
["harbor.zili.work"]
}
登陆
docker login harbor.zili.work
获取 auth, 这个auth,一会配置containerd会用到
cat ~/.docker/config.json
{
"auths": {
"harbor.zili.work": {
"auth": "YWRtaW46SGFyYm9yMTIzNDU="
}
}
配置containerd
vi /etc/containerd/config.toml
搜索 plugins."io.containerd.grpc.v1.cri".registry.configs
, 开始配置,配置如下
[plugins."io.containerd.grpc.v1.cri".registry.configs]
[plugins."io.containerd.grpc.v1.cri".registry.configs."harbor.zili.work".tls]
insecure_skip_verify = true
[plugins."io.containerd.grpc.v1.cri".registry.configs."harbor.zili.work".auth]
auth = "YWRtaW46SGFyYm9yMTIzNDU="
[plugins."io.containerd.grpc.v1.cri".registry.headers]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."harbor.zili.work"]
endpoint = ["http://harbor.zili.work"]
[plugins."io.containerd.grpc.v1.cri".x509_key_pair_streaming]
tls_cert_file = ""
tls_key_file = ""
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."harbor.zili.work"]
endpoint = ["http://harbor.zili.work"]
重启服务即可
systemctl restart containerd