加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

docker – kubernetes不能拉当地形象

发布时间:2020-12-16 03:38:12 所属栏目:安全 来源:网络整理
导读:我在一台机器上使用kubernetes进行测试,我已经从nginx docker图像构建了一个自定义图像,但是当我尝试在kubernetes中使用图像时,我得到一个图像拉错误????? 我的POD YAML kind: PodapiVersion: v1metadata: name: yumserver labels: name: frontendhttpspec:

我在一台机器上使用kubernetes进行测试,我已经从nginx docker图像构建了一个自定义图像,但是当我尝试在kubernetes中使用图像时,我得到一个图像拉错误?????

我的POD YAML

kind: Pod
apiVersion: v1
metadata:
  name: yumserver
  labels:
    name: frontendhttp
spec:
  containers:
    - name: myfrontend
      image: my/nginx:latest
      ports:
        - containerPort: 80
          name: "http-server"
      volumeMounts:
      - mountPath: "/usr/share/nginx/html"
        name: mypd
  imagePullSecrets:
    - name: myregistrykey

  volumes:
    - name: mypd
      persistentVolumeClaim:
       claimName: myclaim-1

我的KUBERNETES命令

kubectl create -f pod-yumserver.yaml

错误

kubectl describe pod yumserver


Name: yumserver
Namespace: default
Image(s):   my/nginx:latest
Node:       127.0.0.1/127.0.0.1
Start Time: Tue,26 Apr 2016 16:31:42 +0100
Labels:     name=frontendhttp
Status:     Pending
Reason:     
Message:    
IP:     172.17.0.2
Controllers:    
最佳答案

So you have the image on your machine aready. It still tries to pull the image from Docker Hub,however,which is likely not what you want on your single-machine setup. This is happening because the latest tag sets the imagePullPolicy to Always implicitly. You can try setting it to IfNotPresent explicitly or change to a tag other than latest. – Timo Reimann Apr 28 at 7:16

由于某种原因,Timo Reimann只是将上述内容作为评论发布,但它肯定应该是这个问题的正式答案,所以我再次发布它.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读