kubectl无法从私有存储库中提取图像 [英] kubectl not able to pull the image from private repository

查看:71
本文介绍了kubectl无法从私有存储库中提取图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行kubeadm alpha版本来设置我的kubernates集群. 从kubernates,我正在尝试拉取在nexus存储库中托管的docker映像. 每当我尝试创建Pod时,每次都会给出"ImagePullBackOff".有人可以帮我吗?

I am running kubeadm alpha version to set up my kubernates cluster. From kubernates , I am trying to pull docker images which is hosted in nexus repository. When ever I am trying to create a pods , It is giving "ImagePullBackOff" every time. Can anybody help me on this ?

有关详细信息,请参见 https://github.com/kubernetes/kubernetes/issues/41536

Detail for this are present in https://github.com/kubernetes/kubernetes/issues/41536

Pod定义:

apiVersion: v1
kind: Pod
metadata:
  name: test-pod
  labels:
    name: test
spec:
  containers:
    - image: 123.456.789.0:9595/test
      name: test
      ports:
        - containerPort: 8443
  imagePullSecrets:
    - name: my-secret

推荐答案

您需要使用kubectl create secret docker-registry my-secret --docker-server=123.456.789.0 ...创建密钥时,服务器必须与Pod定义中的内容完全匹配-包括端口号(并且如果是安全端口,则还必须与docker匹配) systemd中的命令行).

When you create the secret with kubectl create secret docker-registry my-secret --docker-server=123.456.789.0 ... the server must exactly match what's in your Pod definition - including the port number (and if it's a secure one then it also must match up with the docker command line in systemd).

此外,机密必须在创建Pod的相同命名空间中,但这似乎是有序的.

Also, the secret must be in the same namespace where you are creating your Pod, but that seems to be in order.

这篇关于kubectl无法从私有存储库中提取图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆