Cannot Access kubernetes application via ingress on Docker Desktop

21 Views Asked by At

What am I missing?

when I try to go to: http://hello-test.internal/ I get:

This page isn’t working hello-test.internal didn’t send any data. ERR_EMPTY_RESPONSE

This is Kubernetes hosted on docker-desktop

Please look at my configuration:

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: angular-app-product
    version: 0.0.1-SNAPSHOT
  name: angular-app-product
spec:
  replicas: 1
  selector:
    matchLabels:
      app: angular-app-product
  strategy: {}
  template:
    metadata:
      labels:
        app: angular-app-product
        version: 0.0.1-SNAPSHOT
    spec:
      containers: 
        - image: angular-app-product:0.0.1-SNAPSHOT
          name: angular-app-product
          resources: {}
---
apiVersion: v1
kind: Service
metadata:
  name: angular-app-product
spec:
  selector:
    app: angular-app-product
  type: NodePort
  ports:
  - name: http
    port: 80
    targetPort: 80
    nodePort: 30080
---
apiVersion: v1
kind: Service
metadata:
  name: angular-app-product
spec:
  selector:
    app: angular-app-product
  ports:
  - name: http
    port: 80
    targetPort: 80
  type: LoadBalancer

Hosts File:

# Added by Docker Desktop
192.168.0.55 host.docker.internal
192.168.0.55 gateway.docker.internal
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
127.0.0.1 hello-test.internal
# End of section
1

There are 1 best solutions below

4
djhaskin987 On

Your kubernetes configuration appears to be correct. Indeed, ERR_EMPTY_RESPONSE implies that an HTTP connection was successfully made, just that the server gave an incorrect reply.

This question is from someone else experiencing this error at the Node.js level. I wonder if this isn't your kubernetes config but the actual code.

You may wish to run your code using docker-compose first, get it to work, THEN use k8s config. At that point, you'll have more confidence as to where the problem might lie.