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

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

<pre><code>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
</code></pre>

<p>I got this working after reading this info.</p>

<p><a href="http://kubernetes.io/docs/user-guide/images/#specifying-imagepullsecrets-on-a-pod" rel="noreferrer">http://kubernetes.io/docs/user-guide/images/#specifying-imagepullsecrets-on-a-pod</a></p>

<p>So firstly create the registry access key</p>

<pre><code>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
</code></pre>

<p>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.</p>

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

<pre><code>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
</code></pre>
