I am getting a no basic auth credentials
ErrImagePull
error when pulling an image hosted on a private ECR registry. I have to my knowledge checked off all the necessary requirements for successful authorization, so I'll list them below in hopes that someone might suggest something I missed.
aws ecr get-login-password --region eu-west-2 | docker login --username AWS --password-stdin redacted.dkr.ecr.eu-west-2.amazonaws.com
is successfulI can successfully run the image through a
docker pull
anddocker run
. Meaning my account has privileges to pull the imageI have created a separate namespace called
client-ns
I have created a
regcred
with this command:
kubectl create secret docker-registry regcred \
--docker-server=redacted.dkr.ecr.eu-west-2.amazonaws.com \
--docker-username=AWS \
--docker-password=$(aws ecr get-login-password) \
--namespace=client-ns
- In my
manifest.yml
I have added the variables:
imagePullSecrets:
- name: regcred
- I have inspected the secrets and double checked that they match using the commands below
aws ecr get-login-password
kubectl get secret regcred --namespace=client-ns --output="jsonpath={.data.\.dockerconfigjson}" | base64 --decode
Despite all these steps I still get the error, any ideas what could be causing this? Below are the events of the pod
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 45s default-scheduler Successfully assigned client-ns/client-deployment-8567f459b8-9j25j to minikube
Normal BackOff 17s (x3 over 43s) kubelet Back-off pulling image "redacted.dkr.ecr.eu-west-2.amazonaws.com/client:v1.0.1"
Warning Failed 17s (x3 over 43s) kubelet Error: ImagePullBackOff
Normal Pulling 5s (x3 over 44s) kubelet Pulling image "redacted.dkr.ecr.eu-west-2.amazonaws.com/client:v1.0.1"
Warning Failed 5s (x3 over 44s) kubelet Failed to pull image "redacted.dkr.ecr.eu-west-2.amazonaws.com/client:v1.0.1": rpc error: code = Unknown desc = Error response from daemon: Head "https://redacted.dkr.ecr.eu-west-2.amazonaws.com/v2/client/manifests/v1.0.1": no basic auth credentials
Warning Failed 5s (x3 over 44s) kubelet Error: ErrImagePull
Edit: Below is my deployment manifest:
apiVersion: apps/v1
kind: Deployment
metadata:
name: client-deployment
namespace: client-ns
spec:
replicas: 1
selector:
matchLabels:
app: client-app
template:
metadata:
labels:
app: client-app
spec:
containers:
- name: client-app
image: redacted.dkr.ecr.eu-west-2.amazonaws.com/client:v1.0.1
imagePullPolicy: Always
ports:
- containerPort: 50054
name: eds-app
securityContext:
runAsUser: 20000
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
resources:
requests:
memory: "64Mi"
cpu: "100m"
ephemeral-storage: "5Mi"
limits:
memory: "128Mi"
cpu: "200m"
ephemeral-storage: "10Mi"
volumeMounts:
- name: env-file
mountPath: /client/build/default.env
subPath: default.env
- name: csv-file
mountPath: /client/csv/customers.csv
subPath: customers.csv
volumes:
- name: env-file
hostPath:
path: /home/nocnoc/Documents/redacted/github/client/build/default.env
- name: csv-file
hostPath:
path: /home/nocnoc/Documents/redacted/github/client/csv/customers.csv
imagePullSecrets:
- name: regcred