Oussama Bouchikhi
Oussama Bouchikhi

Reputation: 615

Kubernetes pod Back-off restarting failed container with CrashLoopBack error

Github repo

After I configured the kubectl with the AWS EKS cluster, I deployed the services using these commands:

kubectl apply -f env-configmap.yaml
kubectl apply -f env-secret.yaml
kubectl apply -f aws-secret.yaml
# this is repeated for all services 
kubectl apply -f svcname-deploymant.yaml
kubectl apply -f svcname-service.yaml

enter image description here

The other services ran successfully but the reverse proxy returned an error and when I investigated by running the command kubectl describe pod reverseproxy... I got this info:

https://pastebin.com/GaREMuyj

[Edited]

After running the command kubectl logs -f reverseproxy-667b78569b-qg7p I get this: enter image description here

Upvotes: 1

Views: 3024

Answers (1)

Mikołaj Głodziak
Mikołaj Głodziak

Reputation: 5277

As David Maze very rightly pointed out, your problem is not reproducible. You haven't provided all the configuration files, for example. However, the error you received clearly tells about the problem:

host not found in upstream "udagram-users: 8080" in /etc/nginx/nginx.conf:11

This error makes it clear that you are trying to connect to host udagram-users: 8080 as defined in file /etc/nginx/nginx.conf on line 11.

And how can I solve it please?

You need to check the connection. (It is also possible that you entered the wrong hostname or port in the config). You mentioned that you are using multiple subnets:

it is using 5 subnets

In such a situation, it is very likely that there is no connection because the individual components operate on different networks and will never be able to communicate with each other. If you run all your containers on one network, it should work. If, on the other hand, you want to use multiple subnets, you need to ensure container-to-container communication across multiple subnets.

See also this similar problem with many possible solutions.

Upvotes: 1

Related Questions