Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend pod failing (CrashLoopBackOff) #2

Open
GarbageYard opened this issue Oct 8, 2022 · 4 comments
Open

Backend pod failing (CrashLoopBackOff) #2

GarbageYard opened this issue Oct 8, 2022 · 4 comments

Comments

@GarbageYard
Copy link

I deployed the manifests in lab1_volume_begin exercise on Minikube running on Ubuntu WSL2 (not on Docker Desktop) on Windows but that didn't work.

Now I am trying to deploy the manifests on CentOS 7 VM running on GCP but I still see it's not working.

$ kubectl version --short
Client Version: v1.25.2
Kustomize Version: v4.5.7
Server Version: v1.25.2

In the current set up on CentOS 7, when I check the logs, the backend pod is failing.

[tom@master yaml]$ kubectl get pod,ing,svc
NAME                                      READY   STATUS             RESTARTS        AGE
pod/docker-registry-pod                   1/1     Running            2 (3h3m ago)    42h
pod/guestbook-backend-558f7f9bc6-rtbvr    0/1     CrashLoopBackOff   9 (3m21s ago)   30m
pod/guestbook-database-69bfdf8875-vqxwx   1/1     Running            0               152m
pod/guestbook-frontend-65694b489f-8qc2m   1/1     Running            0               152m

NAME                                                    CLASS    HOSTS                                                                ADDRESS   PORTS   AGE
ingress.networking.k8s.io/guestbook-guestbook-ingress   <none>   guestbook.frontend.minikube.local,guestbook.backend.minikube.local             80      36m

NAME                         TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)     AGE
service/guestbook-backend    ClusterIP   10.97.254.212   <none>        80/TCP      152m
service/guestbook-database   ClusterIP   10.106.67.122   <none>        27017/TCP   152m
service/guestbook-frontend   ClusterIP   10.109.167.16   <none>        80/TCP      152m
service/kubernetes           ClusterIP   10.96.0.1       <none>        443/TCP     2d
[tom@master yaml]$ pwd
/home/tom/kubernetes_storage/lab1_volume_begin/yaml

[tom@master yaml]$ kubectl logs --previous --tail 10 pod/guestbook-backend-558f7f9bc6-rtbvr
Guestbook API listening on port 3000 ..
/home/node/app/node_modules/mongodb/lib/utils.js:691
          throw error;
          ^

MongoServerSelectionError: getaddrinfo EAI_AGAIN guestbook-database:27017
    at Timeout.waitQueueMember.timer.setTimeout [as _onTimeout] (/home/node/app/node_modules/mongodb/lib/core/sdam/topology.js:439:30)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5)

I have been trying to get this work for the last two days. I will really appreciate any help.

@GarbageYard
Copy link
Author

@phcollignon: Any suggestions?

@phcollignon
Copy link
Owner

Hello,
It looks like you have a DNS issue in your K8s cluster.
Please make sure the DNS is accessible from any container in the cluster.
Can you log in a container and try to ping guestbook-database hostname ?
Regards,
Philippe

@GarbageYard
Copy link
Author

Hi @phcollignon,

Thank you! You were right about the DNS. Actually, I had not whitelisted the UDP ports. Once I did that, the CrashLoopBackOff issue is no more there and I am also able to reach the guestbook-database from within the frontend container. :)

I am running this on VMs in GCP. Now when I try to port-forward the frontend service to my Windows machine, although it opens up the UI fine but when I put the feedback and click on Leave message button, it doesn't display the message in the upper Filter section (kindly refer below image). When I checked the browser's Console, I see the following CORS-related error:

CORS_error

I thought of putting below entries in my hosts file on my Windows instance but that didn't help:

34.131.220.138 guestbook.frontend.minikube.local
34.131.220.138 guestbook.backend.minikube.local

Any idea how I can fix this?

@phcollignon
Copy link
Owner

Great that it works for DNS.

About CORS ... it should work as it is the same parent domain.
But you have to access with the url with domain name instead of IP address.
Hope this help,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants