# Hi, I want to configure opensearch cross cluster replication across two different k8s clusters. How can i achieve this and i am using the 2.6.0 version of Opensearch

**URL:** <https://forum.opensearch.org/t/hi-i-want-to-configure-opensearch-cross-cluster-replication-across-two-different-k8s-clusters-how-can-i-achieve-this-and-i-am-using-the-2-6-0-version-of-opensearch/22257>\
**Category:** OpenSearch\
**Tags:** troubleshoot, configure\
**Created:** [October 31, 2024, 12:57pm UTC](https://forum.opensearch.org/t/hi-i-want-to-configure-opensearch-cross-cluster-replication-across-two-different-k8s-clusters-how-can-i-achieve-this-and-i-am-using-the-2-6-0-version-of-opensearch/22257 "2024-10-31T12:57:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zainakram](https://avatars.discourse-cdn.com/v4/letter/z/439d5e/32.png) [@zainakram](https://forum.opensearch.org/u/zainakram)\
**Post date:** [October 31, 2024, 12:57pm UTC](https://forum.opensearch.org/t/hi-i-want-to-configure-opensearch-cross-cluster-replication-across-two-different-k8s-clusters-how-can-i-achieve-this-and-i-am-using-the-2-6-0-version-of-opensearch/22257/1 "2024-10-31T12:57:01Z")

</div>

Opensearch cross cluster replication

---

<div class="post-metadata">

**Author:** ![Mantas](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@Mantas](https://forum.opensearch.org/u/Mantas)\
**Post date:** [October 31, 2024, 4:50pm UTC](https://forum.opensearch.org/t/hi-i-want-to-configure-opensearch-cross-cluster-replication-across-two-different-k8s-clusters-how-can-i-achieve-this-and-i-am-using-the-2-6-0-version-of-opensearch/22257/2 "2024-10-31T16:50:32Z")

</div>

Hi @zainakram,

Have you checked Docs?

> **[Getting started](https://opensearch.org/docs/latest/tuning-your-cluster/replication-plugin/getting-started/)**
>
> Getting started with cross-cluster replication

Best,  
mj

---

<div class="post-metadata">

**Author:** ![zainakram](https://avatars.discourse-cdn.com/v4/letter/z/439d5e/32.png) [@zainakram](https://forum.opensearch.org/u/zainakram)\
**Post date:** [November 14, 2024, 10:48am UTC](https://forum.opensearch.org/t/hi-i-want-to-configure-opensearch-cross-cluster-replication-across-two-different-k8s-clusters-how-can-i-achieve-this-and-i-am-using-the-2-6-0-version-of-opensearch/22257/3 "2024-11-14T10:48:24Z")

</div>

yes @Mantas I have gone through this documentation but I am unable to achieve the cross cluster replication on two k8s clusters.

---

<div class="post-metadata">

**Author:** ![Mantas](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@Mantas](https://forum.opensearch.org/u/Mantas)\
**Post date:** [November 15, 2024, 3:54pm UTC](https://forum.opensearch.org/t/hi-i-want-to-configure-opensearch-cross-cluster-replication-across-two-different-k8s-clusters-how-can-i-achieve-this-and-i-am-using-the-2-6-0-version-of-opensearch/22257/4 "2024-11-15T15:54:08Z")

</div>

Would you mind elaborate a bit more? Any errors? what exactly is not working, and what steps did you already take?

thanks,  
mj

---

<div class="post-metadata">

**Author:** ![zainakram](https://avatars.discourse-cdn.com/v4/letter/z/439d5e/32.png) [@zainakram](https://forum.opensearch.org/u/zainakram)\
**Post date:** [November 19, 2024, 6:41am UTC](https://forum.opensearch.org/t/hi-i-want-to-configure-opensearch-cross-cluster-replication-across-two-different-k8s-clusters-how-can-i-achieve-this-and-i-am-using-the-2-6-0-version-of-opensearch/22257/5 "2024-11-19T06:41:40Z")

</div>

hi @Mantas following are my config files of opensearch for DC-1 and DC-2

DC-1  
cat opensearch-configmap.yaml

```auto
apiVersion: v1
kind: ConfigMap
metadata:
  name: opensearch-config
  namespace: elk
data:
  opensearch.yml: |
    cluster.name: "dc1-cluster"
    node.name: "opensearch-leader"
    node.attr.zone: "dc1"
    network.host: "0.0.0.0"
    discovery.seed_hosts: ["10.142.0.3"]
    cluster.initial_cluster_manager_nodes: ["opensearch-leader"]
    cluster.remote.dc2-cluster.seeds: ["10.142.0.7:32088"]
    http.port: 9200
    transport.port: 9300

```

cat opensearch-deployment.yaml

```auto
apiVersion: apps/v1
kind: Deployment
metadata:
  name: opensearch-leader
  labels:
    app: opensearch-leader
spec:
  replicas: 1 # Adjust for more nodes in the cluster
  selector:
    matchLabels:
      app: opensearch-leader
  template:
    metadata:
      labels:
        app: opensearch-leader
    spec:
      containers:
      - name: opensearch
        image: opensearchproject/opensearch:2.6.0 # Docker image
        env:
        - name: plugins.security.disabled
          value: "true" # Disable security plugin if not needed
        ports:
        - containerPort: 9200 # HTTP port
        - containerPort: 9600 # Performance Analyzer port
        - containerPort: 9300 # Transport port for CCR
        volumeMounts:
        - name: config-volume
          mountPath: /usr/share/opensearch/config/opensearch.yml
          subPath: opensearch.yml
        resources:
          limits:
            memory: "2Gi"
            cpu: "1000m"
          requests:
            memory: "1Gi"
            cpu: "500m"
      volumes:
      - name: config-volume
        configMap:
          name: opensearch-config # Reference to the ConfigMap you created

```

cat opensearch-service.yaml

```auto
apiVersion: v1
kind: Service
metadata:
  name: opensearch-leader-service
spec:
  selector:
    app: opensearch-leader
  ports:
    - name: http
      protocol: TCP
      port: 9200
      targetPort: 9200
    - name: transport
      protocol: TCP
      port: 9300
      targetPort: 9300 # Expose the transport port for cross-cluster communication
  type: NodePort # Changed from NodePort to LoadBalancer

```

DC-2

cat opensearch-configmap.yaml

```auto
apiVersion: v1
kind: ConfigMap
metadata:
  name: opensearch-config
  namespace: elk
data:
  opensearch.yml: |
    cluster.name: "dc2-cluster"
    node.name: "opensearch-follower"
    node.attr.zone: "dc2"
    network.host: "0.0.0.0"
    discovery.seed_hosts: ["10.142.0.3", "10.142.0.7"]
    cluster.initial_cluster_manager_nodes: ["opensearch-follower"]
    cluster.remote.dc1-cluster.seeds: ["104.196.41.2:32462"]
    http.port: 9200
    transport.port: 9300

```

cat opensearch-deployment.yaml

```auto
apiVersion: apps/v1
kind: Deployment
metadata:
  name: opensearch-follower
  labels:
    app: opensearch-follower
spec:
  replicas: 1 # Adjust for more nodes in the cluster
  selector:
    matchLabels:
      app: opensearch-follower
  template:
    metadata:
      labels:
        app: opensearch-follower
    spec:
      containers:
      - name: opensearch
        image: opensearchproject/opensearch:2.6.0 # Docker image
        env:
        - name: plugins.security.disabled
          value: "true" # Disable security plugin if not needed
        ports:
        - containerPort: 9200 # HTTP port
        - containerPort: 9600 # Performance Analyzer port
        - containerPort: 9300 # Transport port for CCR
        volumeMounts:
        - name: config-volume
          mountPath: /usr/share/opensearch/config/opensearch.yml
          subPath: opensearch.yml
        resources:
          limits:
            memory: "2Gi"
            cpu: "1000m"
          requests:
            memory: "1Gi"
            cpu: "500m"
      volumes:
      - name: config-volume
        configMap:
          name: opensearch-config # Reference to the ConfigMap you created

```

cat opensearch-service.yaml

```auto
apiVersion: v1
kind: Service
metadata:
  name: opensearch-follower-service
spec:
  selector:
    app: opensearch-follower
  ports:
    - name: http
      protocol: TCP
      port: 9200
      targetPort: 9200
    - name: transport
      protocol: TCP
      port: 9300
      targetPort: 9300 # Expose the transport port for cross-cluster communication
  type: NodePort # Or LoadBalancer depending on your setup

```

after applying these files i am getting the following error in the logs of Opensearch for both pods of DC-1 and DC-2

```auto
[2024-11-19T05:25:43,402][INFO][o.o.t.TransportService] [opensearch-follower] publish_address {192.168.217.109:9300}, bound_addresses {[::]:9300}
[2024-11-19T05:26:13,443][WARN][o.o.t.RemoteClusterService] [opensearch-follower] failed to connect to remote clusters within 30s
[2024-11-19T05:26:13,503][WARN][o.o.t.SniffConnectionStrategy] [opensearch-follower] fetching nodes from external cluster [dc1-cluster] failed
org.opensearch.transport.ConnectTransportException: [][104.196.41.2:32462] connect_timeout[30s]
        at org.opensearch.transport.TcpTransport$ChannelsConnectedListener.onTimeout(TcpTransport.java:1082) ~[opensearch-2.6.0.jar:2.6.0]
        at org.opensearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:747) ~[opensearch-2.6.0.jar:2.6.0]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
        at java.lang.Thread.run(Thread.java:833) [?:?]

```

---

<div class="post-metadata">

**Author:** ![Mantas](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@Mantas](https://forum.opensearch.org/u/Mantas)\
**Post date:** [December 6, 2024, 5:39pm UTC](https://forum.opensearch.org/t/hi-i-want-to-configure-opensearch-cross-cluster-replication-across-two-different-k8s-clusters-how-can-i-achieve-this-and-i-am-using-the-2-6-0-version-of-opensearch/22257/6 "2024-12-06T17:39:06Z")

</div>

@zainakram, thanks for sharing. Ill run some tests in my lab and get back to you if I find something.

best,  
mj
