Deployment fails to Azure AKS from Bitbucket
Have you created the right Docker credentials in AKS?If you are sure you docker login is right, then create the following secret in AKS:
kubectl create secret generic regcred \ --from-file=.dockerconfigjson=<path/to/.docker/config.json> \ --type=kubernetes.io/dockerconfigjson
where <path/to/.docker/config.json>
usually is ~/.docker/config.json (of course you need to be able to reach that repo from your machine).
Then, quote this secret credential in your pod definition:
imagePullSecrets: - name: regcred
To use your example:
apiVersion: v1kind: Podmetadata: name: test labels: app: testspec: containers: - name: test image: myrepository/test:1234 command: ["/bin/sleep", "3650d"] imagePullPolicy: IfNotPresent imagePullSecrets: - name: regcred restartPolicy: Always
AKS can easily pull images from public Docker Hub repositories or from Azure ACR (Azure Container Registry), but to connect to Docker Hub private you need to give the right connection data.
Reference: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/