Connect database by TCPIngress


I have a mongodb deployment on my k8s cluster.

I want to expose the service via the kong tcpingress.

kind: TCPIngress
  annotations: letsencrypt-production-issuer "kong" "true" "true"
  name: ingress-mongodb
  namespace: mongodb
    - host: HOST 
        serviceName: mongodb-svc
        servicePort: 27017

However when I try to connect to my it I got the following response

mongo --host HOST --username mongodb-admin --password PASSWORD  --port 80
MongoDB shell version v4.4.4
connecting to: mongodb://HOST:80/?compressors=disabled&gssapiServiceName=mongodb
Error: network error while attempting to run command 'isMaster' on host 'HOST:80'  :
exception: connect failed
exiting with code 1

I precise that when I did a port forwarding via kubectl port-forward I can connect.

I suppose that something is wrong with my TCPingress configuration, what am I missing ?

Thanks in advance

kong version : 2.1.4
kong ingress controller : 0.10.0 with  pgsql Database
1 Like

Hi, I have am experiencing this exact same problem. Can anyone of the community provide some help ?
It should be very easy to expose a mongodb or a postgreSQL database through the kong kubernetes ingress.