# How to setup a second elastic cluster

**URL:** <https://discuss.elastic.co/t/how-to-setup-a-second-elastic-cluster/239643>\
**Category:** Elastic Cloud on Kubernetes (ECK)\
**Created:** [July 2, 2020, 1:31pm UTC](https://discuss.elastic.co/t/how-to-setup-a-second-elastic-cluster/239643 "2020-07-02T13:31:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kay\_Khan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kay_khan/32/45028_2.png) [@Kay\_Khan](https://discuss.elastic.co/u/Kay_Khan)\
**Post date:** [July 2, 2020, 1:31pm UTC](https://discuss.elastic.co/t/how-to-setup-a-second-elastic-cluster/239643/1 "2020-07-02T13:31:00Z")

</div>

Hi,

I want to create a second elastic cluster for testing and view the data in Kibana.

My end goal is to setup fluentd so i can store the logs in elastic search and view them on kibana. But i think i should do this on a second elastic cluster to see how it works.

The first/initial elastic cluster was setup uising the following:

```
---
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: es-gp2
provisioner: kubernetes.io/aws-ebs
parameters:
  type: gp2
reclaimPolicy: Delete
---
apiVersion: elasticsearch.k8s.elastic.co/v1beta1
kind: Elasticsearch
metadata:
  name: data-es
spec:
  version: 7.4.2
  spec:
    http:
      tls:
        certificate:
          secretName: es-cert
  nodeSets:
  - name: default
    count: 2
    volumeClaimTemplates:
    - metadata:
        name: es-data
        annotations:
          volume.beta.kubernetes.io/storage-class: es-gp2
      spec:
        accessModes:
        - ReadWriteOnce
        storageClassName: es-gp2
        resources:
          requests:
            storage: 10Gi
    config:
      node.master: true
      node.data: true
      node.ingest: true
      node.store.allow_mmap: false
      xpack.security.authc.realms:
        native:
          native1: 
            order: 1
---
apiVersion: kibana.k8s.elastic.co/v1beta1
kind: Kibana
metadata:
  name: data-kibana
spec:
  version: 7.4.2
  count: 1
  elasticsearchRef:
    name: data-es

```

To what extent, can i (should i) extend the above to have a second elastic cluster.

1. Is it possible for me to simply create a new `kind: Elasticsearch` change the name to something more descriptive of a second cluster e.g cluster-2.
2. Is it possible to point to a new storage for the new cluster-2 ? or should i use the existing storage.
3. Is it possible to use the same kibana instance to view data across multiple clusters because i can see the kibana definition has an `elasticsearchRef` which is a reference to a single cluster.

thank you.

---

<div class="post-metadata">

**Author:** ![defalt](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/defalt/32/71379_2.png) [@defalt](https://discuss.elastic.co/u/defalt)\
**Post date:** [July 2, 2020, 2:17pm UTC](https://discuss.elastic.co/t/how-to-setup-a-second-elastic-cluster/239643/2 "2020-07-02T14:17:04Z")

</div>

You will need a docker or a vm to run multiple elasticsearch nodes on the same pc.

1. You can change the cluster name to your liking. Just change `cluster.name: whatever` in the yml
2. Yes you can point to a new storage `path.data: C:\\path\\to\\your\\data` (On windows)
3. You will have to decide which cluster you want to look at. In the kibana.yml you can set `server.host: "YourElasticIP"` to connect to a different node.

Cheers,  
_defalt_

---

<div class="post-metadata">

**Author:** ![charith-elastic](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@charith-elastic](https://discuss.elastic.co/u/charith-elastic)\
**Post date:** [July 2, 2020, 2:28pm UTC](https://discuss.elastic.co/t/how-to-setup-a-second-elastic-cluster/239643/3 "2020-07-02T14:28:21Z")

</div>

You can create as many Elasticsearch clusters as you like provided that each one has a unique name (`metadata.name`) and there are enough resources (CPU, memory, and disks) available in your Kubernetes cluster.

You can reuse the storage class name (`es-gp2` in this case) as it merely describes parameters for persistent volumes. When the operator is asked to create a new Elasticsearch cluster, it creates new persistent volumes for each node in the cluster using the configuration specified in `volumeClaimTemplates`. You can read more on this at [https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-volume-claim-templates.html](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-volume-claim-templates.html) and [https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-orchestration.html](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-orchestration.html).

You can't connect more than one Elasticsearch cluster to Kibana. You could setup [cross-cluster search](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-cross-cluster-search.html) to search across clusters. However, you seem to be using the beta version of ECK and might need to upgrade to atleast version 1.1.2 to get better support for setting up remote clusters as documented here: [https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-remote-clusters.html](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-remote-clusters.html).

---

<div class="post-metadata">

**Author:** ![Kay\_Khan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kay_khan/32/45028_2.png) [@Kay\_Khan](https://discuss.elastic.co/u/Kay_Khan)\
**Post date:** [July 2, 2020, 2:49pm UTC](https://discuss.elastic.co/t/how-to-setup-a-second-elastic-cluster/239643/4 "2020-07-02T14:49:45Z")

</div>

@ [charith-elastic](https://discuss.elastic.co/u/charith-elastic)

1. When i create a second elasticsearch cluster is there anything else i need to configure or do i just need to change the metadata.name? I am using ECK [https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-deploy-eck.html](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-deploy-eck.html) which i believe does a lot of the heavy lifting. So im wondering if i need to configure something else or will it automatically pick up the second cluster.

Do you have some method i can use to confirm this second cluster is working alongside the first one?

1. How can i upgrade my ECK? [https://www.elastic.co/guide/en/cloud-on-k8s/1.0/k8s-upgrading-eck.html](https://www.elastic.co/guide/en/cloud-on-k8s/1.0/k8s-upgrading-eck.html) This link suggests to just follow the quickstart guide " To upgrade from 1.0.0-beta1, follow the [_Quickstart_](https://www.elastic.co/guide/en/cloud-on-k8s/1.0/k8s-quickstart.html)." . So is it essentially just running?

`kubectl apply -f https://download.elastic.co/downloads/eck/1.1.2/all-in-one.yaml`

After running this do i need to rerun the Kind: Elasticsearch and the service?

---

<div class="post-metadata">

**Author:** ![charith-elastic](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@charith-elastic](https://discuss.elastic.co/u/charith-elastic)\
**Post date:** [July 2, 2020, 3:18pm UTC](https://discuss.elastic.co/t/how-to-setup-a-second-elastic-cluster/239643/5 "2020-07-02T15:18:56Z")

</div>

In this particular case, you can simply make a copy of your existing YAML file containing the Elasticsearch definition, change `metadata.name`, and `kubectl apply` to get a new Elasticsearch cluster identical to your existing one except for the cluster name.

Just in case it wasn't clear, you are not limited to creating a single type of Elasticsearch (or Kibana or APM server) with ECK. You can create as many as you like with differing configurations. That's the advantage of using an operator.

You can update an existing installation by running the `kubectl apply` command as described in the documentation. Existing resources (Elasticsearch, Kibana, APM Server) will continue to work (they may go through a [rolling restart](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-upgrading-eck.html#k8s-beta-to-ga-rolling-restart) though). However, I would advise reading the release notes to make sure there are no breaking changes that affect you, testing the upgrade on a non-production cluster first, and taking backups of your data before upgrading production.

---

<div class="post-metadata">

**Author:** ![Kay\_Khan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kay_khan/32/45028_2.png) [@Kay\_Khan](https://discuss.elastic.co/u/Kay_Khan)\
**Post date:** [July 3, 2020, 10:42am UTC](https://discuss.elastic.co/t/how-to-setup-a-second-elastic-cluster/239643/6 "2020-07-03T10:42:15Z")

</div>

Can you point me to some documentation on how i can backup the existing index's. Also something to note I am using aws volumes as StorageClass. Does that make it easier/harder?

---

<div class="post-metadata">

**Author:** ![charith-elastic](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@charith-elastic](https://discuss.elastic.co/u/charith-elastic)\
**Post date:** [July 6, 2020, 6:27am UTC](https://discuss.elastic.co/t/how-to-setup-a-second-elastic-cluster/239643/7 "2020-07-06T06:27:44Z")

</div>

You can use [snapshot and restore](https://www.elastic.co/guide/en/elasticsearch/reference/current/snapshot-restore.html) to create backups. There is an [example](https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-snapshots.html) in ECK documentation using GCS. You can configure the [S3 repository plugin](https://www.elastic.co/guide/en/elasticsearch/plugins/current/repository-s3.html) in a similar way.

---

<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, 8:04am UTC](https://discuss.elastic.co/t/how-to-setup-a-second-elastic-cluster/239643/8 "2022-11-04T08:04:48Z")

</div>


