contour icon indicating copy to clipboard operation
contour copied to clipboard

Connection closed when connecting to TCP services

Open senthilrameshjv opened this issue 5 years ago • 24 comments

What steps did you take and what happened: [A clear and concise description of what the bug is.] I am working on implementing HTTPProxy for TCP connections in an on-prem solution with no load balancer. Your examples have helped me to get started, however, I find the instructions are not clear when it comes to TCP in bare metal situations with no load balancer. I was not able to understand how to apply the host network instructions in testing HTTP proxy

I applied kubectl apply -f https://projectcontour.io/quickstart/contour.yaml

and deployed kuard application as well.

my DAG application shows listeners:443 -> service:service-port

I can connect to service:service-port and it reaches my application, but when I connect to fqdn:443, I get connection closed. I defined fqdn hostname to be 127.0.0.1 or also the 192.168.. address of my VM where I am trying to apply these. Both didn't work.

I run a single node kubernetes cluster and my services/pods are deployed directly in master node

What did you expect to happen:

I expected the connection to be forwarded to service and then forwarded to my pod.

Anything else you would like to add: [Miscellaneous information that will assist in solving the issue.]

A sample yaml I use.

apiVersion: v1
kind: Service
metadata:
  name: example-service
  labels:
    app: example-app
spec:
  selector:
    app: example-app
  ports:
    - name: svc-jdbc-non-rmi
      port: 8996
      targetPort: jdbc-non-rmi
      protocol: TCP
    - name: svc-webservices
      port: 8090
      targetPort: 9090
---
apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
  name: webcontainer-proxy
spec:
  virtualhost:
    fqdn: example-webcontainer     
  routes:
    - conditions: 
      - prefix: / 
      services:
        - name: example-service
          port: 8090
---              
apiVersion: projectcontour.io/v1
kind: HTTPProxy
metadata:
  name: jdbc-non-rmi-proxy
spec:
  virtualhost:
    fqdn: example-jdbc-non-rmi     
    tls:
      #secretName: default/default-ssl-certificate
      #secretName: example-ssl-certificate
      passthrough: true         
  tcpproxy:
    services:
    - name: example-service
      port: 8996
---

Contour-DAG: contour-dag

Environment:

  • Contour version: latest
  • Kubernetes version: (use kubectl version): Client Version: v1.18.3 Server Version: v1.18.3
  • Kubernetes installer & version:
  • Cloud provider or hardware configuration: On Prem
  • OS (e.g. from /etc/os-release): Ubuntu 20.04 LTS running in Virtual box with Windows 10 host

senthilrameshjv avatar Jun 18 '20 16:06 senthilrameshjv