I’m trying to pull an image from ACR but I always keep getting this error
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 22s default-scheduler Successfully assigned default/deployment-name-8659d4b797-c6wcx to minikube
Normal BackOff 19s kubelet Back-off pulling image "somename.azurecr.io/someimage:latest"
Warning Failed 19s kubelet Error: ImagePullBackOff
Normal Pulling 6s (x2 over 21s) kubelet Pulling image "somename.azurecr.io/someimage:latest"
Warning Failed 4s (x2 over 19s) kubelet Failed to pull image "somename.azurecr.io/someimage:latest": rpc error: code = Unknown desc = Error response from daemon: Head "https://somename.azurecr.io/v2/someimage/manifests/latest": unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information.
Warning Failed 4s (x2 over 19s) kubelet Error: ErrImagePull
Here is my deployment-name.yml
file
apiVersion: apps/v1
kind: Deployment
metadata:
name: appname-deployment
labels:
app: appname
spec:
replicas: 1
selector:
matchLabels:
app: appname
template:
metadata:
labels:
app: appname
spec:
containers:
- name: appname
image: somename.azurecr.io/someimage:latest
ports:
- containerPort: 8082
env:
- name: CORE_PORT
valueFrom:
configMapKeyRef:
name: my-config-map
key: CORE_PORT
imagePullSecrets:
- name: wc1
---
apiVersion: v1
kind: Service
metadata:
name: appname-service
spec:
selector:
app: appname
ports:
- protocol: TCP
port: 8082
targetPort: 8082
I know this question has been asked many times, but I still can’t figure out.
Surprisingly, docker pull somename.azurecr.io/someimage:latest
works really fine.
I have tried
- using servicePrincipal name with https://learn.microsoft.com/en-us/azure/container-registry/container-registry-auth-kubernetes.
- Also for the above, I tried directly using admin access (username and password) from Access Keys menu in Azure
The command to create a secret for #2 was
kubectl create secret docker-registry wc1
--docker-server=somename.azurecr.io
--docker-username=somename
--docker-password=admin_password
Can somebody point me what will fix that error?