拉映像Azure容器注册表-Kubernetes [英] Pull image Azure Container Registry - Kubernetes

查看:98
本文介绍了拉映像Azure容器注册表-Kubernetes的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于在Azure容器服务(kubernetes)中运行时如何从Azure容器注册表中提取信息的人是否有任何建议

Does anyone have any advice on how to pull from Azure container registry whilst running within Azure container service (kubernetes)

我尝试了以下示例部署,但是图像提取失败:

I've tried a sample deployment like the following but the image pull is failing:

kind: Deployment
apiVersion: extensions/v1beta1
metadata:
  name: jenkins-master
spec:
  replicas: 1
  template:
    metadata:
      name: jenkins-master
      labels:
        name: jenkins-master
    spec:
      containers:
      - name: jenkins-master
        image: myregistry.azurecr.io/infrastructure/jenkins-master:1.0.0
        imagePullPolicy: Always
        readinessProbe:
          tcpSocket:
            port: 8080
          initialDelaySeconds: 20
          timeoutSeconds: 5
        ports:
        - name: jenkins-web
          containerPort: 8080
        - name: jenkins-agent
          containerPort: 50000

推荐答案

阅读此信息后,我开始使用此功能.

I got this working after reading this info.

http://kubernetes.io/docs /user-guide/images/#specifying-imagepullsecrets-on-a-pod

因此,首先创建注册表访问键

So firstly create the registry access key

kubectl create secret docker-registry myregistrykey --docker-server=https://myregistry.azurecr.io --docker-username=ACR_USERNAME --docker-password=ACR_PASSWORD --docker-email=ANY_EMAIL_ADDRESS

将服务器地址替换为ACR地址的地址,并将USERNAME,PASSWORD和EMAIL地址替换为admin用户的ACR值.注意:电子邮件地址可以是值.

Replacing the server address with the address of your ACR address and the USERNAME, PASSWORD and EMAIL address with the values from the admin user for your ACR. Note: The email address can be value.

然后在部署中,您只需告诉kubernetes使用该密钥来拉取图像,就像这样:

Then in the deploy you simply tell kubernetes to use that key for pulling the image like so:

kind: Deployment
apiVersion: extensions/v1beta1
metadata:
  name: jenkins-master
spec:
  replicas: 1
  template:
    metadata:
      name: jenkins-master
      labels:
        name: jenkins-master
    spec:
      containers:
      - name: jenkins-master
        image: myregistry.azurecr.io/infrastructure/jenkins-master:1.0.0
        imagePullPolicy: Always
        readinessProbe:
          tcpSocket:
            port: 8080
          initialDelaySeconds: 20
          timeoutSeconds: 5
        ports:
        - name: jenkins-web
          containerPort: 8080
        - name: jenkins-agent
          containerPort: 50000
      imagePullSecrets:
        - name: myregistrykey

这篇关于拉映像Azure容器注册表-Kubernetes的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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