# How to setup external remote cluster?

**URL:** <https://discuss.elastic.co/t/how-to-setup-external-remote-cluster/222016>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Created:** [March 4, 2020, 8:49am UTC](https://discuss.elastic.co/t/how-to-setup-external-remote-cluster/222016 "2020-03-04T08:49:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matthieu\_Paret](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthieu_paret/32/48133_2.png) [@Matthieu\_Paret](https://discuss.elastic.co/u/Matthieu_Paret)\
**Post date:** [March 4, 2020, 8:49am UTC](https://discuss.elastic.co/t/how-to-setup-external-remote-cluster/222016/1 "2020-03-04T08:49:00Z")

</div>

Hello here,

ECK added support to local remote cluster but how to manually add a remote cluster ? (both are running through ECK) How should we retrieve certificate and inject these into the other cluster ?

Thanks if someone can help 🙂

Matthieu

---

<div class="post-metadata">

**Author:** ![pebrc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pebrc/32/101790_2.png) [@pebrc](https://discuss.elastic.co/u/pebrc)\
**Post date:** [March 4, 2020, 9:01am UTC](https://discuss.elastic.co/t/how-to-setup-external-remote-cluster/222016/2 "2020-03-04T09:01:34Z")

</div>

We have some preliminary documentation here [https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-remote-clusters.html](https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-remote-clusters.html) that should get your started.

I said preliminary because this is for the upcoming 1.1 release of ECK and still work in progress and might change.

---

<div class="post-metadata">

**Author:** ![Matthieu\_Paret](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthieu_paret/32/48133_2.png) [@Matthieu\_Paret](https://discuss.elastic.co/u/Matthieu_Paret)\
**Post date:** [March 4, 2020, 1:09pm UTC](https://discuss.elastic.co/t/how-to-setup-external-remote-cluster/222016/3 "2020-03-04T13:09:49Z")

</div>

Thanks @pebrc, I will try this and let know here if I succeed 🙂

---

<div class="post-metadata">

**Author:** ![Matthieu\_Paret](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthieu_paret/32/48133_2.png) [@Matthieu\_Paret](https://discuss.elastic.co/u/Matthieu_Paret)\
**Post date:** [March 6, 2020, 11:01am UTC](https://discuss.elastic.co/t/how-to-setup-external-remote-cluster/222016/4 "2020-03-06T11:01:33Z")

</div>

I followed the guide:

Its works correctly when the elasticsearch cluster is inside the same cluster k8s.

But I have issues to connect to an external cluster.

- Can we expose the transport service 9300 behind a proxy http (nginx-ingress controller in this case) ? (I tried without success)

- I saw that this transport service seems only used for discovery, after the "master" elasticsearch seems to establish direct connection to each node of the cluster (on port 9200 I suppose ?) . But if the cluster is external, we cannot expose directly the IP of each node, we need to expose these behind a service/load balancer. Is it correct, what is your suggestion ?

Thanks again

---

<div class="post-metadata">

**Author:** ![Anya\_Sabo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anya_sabo/32/49903_2.png) [@Anya\_Sabo](https://discuss.elastic.co/u/Anya_Sabo)\
**Post date:** [March 6, 2020, 4:11pm UTC](https://discuss.elastic.co/t/how-to-setup-external-remote-cluster/222016/5 "2020-03-06T16:11:13Z")

</div>

I haven't tested this set up at all so it might not be useful information, but if you do need to set up a service selecting a single pod, the stateful set controller creates a label you can use. For example `statefulset.kubernetes.io/pod-name=quickstart-es-default-0`.

---

<div class="post-metadata">

**Author:** ![Matthieu\_Paret](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthieu_paret/32/48133_2.png) [@Matthieu\_Paret](https://discuss.elastic.co/u/Matthieu_Paret)\
**Post date:** [March 6, 2020, 5:13pm UTC](https://discuss.elastic.co/t/how-to-setup-external-remote-cluster/222016/6 "2020-03-06T17:13:40Z")

</div>

Thanks for this answer but my issue is not really on selecting a single pod. It is about exposing the service behind an http proxy and how masters connect to nodes of an external remote cluster.

---

<div class="post-metadata">

**Author:** ![pebrc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pebrc/32/101790_2.png) [@pebrc](https://discuss.elastic.co/u/pebrc)\
**Post date:** [March 6, 2020, 8:11pm UTC](https://discuss.elastic.co/t/how-to-setup-external-remote-cluster/222016/7 "2020-03-06T20:11:30Z")

</div>

> [@Matthieu\_Paret](#):
>
> Can we expose the transport service 9300 behind a proxy http (nginx-ingress controller in this case) ? (I tried without success)

Ingress is by definition HTTP only, but we need a TCP "ingress" so to speak for Elasticsearch's transport layer. There are a couple of workarounds though:

- if you are running on one of the hosted k8s offerings e.g. Google's GKE then by far the easiest option is to set the type of the transport service to `LoadBalancer` and you can expose the TCP service in that way
- if you have to use `ingress-nginx` then you have to use the proprietary Nginx feature that allows exposing TCP services. See [Exposing TCP and UDP services - Ingress-Nginx Controller](https://kubernetes.github.io/ingress-nginx/user-guide/exposing-tcp-udp-services/)

> [@Matthieu\_Paret](#):
>
> I saw that this transport service seems only used for discovery, after the "master" elasticsearch seems to establish direct connection to each node of the cluster (on port 9200 I suppose ?) . But if the cluster is external, we cannot expose directly the IP of each node, we need to expose these behind a service/load balancer. Is it correct, what is your suggestion ?

If you look at the link to the documentation draft I shared earlier you will see that we setup the remote cluster connection with `mode: "proxy"` this is a new feature in 7.6 that was built exactly for scenarios like this one where we cannot route to every node in the target cluster directly but only indirectly through a k8s Service/LoadBalancer.

---

<div class="post-metadata">

**Author:** ![Matthieu\_Paret](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthieu_paret/32/48133_2.png) [@Matthieu\_Paret](https://discuss.elastic.co/u/Matthieu_Paret)\
**Post date:** [March 21, 2020, 6:10am UTC](https://discuss.elastic.co/t/how-to-setup-external-remote-cluster/222016/8 "2020-03-21T06:10:37Z")

</div>

I was able to succeed setup external cluster, thanks a lot @pebrc

I am getting sometimes errors about "[indices:data/read/search] disconnected"]" although the proxy tcp load balancer on the remote cluster seems still up.

- In the remote cluster, on the transport service k8s, should I select only some kind of nodes ? (the data nodes ?)
- Is there some timeout options to increase ?

---

<div class="post-metadata">

**Author:** ![Matthieu\_Paret](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matthieu_paret/32/48133_2.png) [@Matthieu\_Paret](https://discuss.elastic.co/u/Matthieu_Paret)\
**Post date:** [March 21, 2020, 6:19am UTC](https://discuss.elastic.co/t/how-to-setup-external-remote-cluster/222016/9 "2020-03-21T06:19:12Z")

</div>

I setup transport.ping\_schedule and it seems better now, I will monitor.  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-transport.html#\_long\_lived\_idle\_connections](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-transport.html#_long_lived_idle_connections)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 4, 2022, 7:47am UTC](https://discuss.elastic.co/t/how-to-setup-external-remote-cluster/222016/10 "2022-11-04T07:47:45Z")

</div>


