无法使用私有映像使用CLI创建Azure容器实例

时间:2017-08-26 07:46:49

标签: azure kubernetes azure-container-registry azure-container-instances

我无法使用CLI和yaml文件使用私有映像(ACR)部署pod。

使用az容器或kubectl run直接从注册表部署确实有效。

Pod状态:

  "containers": [
    {

            "count": 3,
            "firstTimestamp": "2017-08-26T07:31:36+00:00",
            "lastTimestamp": "2017-08-26T07:32:20+00:00",
            "message": "Failed: Failed to pull image \"ucont01.azurecr.io/unreal-deb\": rpc error: code 2 desc Error: im age unreal-deb:latest not found",
            "type": "Warning"
          },
        ],
      },

Yaml文件:

apiVersion: v1
kind: Pod
metadata:
  generateName: "game-"
  namespace: default
spec:
  nodeName: aci-connector
  dnsPolicy: ClusterFirst
  restartPolicy: Never
  containers:
    - name: unreal-dev-server
      image: ucont01.azurecr.io/unreal-deb
      imagePullPolicy: Always
      ports:
      - containerPort: 7777
        protocol: UDP
  imagePullSecrets:
    - name: registrykey

3 个答案:

答案 0 :(得分:3)

不幸的是,aci-connector-k8s目前不支持来自私有存储库的映像。有一个问题可以解决,但目前尚未实施。

https://github.com/Azure/aci-connector-k8s/issues/35

答案 1 :(得分:1)

根据您的描述,您可以通过Azure门户检查您的repositories,如下所示:

enter image description here

使用你的YAML,它对我有用:

apiVersion: v1
kind: Pod
metadata:
  generateName: "game-"
  namespace: default
spec:
  nodeName: k8s-agent-379980cb-0
  dnsPolicy: ClusterFirst
  restartPolicy: Never
  containers:
    - name: unreal-dev-server
      image: jasontest.azurecr.io/samples/nginx
      imagePullPolicy: Always
      ports:
      - containerPort: 7777
        protocol: TCP
  imagePullSecrets:
    - name: secret1

以下是截图:

enter image description here

这是我的secret

jason@k8s-master-379980CB-0:~$ kubectl get secret
NAME                  TYPE                                  DATA      AGE
default-token-865dj   kubernetes.io/service-account-token   3         1h
secret1               kubernetes.io/dockercfg               1         47m

答案 2 :(得分:0)

如果凭据(对应于registrykey)不正确,虽然图像存在,但您可能会收到“找不到图像”错误。您可能想再次验证registrykey凭证..