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.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
I’m still not sure what the issue was, but I deleted my service and deployment, and then I created the service and then the deployment again, and now things seem to be working.
This comment has been deleted
Additionally, I ran this command against the pod:
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.