TCPingress mongodb

Hi,

I have a mongodb deployment on my k8s cluster.

I want to expose the service via the kong tcpingress.


apiVersion: configuration.konghq.com/v1beta1
kind: TCPIngress
metadata:
  annotations:
    certmanager.k8s.io/cluster-issuer: letsencrypt-production-issuer
    kubernetes.io/ingress.class: "kong"
    nginx.ingress.kubernetes.io/use-regex: "true"
    konghq.com/strip-path: "true"
  name: ingress-mongodb
  namespace: mongodb
spec:
  rules:
    - host: HOST 
      backend:
        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'  :
connect@src/mongo/shell/mongo.js:374:17
@(connect):2:6
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

Same for me, please somebody help ?

I think you might need to add

- name: KONG_STREAM_LISTEN
          value: "0.0.0.0:27017"

To the environment of the proxy container of the ingress-kong pod.

1 Like

thank you so much ! it works


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ