国内拉取 gcr.io 镜像(Google Kubernetes 镜像)

文章讲述了在Kubernetes中遇到的gcr.io镜像拉取问题,由于中国大陆地区访问限制,通过将image地址更改为gcr.lank8s.cn解决。展示了修改Deployment配置和应用新镜像的过程。
摘要由CSDN通过智能技术生成
yang@k8s-master:~$ kubectl get pod
NAME                           READY   STATUS             RESTARTS   AGE
hello-world1-789db8d56-8xk5b   0/1     ImagePullBackOff   0          38s


Events:
  Type     Reason     Age   From               Message
  ----     ------     ----  ----               -------
  Normal   Scheduled  24s   default-scheduler  Successfully assigned default/hello-world1-789db8d56-8xk5b to k8s-node1
  Normal   Pulling    22s   kubelet            Pulling image "gcr.io/google-samples/hello-app:1.0"
  Warning  Failed     1s    kubelet            Failed to pull image "gcr.io/google-samples/hello-app:1.0": failed to pull and unpack image "gcr.io/google-samples/hello-app:1.0": failed to resolve reference "gcr.io/google-samples/hello-app:1.0": failed to do request: Head "https://gcr.io/v2/google-samples/hello-app/manifests/1.0": dial tcp 64.233.187.82:443: connect: connection refused
  Warning  Failed     1s    kubelet            Error: ErrImagePull
  Normal   BackOff    1s    kubelet            Back-off pulling image "gcr.io/google-samples/hello-app:1.0"
  Warning  Failed     1s    kubelet            Error: ImagePullBackOff

gcr.io/google-samples 镜像不能正常拉取

发现gcr.io禁止中国大陆地区访问

修改image地址 使用代理


apiVersion: apps/v1
kind: Deployment
metadata:
  name: hello-world1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: hello-world
  template:
    metadata:
      labels:
        app: hello-world
    spec:
      containers:
      - name: hello-world
#        image: gcr.io/google-samples/hello-app:1.0
        image: gcr.lank8s.cn/google-samples/hello-app:1.0
        ports:
        - containerPort: 8080
yang@k8s-master:~$ kubectl delete deployments.apps hello-world1 
deployment.apps "hello-world1" deleted
yang@k8s-master:~$ kubectl apply -f hello.yaml 
deployment.apps/hello-world1 created
yang@k8s-master:~$ kubectl get pod
NAME                            READY   STATUS    RESTARTS   AGE
hello-world1-64846684bd-l2m7s   1/1     Running   0          7s

k8s.gcr.io → lank8s.cn,gcr.io → gcr.lank8s.cn

  • 11
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值