willianantunes / comments

0 stars 0 forks source link

blog/2021/05/gke-ingress-how-to-fix-a-502-bad-gateway-error/ #3

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

GKE Ingress: How to fix a 502 bad gateway error | An honest place where you can learn things about programming

When you configure your application and receive an error 502 (Bad Gateway), mostly this happens because of a wrong setup. To illustrate, let's see one circumstance and how to fix it.

https://www.willianantunes.com/blog/2021/05/gke-ingress-how-to-fix-a-502-bad-gateway-error/

fabiohk commented 3 years ago

Honest and cool work, man! Your line of thought is amazing! Congrats! :rocket:

Just to be clear, you had to add the readinessProbe and not livenessProbe, right? Asking because the Fixing the problem section is showing the livenessProbe :grin:

willianantunes commented 3 years ago

Just to be clear, you had to add the readinessProbe and not livenessProbe, right? Asking because the Fixing the problem section is showing the livenessProbe

Indeed, my friend. It's was fixed. Thank you! By the way, this comment made me remember how accurate and thorough you are when doing a PR review 💪 Thanks again!

dotnetpiper commented 3 years ago

Hi Willianantunes I've been following your document though still issue persist,since i applied livenessProbe and readinessProbe specific pods went to CrashLoopBackOff. This is what I've put as combination of both livenessProbe but there is no success.Kindly advise to to overcome from this. livenessProbe: httpGet: path: "/health-check" port: 80 initialDelaySeconds: 20 timeoutSeconds: 5 readinessProbe: httpGet: path: "/health-check" port: 80 initialDelaySeconds: 30 timeoutSeconds: 10

willianantunes commented 3 years ago

Hi @dotnetpiper!

(...) to CrashLoopBackOff.

Have you tried to see why it's retrieving CrashLoopBackOff using describe? You can use it either in your deployment or pod. Trying with logs is a good option too.

Which image are you using in your deployment manifest? The image gcr.io/agrabah-project/spacejam:latest-prd does not exist by the way. It's just an example I used in this post.

dotnetpiper commented 3 years ago

I'm using one of the dotnetCore based api application, even I've created a stack overflow link at following path: https://stackoverflow.com/questions/68067144/gke-ingress-bad-gateway-or-backend-not-found If you could help me to sort out this I'll be highly thankful. In a nutshell I'm using two images which I've set in GKE Ingress one goes to simple hello app and another one is .Net Core API . A .net core api exposed on following path on local (i can see it using bash inside pod) http://localhost/api/items but GKE ingress is not able to sort out. What path i should keep to reach out after apply GKE External loadbalancer through Ingress.Kindly find below my actual Ingress.yaml

apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: gke-ingress annotations:

If the class annotation is not specified it defaults to "gce".

kubernetes.io/ingress.class: "gce"      

spec:
rules:

Looking forward to hear you soon. Thanks

ssill2 commented 6 months ago

thanks for your research into this. I recently ran into it myself and your solution fixed it.

ssill2 commented 6 months ago

it took removing the helm deployment of my application and installing it again, an upgrade didn't make the change to the path of the healthcheck