I are trying to run some Kubernetes pods in my Windows machine by using Docker-Desktop.
I am trying to install them using HELM. I have created my Docker images and have pushed them into AWS ECR private repository.
When I try to run the HELM install command to spin up the container, they get created. However, when they try to pull the images from AWS ECR, it's throwing an error and the container are getting an 'ImagePullBackOff' error.
The error when describing a failed pod:
Failed to pull image "012345678900.dkr.ecr.ap-south-1.amazonaws.com/arjun-poc1/centos-test1:latest": rpc error: code = Unknown desc = Error response from daemon: Head "https://012345678900.dkr.ecr.ap-south-1.amazonaws.com/v2/arjun-poc1/centos-test1/manifests/latest": no basic auth credentials
I have done the 'aws configure' step and have run the 'aws ecr get-login-password' command. I am able to manually run 'docker pull' and get the image locally. However, it's not getting pulled automatically during container start up.
I have also tried to setup an 'imagePullSecret' by running the following command: kubectl create secret docker-registry aws-secret --docker-server=https://[email protected] --docker-username=AWS --docker-password=$(aws ecr get-login-password)
. Tried to include it within the values.yaml too.
charts\centos-test1\templates\deployment.yaml
spec:
imagePullSecrets: {{- toYaml .Values.global.imagePullSecrets | nindent 12 }}
values.yaml
global:
hub: 012345678900.dkr.ecr.ap-south-1.amazonaws.com/arjun-poc1
imagePullSecrets:
- name: aws-secret
images:
centos-test1:
name: centos-test1
tag: latest
pullPolicy: Always
Still it's not working. I am getting the 'ImagePullBackOff' error every time.
Does anyone know how to fix this issue?