Getting ImagePullBackOff on EC2 instance while creating Kubernetes pods

10/18/2019

I have deployed simple react app on kubernetes through docker-desktop successfully. It was having only one master there. Now I am doing the same thing on AWS Ubuntu EC2 Instance, its having one master and two slave nodes, all are connected properly. Also a demo Nginx server is already deployed successfully on my master EC2 instance.

I am getting ImagePullBackOff status on React deployment/service. Is there any configuration I have to make in EC2 to make it work. How can I debug the things and what could be the reasons for same.

I have followed these guides and you can assume my deployment and service .yml file to be same as provided in these links.

https://dev.to/rieckpil/deploy-a-react-application-to-kubernetes-in-5-easy-steps-516j

https://stackoverflow.com/a/37306838/9465933

I am pushing the pods to local docker registry. Is there any docker secret config's are required for this ? Any help will be highly appreciated.

-- jeetdeveloper
amazon-web-services
devops
docker
kubernetes

1 Answer

10/18/2019

If you expand on the logs with kubectl describe, you will probably notice that the error is that Kubernetes cannot fetch the image from the registry.

This is due to two things:

  1. You need to create a secret to access your registry. https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/

  2. You said to have a local registry. Is it publicly reachable? Notice that the EC2 instances need to be able to access it. So check port-forwarding, firewall configuration, etc in your LAN.

-- Ay0
Source: StackOverflow