Get external access to mongodb replicatset

I've deployed a mongodb replicatset of 2 nodes into my kubernetes, exposing them using two LoadBalancers in order to get access from outside kubernetes:

$ kubectl get service
NAME                            TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)           AGE
mongodb-0-external              LoadBalancer   10.43.112.251   172.19.0.2    27017:30839/TCP   3h41m
mongodb-1-external              LoadBalancer   10.43.171.198   172.19.0.5    27017:31151/TCP   3h41m

Also, pods are ready:

NAME                                             READY   STATUS    RESTARTS   AGE
mongodb-0                                        1/1     Running   0          3h42m
mongodb-1                                        1/1     Running   0          3h42m
mongodb-arbiter-0                                1/1     Running   30         3h42m

Everything seems working correctly, but I'm not quite reach replicatset from my host.

I've created an ingress for both LoadBalancers, using traefik IngressRouteTCP:

apiVersion: traefik.containo.us/v1alpha1
kind: IngressRouteTCP
metadata:
  name: mongodb-0
spec:
  entryPoints:
  - web
  routes:
  - match: HostSNI(`mongo0.localhost`)
    services:
    - name: mongodb-0-external
      port: 27017
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRouteTCP
metadata:
  name: mongodb-1
spec:
  entryPoints:
  - web
  routes:
  - match: HostSNI(`mongo1.localhost`)
    services:
    - name: mongodb-1-external
      port: 27017

Questions:

  1. Is it correct to create an ingress in front of a LoadBalancer?
  2. How could I trace the travel from my host request?

Any luck on this?

I'm running mongo on docker-compose with traefik and you like to access it externally.

With Traefik you can just use a plain TCP router and service to proxy a binary TCP connection.

Use a dedicated entrypoint (port) with rule HostSNI(`*`). Do not enable any TLS for that entrypoint/router/service.