# splitHorizon DNS?

**URL:** <https://forums.percona.com/t/splithorizon-dns/20205>\
**Category:** Percona Operator for MongoDB\
**Created:** [February 20, 2023, 11:28pm UTC](https://forums.percona.com/t/splithorizon-dns/20205 "2023-02-20T23:28:25Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![rdxmbr](https://avatars.discourse-cdn.com/v4/letter/r/c2a13f/32.png) [@rdxmbr](https://forums.percona.com/u/rdxmbr)\
**Post date:** [February 20, 2023, 11:28pm UTC](https://forums.percona.com/t/splithorizon-dns/20205/1 "2023-02-20T23:28:25Z")

</div>

Hello,

I think about switching from MongoDBCommunity-Operator to the Percona MongoDB Operator. However, I need the splitHorizon for DNS, like it is documented here: [Connect to a MongoDB Database Resource from Outside Kubernetes — MongoDB Kubernetes Operator upcoming](https://www.mongodb.com/docs/kubernetes-operator/master/tutorial/connect-from-outside-k8s/#confirm-the-external-hostnames-and-nodeport-values-in-your-replica-set-resource)

Does the Percona MongoDB Operator include this feature?

Thanks and kind regards.

Marc

---

<div class="post-metadata">

**Author:** ![Sergey\_Pronin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_pronin/32/14887_2.png) [@Sergey\_Pronin](https://forums.percona.com/u/Sergey_Pronin)\
**Post date:** [February 21, 2023, 10:44am UTC](https://forums.percona.com/t/splithorizon-dns/20205/2 "2023-02-21T10:44:14Z")

</div>

Hey @rdxmbr,

the article you shared talks about exposing mongodb outside of k8s. We for sure do support it. Read more here: [Exposing the cluster - Percona Operator for MongoDB](https://docs.percona.com/percona-operator-for-mongodb/expose.html)

---

<div class="post-metadata">

**Author:** ![rdxmbr](https://avatars.discourse-cdn.com/v4/letter/r/c2a13f/32.png) [@rdxmbr](https://forums.percona.com/u/rdxmbr)\
**Post date:** [February 22, 2023, 11:59am UTC](https://forums.percona.com/t/splithorizon-dns/20205/3 "2023-02-22T11:59:37Z")

</div>

Thanks, @Sergey_Pronin

I had just read that. However, for this we need additional LoadBalancer-IPs or NodePorts.

With splitHorizon, it is possible to route the external traffic via [traefik](https://doc.traefik.io/traefik/) with [IngressRouteTCP](https://doc.traefik.io/traefik/routing/providers/kubernetes-crd/#kind-ingressroutetcp)

This way it is possible to get external access

- via Domains / SNI and TLS-certificates for this domains
- without additional external IPs

I assume, this is not possible with the latest percona operator. Is it?

Kind regards!

---

<div class="post-metadata">

**Author:** ![Sergey\_Pronin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_pronin/32/14887_2.png) [@Sergey\_Pronin](https://forums.percona.com/u/Sergey_Pronin)\
**Post date:** [March 1, 2023, 9:53am UTC](https://forums.percona.com/t/splithorizon-dns/20205/4 "2023-03-01T09:53:15Z")

</div>

Got it! You are right, it is not possible right now.  
Do you use MongoDB Community Operator and rely on this feature?

---

<div class="post-metadata">

**Author:** ![rdxmbr](https://avatars.discourse-cdn.com/v4/letter/r/c2a13f/32.png) [@rdxmbr](https://forums.percona.com/u/rdxmbr)\
**Post date:** [March 6, 2023, 9:21am UTC](https://forums.percona.com/t/splithorizon-dns/20205/5 "2023-03-06T09:21:29Z")

</div>

Hello @Sergey_Pronin  
yes, I do.

---

<div class="post-metadata">

**Author:** ![rdxmbr](https://avatars.discourse-cdn.com/v4/letter/r/c2a13f/32.png) [@rdxmbr](https://forums.percona.com/u/rdxmbr)\
**Post date:** [May 9, 2023, 1:25pm UTC](https://forums.percona.com/t/splithorizon-dns/20205/6 "2023-05-09T13:25:25Z")

</div>

Hello again,

just to get that right: If I use the LoadBalancerIPs to connect to a replicaSet, how does the mongodb-cluster answer with the right LoadBalancerIP for the master instead of answering with the Pod-IP?

Thanks again and kind regards

---

<div class="post-metadata">

**Author:** ![Sergey\_Pronin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_pronin/32/14887_2.png) [@Sergey\_Pronin](https://forums.percona.com/u/Sergey_Pronin)\
**Post date:** [May 19, 2023, 7:42am UTC](https://forums.percona.com/t/splithorizon-dns/20205/7 "2023-05-19T07:42:25Z")

</div>

@rdxmbr seems you are right, and it something that is not properly working in 1.14.0.  
I raised a bug about it: [[K8SPSMDB-929] Can't connect to MongoDB Replica Set via LoadBalancer - Percona JIRA](https://jira.percona.com/browse/K8SPSMDB-929)

There are two ways / workarounds available right now:

1. You can switch to 1.13.0 behavior by setting `clusterServiceDNSMode` to `external`. See more here: [Custom Resource options - Percona Operator for MongoDB](https://docs.percona.com/percona-operator-for-mongodb/operator.html)

2. You can use mongos and a single shard

In the long run I believe we will need to implement proper SplitHorizon. Will work with the team on it.

---

<div class="post-metadata">

**Author:** ![rdxmbr](https://avatars.discourse-cdn.com/v4/letter/r/c2a13f/32.png) [@rdxmbr](https://forums.percona.com/u/rdxmbr)\
**Post date:** [May 22, 2023, 1:32pm UTC](https://forums.percona.com/t/splithorizon-dns/20205/8 "2023-05-22T13:32:34Z")

</div>

Thanks for your information. I’m just testing 2. , seems good until now 👍

---

<div class="post-metadata">

**Author:** ![rdxmbr](https://avatars.discourse-cdn.com/v4/letter/r/c2a13f/32.png) [@rdxmbr](https://forums.percona.com/u/rdxmbr)\
**Post date:** [May 23, 2023, 1:07pm UTC](https://forums.percona.com/t/splithorizon-dns/20205/9 "2023-05-23T13:07:03Z")

</div>

> [@Sergey\_Pronin](#):
>
> You can use mongos and a single shard

There is another point: When using transactions, the connection to the mongos-pods via the k8s-clusterIP seems not to be ideal. As the k8s-services works as a loadBalancer in front of the mongos, the transactions fail. We run into the same issue as [https://jira.mongodb.org/browse/CSHARP-3301](https://jira.mongodb.org/browse/CSHARP-3301)

I am wondering if this would be better with connecting via a headless service, but I haven’t got this working yet.

EDIT: [[K8SPSMDB-931] problems with transactions and mongos - missing headless service in statefulset - Percona JIRA](https://jira.percona.com/browse/K8SPSMDB-931)

---

<div class="post-metadata">

**Author:** ![rdxmbr](https://avatars.discourse-cdn.com/v4/letter/r/c2a13f/32.png) [@rdxmbr](https://forums.percona.com/u/rdxmbr)\
**Post date:** [May 23, 2023, 3:13pm UTC](https://forums.percona.com/t/splithorizon-dns/20205/10 "2023-05-23T15:13:40Z")

</div>

As a workaround we’ve added

```auto
my-cluster-name-mongos-0
my-cluster-name-mongos-1
my-cluster-name-mongos-2
my-cluster-name-mongos-0.default.svc.cluster.local
my-cluster-name-mongos-1.default.svc.cluster.local
my-cluster-name-mongos-2.default.svc.cluster.local

```

to our certificates and configured mongos with

```auto
expose:
  servicePerPod: true

```

Of course, this is not scalable.

---

<div class="post-metadata">

**Author:** ![Sergey\_Pronin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_pronin/32/14887_2.png) [@Sergey\_Pronin](https://forums.percona.com/u/Sergey_Pronin)\
**Post date:** [May 24, 2023, 7:35am UTC](https://forums.percona.com/t/splithorizon-dns/20205/11 "2023-05-24T07:35:55Z")

</div>

Yes, servicePerPod was created exactly for the case where you have long running transactions and they can fall under different cursors / mongos pods.

As for not scalable - what do you mean? Do you mean that if you scale mongos from 3 to 5 nodes your certs will not be there? Or that your application will need reconfiguration?

In our experience mongos sizing is quite static as it is just a proxy and they do not consume a lot of resources, so scaling is rare.

---

<div class="post-metadata">

**Author:** ![rdxmbr](https://avatars.discourse-cdn.com/v4/letter/r/c2a13f/32.png) [@rdxmbr](https://forums.percona.com/u/rdxmbr)\
**Post date:** [May 24, 2023, 9:31am UTC](https://forums.percona.com/t/splithorizon-dns/20205/12 "2023-05-24T09:31:18Z")

</div>

> Do you mean that if you scale mongos from 3 to 5 nodes your certs will not be there?

This.

> In our experience mongos sizing is quite static as it is just a proxy and they do not consume a lot of resources, so scaling is rare.

👍

---

<div class="post-metadata">

**Author:** ![rdxmbr](https://avatars.discourse-cdn.com/v4/letter/r/c2a13f/32.png) [@rdxmbr](https://forums.percona.com/u/rdxmbr)\
**Post date:** [February 19, 2024, 11:43am UTC](https://forums.percona.com/t/splithorizon-dns/20205/13 "2024-02-19T11:43:51Z")

</div>

As with [K8SPSMDB-886 - Update psmdb-db chart for 1.15.0 release · percona/percona-helm-charts@e4416fa · GitHub](https://github.com/percona/percona-helm-charts/commit/e4416fa8738f559d0a2354a31d11a2f7bccb03bb) , splitHorizon has to be included in the meantime?

@Sergey_Pronin

---

<div class="post-metadata">

**Author:** ![Sergey\_Pronin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/sergey_pronin/32/14887_2.png) [@Sergey\_Pronin](https://forums.percona.com/u/Sergey_Pronin)\
**Post date:** [February 22, 2024, 7:39am UTC](https://forums.percona.com/t/splithorizon-dns/20205/14 "2024-02-22T07:39:53Z")

</div>

@rdxmbr they were added into both operator and helm chart. Have you tried it? 🙂

---

<div class="post-metadata">

**Author:** ![Ivan\_Groenewold](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/ivan_groenewold/32/6299_2.png) [@Ivan\_Groenewold](https://forums.percona.com/u/Ivan_Groenewold)\
**Post date:** [July 16, 2025, 1:52pm UTC](https://forums.percona.com/t/splithorizon-dns/20205/15 "2025-07-16T13:52:23Z")

</div>

split Horizon support is available since Operator 1.15.0
