Connection refused to GCP LoadBalancer in Kubernetes
This turned out to be a dumb mistake on my part. The gunicorn server was using a bind to 127.0.0.1
instead of 0.0.0.0
, so it wasn't accessible from outside of the pod, but worked when I exec
-ed into the pod.
The fix in my case was changing the entrypoint of the Dockerfile to
CMD [ "gunicorn", "server:app", "-b", "0.0.0.0:8000", "-w", "3" ]
rebuilding the image and updating the deployment.