简体   繁体   English

如何在从私有存储库中提取图像时跳过 crictl (containerd CR) 的 TLS 证书检查

[英]How to skip TLS cert check for crictl (containerd CR) while pulling the images from private repository

I have installed k8s 1.24 version and containerd (containerd://1.5.9) is the CR for my setup (ubuntu 20.04).我已经安装了 k8s 1.24 版本,并且 containerd (containerd://1.5.9) 是我的设置 (ubuntu 20.04) 的 CR。

I have also installed docker on my VM and have added my private repository under /etc/docker/daemon.json with the following changes:我还在我的 VM 上安装了 docker 并在 /etc/docker/daemon.json 下添加了我的私有存储库,并进行了以下更改:

{   "insecure-registries" : ["myPvtRepo.com:5028"] }

When I am running docker pull myPvtRepo:123/image after login to my pvt repo by using docker login myPvtRepo:123 command, I am able to pull the images while running the same command with crictl pull myPvtRepo:123/image , I am facing:当我在使用 docker pull myPvtRepo:123/image 使用docker login myPvtRepo:123命令登录到我的 pvt repo 后运行docker pull myPvtRepo:123/image时,我能够在使用crictl pull myPvtRepo:123/image运行相同命令的同时拉取图像,我正面临:

E0819 06:49:01.200489 162610 remote_image.go:218] "PullImage from image service failed" err="rpc error: code = Unknown desc = failed to pull and unpack image "myPvtRepo.com:5028/centos:latest": failed to resolve reference "myPvtRepo.com:5028/centos:latest": failed to do request: Head https://myPvtRepo.com::5028/v2/centos/manifests/latest : x509: certificate signed by unknown authority" image="myPvtRepo.com::5028/centos:latest" FATA[0000] pulling image: rpc error: code = Unknown desc = failed to pull and unpack image "myPvtRepo.com::5028/centos:latest": failed to resolve reference "myPvtRepo.com:5028/centos:latest": failed to do request: Head https://myPvtRepo.com::5028/v2/centos/manifests/latest : x509: certificate signed by unknown authority E0819 06:49:01.200489 162610 remote_image.go:218] “从图像服务中提取图像失败” err="rpc 错误:代码 = 未知描述 = 无法提取和解压缩图像 "myPvtRepo.com:5028/centos:latest": 失败解析引用“myPvtRepo.com:5028/centos:latest”:请求失败:Head https://myPvtRepo.com::5028/v2/centos/manifests/latest :x509:由未知权威机构签署的证书“image= “myPvtRepo.com::5028/centos:latest” FATA[0000] 拉取图像:rpc 错误:代码 = Unknown desc = 拉取和解压图像失败 “myPvtRepo.com::5028/centos:latest”:无法解析参考“myPvtRepo.com:5028/centos:latest”:请求失败:Head https://myPvtRepo.com::5028/v2/centos/manifests/latest :x509:由未知权威机构签署的证书

FYI, I have modified /etc/containerd/config.toml with below content.仅供参考,我已经用以下内容修改了 /etc/containerd/config.toml。

version = 2

[plugin."io.containerd.grpc.v1.cri".registry.configs."myPvtRepo.com:5028".tls]
    insecure_skip_verify = true

[plugins."io.containerd.grpc.v1.cri".registry.mirrors]

[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
     endpoint = ["https://myPvtRepo.com:5028", "https://myPvtRepo.com:5038", "https://myPvtRepo.com:5037",
 "https://myPvtRepo.com:5039"]

[plugins."io.containerd.grpc.v1.cri".registry.mirrors."IP:5000"]
     endpoint = ["http://IP:5000"]

[plugins."io.containerd.grpc.v1.cri".registry.mirrors."IP:5000"]
     endpoint = ["http://IP:5000"]

I have also modified containerd's endpoint to point to containerd's sock.我还修改了 containerd 的端点以指向 containerd 的袜子。

Can you please help me out to understand and fix that even after setting insecure_skip_verify = true for my pvt repository and restarting the containerd service why I am getting this issue.即使在为我的 pvt 存储库设置了insecure_skip_verify = true并重新启动 containerd 服务之后,你能帮我理解并解决这个问题吗?

I got a solution:我有一个解决方案:

cd /usr/local/share/ca-certificates/
curl -L --remote-name http://your-artifacts.com/xyz-bundle.crt
/usr/sbin/update-ca-certificates

This one work for me.这对我有用。

Also make sure to update your endpoints under /etc/crictl.yaml还要确保在 /etc/crictl.yaml 下更新您的端点

runtime-endpoint: unix:///run/containerd/containerd.sock 
image-endpoint: "" 
timeout: 0 
debug: false 
pull-image-on-create: false 
disable-pull-on-run: false

You will need to specify the hosts.toml file for the private registry and add skip-verify = true .您需要为私有注册表指定hosts.toml文件并添加skip-verify = true

ref: https://github.com/containerd/containerd/blob/main/docs/hosts.md参考: https://github.com/containerd/containerd/blob/main/docs/hosts.md

Steps:脚步:

  1. create folders: mkdir -p /etc/containerd/certs.d/<your registry>创建文件夹: mkdir -p /etc/containerd/certs.d/<your registry>
  2. add these config in /etc/containerd/config.toml :/etc/containerd/config.toml中添加这些配置:
     [plugins."io.containerd.grpc.v1.cri".registry] config_path = "/etc/containerd/certs.d"
  3. create and edit hosts.toml under the just created folder在刚刚创建的文件夹下创建和编辑hosts.toml
     server = "https://<your registry>" [host."https://<your registry>"] capabilities = ["pull", "resolve"] skip_verify = true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从私有 Nexus 存储库中提取图像或为图像执行 docker-compose 时“没有基本身份验证凭据” - "no basic auth credentials" while pulling image or doing docker-compose for images from a private Nexus repository 在不使用 imagePullSecrets 的情况下从 kubernetes 中的私有存储库中提取图像 - Pulling images from private repository in kubernetes without using imagePullSecrets 从存储库中提取Docker后,如何更改图像文件? - After pulling a Docker from the repository, how to change the images files? 使用 containerd 从不安全的注册表中提取图像 - Pulling image from insecure registery with containerd 从 Kubernetes 的私有注册表中拉取镜像 - Pulling images from private registry in Kubernetes 如何使用 containerd 创建容器而不是拉它 - How to create a container with containerd instead of pulling it 从 bash 脚本中的私有受保护存储库中提取 Docker 映像 - Pulling Docker image from private protected repository within bash script 如何在从注册表中提取图像时修复Docker的“错误拉动图像...太多重定向”失败? - How to fix Docker's “Error pulling image…too many redirects” failures while pulling images from registry? 从Mac Boot2Docker提取私有Docker存储库时出错 - Error Pulling private docker repository from mac Boot2Docker 从Docker提取图像时发生EOF错误 - EOF error while pulling images from docker
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM