Report this

What is the reason for this report?

Load Balancer with Kubernetes returns ERR_EMPTY_RESPONSE

Posted on March 18, 2019

I’m trying to use a Load Balancer in front of my Kubernetes cluster. The Load Balancer says that the droplet status is healthy, but whenever I try to load the IP or the domain that I pointed to that IP, it just hangs and then I get ERR_EMPTY_RESPONSE in Chrome saying that the page didn’t send any data. Here’s the config for my service:

apiVersion: v1
kind: Service
metadata:
  name: my-app-load-balancer
spec:
  type: LoadBalancer
  selector:
      app: my-app
  ports:
    - protocol: TCP
      port: 80
      targetPort: 3000
      name: http

And here’s the config for my deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      containers:
        - name: my-app
          image: gcr.io/my-app/my-app:v1
          imagePullPolicy: Always
          ports:
          - containerPort: 3000
      imagePullSecrets:
        - name: gcr-json-key

And when I run kubectl get services, I get this:

NAME                               TYPE           CLUSTER-IP      EXTERNAL-IP       PORT(S)        AGE
my-app-load-balancer   LoadBalancer   xxxx   xxxx   80:30262/TCP   5h41m

And when I run kubectl logs $POD_NAME, I get that no requests have been received, just the initial listening message when the app server starts up:

[2019-03-18 04:03:13.89389] [1] [info] Listening at "http://*:3000" 


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This comment has been deleted

Additionally, I ran this command against the pod:

kubectl exec my-pod-xyz -c my-app -- curl localhost:3000

And the app server on the pod did return the page, and then running kubectl logs $POD_NAME actually contained the request in the logs. So it seems like the load balancer isn’t reaching the pod at all.

This comment has been deleted

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.