In the demo for deploying the voting app on Kubernetes using “pods”, I’m unable to create the “worker-app-pod” as the error says “ImagePullBackOff” whereas I’m able to pull the same image via the docker pull command directly.
Hello @jhaabhishek115,
Please follow these full steps to know what you have missed and try again :
Note: We will create deployments again so please before following the steps, Runkubectl delete deployment --allto delete old deployments and avoid any conflicts.
Run git clone https://github.com/mmumshad/example-voting-app-kubernetes-v2.git
Run cd example-voting-app-kubernetes-v2/
Run vim postgres-deployment.yml and modify it’s content as below then save and exit.
Run kubectl create -f . if you create deployments for the first time, if you created the same deployments before Run kubectl apply -f . .
Run kubectl get service to get the exposed ports.
For example if the output of the command as above you can accces the voting app by hitting One_of_the_worker_nodes_IP:32733 on your browser and the same for the resulting app >> One_of_the_worker_nodes_IP:30013.
Check :
Note: The voting application only accepts one vote per client. It does not register votes if a vote has already been submitted from a client.
I haven’t yet created deployments yet.
Deployments are created in the next tutorial.
I have successfully created 4 pods but facing an error in creating the worker-app-pod “Error: ImagePullBackOff”.
I am able to pull the same image via the docker pull command in one go.
image - kodekloud/examplevotingapp_worker:v1
so, should I delete all the pods and go on to create deployments?
If the code on Postgres-pod is incorrect, I’d not be able to connect to the PostgreSQL DB but the issue here is that worker-app-pod which is a standalone pod isn’t able to pull the image and as a result pod is not getting created.
I have created the deployments , but again the worker-app-deploy is not working as it is unable to pull the image.
Error: ImagePullBackOff
image: kodekloud/examplevotingapp_worker:v1
I tried a lab-based environment. All deployments and services are running but the vote is not getting reflected and the error I get is: Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
What do the pod logs for the worker app say, assuming you got past the ImagePullBackoff issue?
Bear in mind that the worker app should not be deployed until both the redis and postgres deployments, and their services are running correctly. The worker service expects to be able to connect to both of them and will fail if it can’t.
i have deleted all the pods and services.
and followed this process of creating voter pod and service, redis pod and service, postgres pod and service, worker pod.
But im still seeing this issue.
Its not on the lab, its on my local
I also am facing the same issue. This is being done on local machine on minikube.
Worker pod when started goes in Backoff and keeps retrying. Upon checking further, found below container logs.
Note: We will create deployments again so please before following the steps, Runkubectl delete deployment --allto delete old deployments and avoid any conflicts.
Run git clone https://github.com/mmumshad/example-voting-app-kubernetes-v2.git
Run cd example-voting-app-kubernetes-v2/
Run vim postgres-deployment.yml and modify it’s content as below then save and exit.
Run kubectl create -f . if you create deployments for the first time, if you created the same deployments before Run kubectl apply -f . .
Run kubectl get service to get the exposed ports.
For example if the output of the command as above you can accces the voting app by hitting One_of_the_worker_nodes_IP:32733 on your browser and the same for the resulting app >> One_of_the_worker_nodes_IP:30013.
Check :
Note: The voting application only accepts one vote per client. It does not register votes if a vote has already been submitted from a client.
The issue with worker-app-pod still persists. I get CrashLoopBackOff error. All the steps and procedures are followed correctly @Ayman your last answer does not help. Please check into what is the actual cause.
The order in which you deploy the resources is significant. The worker app makes use of both the postgres and redis databases meaning that they must both be running without crashlooping and their services deployed before you apply the worker app. This is called a dependency relationship. Worker depends on the other two.
Additionally the voting and results apps depend on each of the databases (can’t remember which way round it is) but it means they too must also be deployed after the databases.
Order of deployment is therefore
postgres and redis (doesn’t matter which way round, they are not inter-dependent). Ensure both are running without crash loop before proceeding.
Same here, I recently ran into the same issue with the pod/worker-app-pod CrashLoopBackOff error, so there order deployment really does matter.
Many thanks to Alistair for being such a huge help to all of us!