Getting bad gateway 502 error in nGinx server using Kubernates cluster

11/19/2018

I am getting a error while loading my one of microservices in node nGnix server using Kubernates cluster.

Here is the error:

110#110: *20 connect() failed (111: Connection refused) while connecting to upstream, client: 61.xxx.221.179, server: dev.XXXXX.in, request: "GET /api/ticket/getTicketDetails HTTP/1.1", upstream: "http://100.96.x.xxx:3001/api/ticket/getTicketDetails", host: "dev.XXXX.in"

Can someone please help me on this?

-- Praveen sivadasan
amazon-web-services
kubernetes
nginx
node.js

1 Answer

11/19/2018

Please do,

kubectl exec -it meta_data_name -- /bin/bash

curl http://100.96.x.xxx:3001/api/ticket/getTicketDetails

Mostly, this will fail as the upstream might not be running or there is no connectivity to it.

Check for logs inside the nodeJs micro-service to find if it is termination on incoming requests due to some error.

-- Jeevan
Source: StackOverflow