【问题标题】:GCloud Error pulling docker images "failed to pull and unpack image"GCloud 错误拉取 docker 图像“无法拉取和解压图像”
【发布时间】:2021-08-01 03:30:47
【问题描述】:

我正在 GCloud 中创建一个新的私有节点,其中有一个 deployment.yml:

... 
containers:
  - name: print-logs
    image: busybox
    command: "sleep infinity"

当我查看对应的 POD 时,总是得到这个错误:“failed to do request: Head https://registry-1.docker.io/...timeout”

完整日志:

# kubectl describe pod <my_pod>

Warning  Failed     9s                kubelet            Failed to pull image "docker.io/library/busybox:latest": rpc error: code = Unknown desc = failed to pull and unpack image "docker.io/library/busybox:latest": failed to resolve reference "docker.io/library/busybox:latest": failed to do request: Head https://registry-1.docker.io/v2/library/busybox/manifests/latest: dial tcp 3.220.36.210:443: i/o timeout
Warning  Failed     9s                kubelet            Error: ErrImagePull

客户设置:

gcloud container clusters create test-cluster \
                --preemptible \
                --enable-ip-alias \
                --enable-private-nodes \
                --machine-type n1-standard-2 \
                --zone europe-west4-a \
                --enable-cloud-logging \
                --enable-cloud-monitoring \
                --create-subnetwork name=main-subnet \
                --master-ipv4-cidr 172.16.0.32/28 \
                --no-enable-master-authorized-networks \
                --image-type COS_CONTAINERD

请帮帮我。

【问题讨论】:

  • 您已经创建了一个私有集群。您需要配置 Cloud NAT 实例以启用公共 Internet 访问:cloud.google.com/nat/docs/overview
  • 我已经尝试通过添加防火墙规则:允许所有(IP 范围:0.0.0.0/0)入口和出口,但它不起作用。有什么想法吗?
  • 为什么您认为防火墙规则会有所帮助?如果没有 Cloud NAT 或 NAT 实例,私有实例就没有通往 Internet 的路由。 URL docker.io 需要 Internet 访问权限。

标签: docker kubernetes google-kubernetes-engine gcloud


【解决方案1】:

首先使用[link]连接到集群

gcloud container clusters get-credentials NAME [--internal-ip] [--region=REGION     | --zone=ZONE, -z ZONE] [GCLOUD_WIDE_FLAG …] 

然后尝试为docker拉取docker镜像。

有关更多信息,您可以参考linkthis(其中解释了构建容器映像)。

如需排查常见的 Container Registry 和 Docker 问题,您可以参考this doc。

【讨论】:

    猜你喜欢
    • 2017-11-28
    • 1970-01-01
    • 1970-01-01
    • 2020-06-18
    • 1970-01-01
    • 2018-08-09
    • 1970-01-01
    • 1970-01-01
    • 2015-04-12
    相关资源
    最近更新 更多