kameshsampath / kind-nodeport-controller

Kind NodePort Controller - An helper to expose kubernetes services in kind to host
MIT License
2 stars 0 forks source link

ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) while doing GET request to URL: http://localhost:30939/ #8

Open cmoulliard opened 4 years ago

cmoulliard commented 4 years ago

Issue

The example application deployed on kubernetes - 1.18 cannot be accessed using the docker - socat container exposing the port 30939

kc logs pod/myapp-76c99bd5d9-2pr5q -n demos
2020-05-28 15:10:57,752 INFO  [io.quarkus] (main) quarked 1.0.0 (running on Quarkus 1.0.1.Final) started in 0.008s. Listening on: http://0.0.0.0:8080
2020-05-28 15:10:57,752 INFO  [io.quarkus] (main) Profile prod activated. 
2020-05-28 15:10:57,752 INFO  [io.quarkus] (main) Installed features: [cdi, resteasy]

kc get svc -n demos                      
NAME    TYPE       CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE
myapp   NodePort   10.102.225.154   <none>        8080:30939/TCP   3m53s

docker ps                         
CONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS              PORTS                        NAMES
16c4137ea934        alpine/socat           "socat -dd tcp-liste…"   3 minutes ago       Up 3 minutes        127.0.0.1:30939->30939/tcp   kind-myapp-demos-TCP-8080-30939-proxy
d556b6867ae4        kindest/node:v1.18.2   "/usr/local/bin/entr…"   7 minutes ago       Up 7 minutes        127.0.0.1:57405->6443/tcp    demo-control-plane

http :30939                              

http: error: ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) while doing GET request to URL: http://localhost:30939/
cmoulliard commented 4 years ago

FYI, the following scenario is working on my macbook using docker client

# Create a kind cluster and expose extra port for docker -> 31500
kind delete cluster --name demo
cat <<EOF | kind create cluster --name demo --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  extraPortMappings:
  - containerPort: 31500
    hostPort: 31500
    protocol: TCP
    listenAddress: "127.0.0.1"
EOF

# Deploy the demo application
kc create ns demo
cat <<EOF | kc apply -n demo -f -
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp
spec:
  selector:
    matchLabels:
      app: myapp
  template:
    metadata:
      labels:
        app: myapp
    spec:
      containers:
        - name: myapp
          image: quay.io/kameshsampath/quarked:1.0.0
          resources:
            limits:
              memory: "128Mi"
              cpu: "500m"
          ports:
            - containerPort: 8080
EOF
kc expose deployment myapp -n demo --port=8080 --target-port=8080 --type=NodePort
kc patch service myapp -n demo --type='json' --patch='[{"op": "replace", "path": "/spec/ports/0/nodePort", "value":31500}]'

# Access the quarkus application
http :31500