title: How access MongoDB in Kubernetes from outside the cluster
body: <p>I deployed mongodb in a Kubernetes cluster with this helm chart : <a href="https://github.com/helm/charts/tree/master/stable/mongodb" rel="noreferrer">https://github.com/helm/charts/tree/master/stable/mongodb</a>. All is right. I can connect to mongo from within a replicatset container or from outside the cluster with a port-forward, or with a NodePort service. But I can't connect via an ingress.</p>
  
  <p>When the ingress is deployed, I can curl mongodb and have this famous message : "It looks like you are trying to access MongoDB over HTTP on the native driver port.". But I can't connect with a mongo client, the connection stucks and I can see in mongodb logs that I never reach mongo.</p>
  
  <p>Does someone have any information about accessing mongodb via an ingress object ? Maybe it's a protocol problem ?</p>
  
  <p>The ingress manifests :</p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    name: {{ template "mongodb.fullname" . }}
    annotations:
      kubernetes.io/ingress.class: traefik
  spec:
    rules:
    - host: {{ .Values.ingress.hostName }}
      http:
        paths:
          - path: /
            backend:
              serviceName: "{{ template "mongodb.fullname" $ }}"
              servicePort: mongodb
    tls:
    - hosts:
      - {{ .Values.ingress.hostName }}
      secretName: secret
  </code></pre>
  
  <p>Thank you very much !</p>