-
Notifications
You must be signed in to change notification settings - Fork 718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document how to set up remote clusters across k8s boundaries #2593
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
30957b9
Document how to set up remote clusters across k8s boundaries
pebrc 77c4b45
Remove redundant cluster
pebrc c1e2a54
Fix example
pebrc d3800ff
Update docs/remote-clusters.asciidoc
pebrc cdcc166
Update docs/remote-clusters.asciidoc
pebrc 53546ab
Update docs/remote-clusters.asciidoc
pebrc c8a06ae
Update docs/remote-clusters.asciidoc
pebrc 033140c
Update docs/remote-clusters.asciidoc
pebrc c2e5e9c
Update docs/remote-clusters.asciidoc
pebrc c1d7ced
Update docs/remote-clusters.asciidoc
pebrc bc32c85
Update docs/remote-clusters.asciidoc
pebrc 84faff7
Update docs/remote-clusters.asciidoc
pebrc d6cc473
Update docs/remote-clusters.asciidoc
pebrc e966efc
Update docs/remote-clusters.asciidoc
pebrc f4bdcce
Update docs/remote-clusters.asciidoc
pebrc aadb778
Update docs/remote-clusters.asciidoc
pebrc e87de6c
Update docs/remote-clusters.asciidoc
pebrc 8201693
Update docs/remote-clusters.asciidoc
pebrc 1bd5c84
Update docs/remote-clusters.asciidoc
pebrc 485a6e2
Update docs/remote-clusters.asciidoc
pebrc 5200fff
use variable for ES version
pebrc fa56b77
consistent hyphenation
pebrc 8649622
additional review input
pebrc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
ifdef::env-github[] | ||
**** | ||
link:https://www.elastic.co/guide/en/cloud-on-k8s/master/k8s-remote-clusters.html[View this document on the Elastic website] | ||
**** | ||
endif::[] | ||
[id="{p}-remote-clusters"] | ||
=== Remote clusters | ||
|
||
The link:https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-remote-clusters.html[remote clusters module] in Elasticsearch enables you to establish uni-directional connections to a remote cluster. This functionality is used in cross-cluster replication and cross-cluster search. | ||
|
||
When using remote cluster connections with ECK, the setup process depends on where the remote cluster is deployed. | ||
|
||
[id="{p}-remote-clusters-connect-internal"] | ||
==== Connect from an Elasticsearch cluster running in the same Kubernetes cluster | ||
|
||
TBD | ||
|
||
[id="{p}-remote-clusters-connect-external"] | ||
==== Connect from an Elasticsearch cluster running outside the Kubernetes cluster | ||
|
||
NOTE: While it is technically possible to configure remote cluster connections using older versions of Elasticsearch, this guide only covers the setup for Elasticsearch 7.6 and later. The setup process is significantly simplified in Elasticsearch 7.6 due to improved support for the indirection of Kubernetes services. | ||
|
||
You can configure a remote cluster connection to an ECK-managed Elasticsearch cluster from another cluster running outside the Kubernetes cluster as follows: | ||
|
||
. Ensure that both clusters trust each other's certificate authority. | ||
. Configure the remote cluster connection via the Elasticsearch REST API. | ||
|
||
For illustration purposes, consider the following example: | ||
|
||
* `cluster-one` resides inside Kubernetes and is managed by ECK | ||
* `cluster-two` is not hosted inside the same Kubernetes cluster as `cluster-one` and may not even be managed by ECK | ||
|
||
To configure `cluster-one` as a remote cluster in `cluster-two`: | ||
|
||
|
||
===== Ensure both clusters trust each others certificate authority | ||
|
||
The certificate authority (CA) used by ECK to issue certificates for the Elasticsearch transport layer is stored in a secret named `<cluster_name>-es-transport-certs-public`. Extract the certificate for `cluster-one` as follows: | ||
|
||
[source,sh] | ||
---- | ||
kubectl get secret cluster-one-es-transport-certs-public \ | ||
-o go-template='{{index .data "ca.crt" | base64decode}}' > remote.ca.crt | ||
charith-elastic marked this conversation as resolved.
Show resolved
Hide resolved
|
||
---- | ||
|
||
You then need to configure the CA as one of the trusted CAs in `cluster-two`. If that cluster is hosted outside of Kubernetes, simply add the CA certificate extracted in the above step to the list of CAs in link:https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html#_pem_encoded_files_3[`xpack.security.transport.ssl.certificate_authorities`]. | ||
|
||
If `cluster-two` is also managed by an ECK instance, proceed as follows: | ||
|
||
Create a secret with the CA certificate you just extracted: | ||
[source,sh] | ||
---- | ||
kubectl create secret generic remote-certs --from-file=remote.ca.crt | ||
---- | ||
|
||
Use this secret to configure `cluster-one`'s CA as a trusted CA in `cluster-two`: | ||
|
||
[source,yaml,subs="attributes"] | ||
---- | ||
apiVersion: elasticsearch.k8s.elastic.co/{eck_crd_version} | ||
kind: Elasticsearch | ||
metadata: | ||
name: cluster-two | ||
spec: | ||
nodeSets: | ||
- config: | ||
xpack.security.transport.ssl.certificate_authorities: | ||
- /usr/share/elasticsearch/config/other/remote.ca.crt | ||
pebrc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
count: 3 | ||
name: default | ||
podTemplate: | ||
spec: | ||
containers: | ||
- name: elasticsearch | ||
volumeMounts: | ||
- mountPath: /usr/share/elasticsearch/config/other | ||
name: remote-certs | ||
volumes: | ||
- name: remote-certs | ||
secret: | ||
secretName: remote-certs | ||
version: {version} | ||
---- | ||
|
||
Repeat the above steps to add the CA of `cluster-two` to `cluster-one` as well. | ||
|
||
===== Configure the remote cluster connection via the Elasticsearch REST API | ||
|
||
Expose the transport layer of `cluster-one`. | ||
|
||
[source,yaml] | ||
---- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: cluster-one-es-transport | ||
spec: | ||
selector: | ||
common.k8s.elastic.co/type: elasticsearch | ||
elasticsearch.k8s.elastic.co/cluster-name: cluster-one | ||
type: LoadBalancer <1> | ||
ports: | ||
- protocol: TCP | ||
port: 9300 | ||
targetPort: 9300 | ||
---- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will be redundant once we have #2543 |
||
<1> On cloud providers which support external load balancers, setting the type field to LoadBalancer provisions a load balancer for your Service. Alternatively expose the service via a Kubernetes link:https://kubernetes.io/docs/concepts/services-networking/ingress/[Ingress]. | ||
|
||
Finally, configure `cluster-one` as a remote cluster in `cluster-two` using the Elasticsearch REST API: | ||
|
||
[source,sh] | ||
---- | ||
PUT _cluster/settings | ||
{ | ||
"persistent": { | ||
"cluster": { | ||
"remote": { | ||
"cluster-one": { | ||
"mode": "proxy", <1> | ||
"proxy_address": "${LOADBALANCER_IP}:9300" <2> | ||
} | ||
} | ||
} | ||
} | ||
} | ||
---- | ||
<1> Use "proxy" mode as `cluster-two` will be connecting to `cluster-one` through the Kubernetes service abstraction. | ||
<2> Replace `${LOADBALANCER_IP}` with the IP address assigned to the `LoadBalancer` configured above. if you have configured a DNS entry for the service, you can use the DNS name instead of the IP address as well. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can probably be a bullet point instead of a heading
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's only two of them though with significant amount of text in between, so I think it might be kind of far apart for bullets, right?