---
title: "XDR for Aerospike on Kubernetes"
description: "Guide to configuring Aerospike cross-datacenter replication (XDR) on Kubernetes using the AerospikeCluster CR."
---

# XDR for Aerospike on Kubernetes

> For the complete documentation index see: [llms.txt](https://aerospike.com/docs/llms.txt)
> 
> All documentation pages available in markdown.

This page explains how to configure an Aerospike cluster as a cross-datacenter replication (XDR) source by editing the `AerospikeCluster` custom resource (CR). Add the remote datacenter settings under `aerospikeConfig.xdr.dcs`, then apply the CR to create the XDR configuration.

For more information, see [the documentation on cross-datacenter replication (XDR)](https://aerospike.com/docs/database/learn/architecture/xdr).

::: note
If a change to an XDR-related parameter requires mounting a new volume, AKO performs a cold restart.
:::

## Configure XDR and add a remote datacenter

This example is the XDR-specific configuration section for the Aerospike cluster CR file.

```yaml
spec:

  storage:

    filesystemVolumePolicy:

      cascadeDelete: true

      initMethod: deleteFiles

    volumes:

      - name: workdir

        aerospike:

          path: /opt/aerospike

        source:

          persistentVolume:

            storageClass: ssd

            volumeMode: Filesystem

            size: 1Gi

      - name: ns

        aerospike:

          path: /opt/aerospike/data

        source:

          persistentVolume:

            storageClass: ssd

            volumeMode: Filesystem

            size: 3Gi

      - name: aerospike-config-secret

        source:

          secret:

            secretName: aerospike-secret

        aerospike:

          path: /etc/aerospike/secret

  aerospikeConfig:

    service:

      feature-key-file: /etc/aerospike/secret/features.conf

    security: {}

    network:

      service:

        port: 3000

      fabric:

        port: 3001

      heartbeat:

        port: 3002

    xdr:

      dcs:

        - name: dc1

          node-address-ports:

            - DESTINATION_CLUSTER_AEROSPIKE_NODE_IP PORT     # Remote DC seed node IP, port, TLS name if configured

          auth-user: admin

          auth-password-file: /etc/aerospike/secret/password_DC1.txt     # Remote DC password file

          auth-mode: internal

          namespaces:

            - name: test

    namespaces:

      - name: test

        replication-factor: 2

        storage-engine:

          type: device

          files:

            - /opt/aerospike/data/test.dat

          filesize: 2000000000
```

For the full CR file, see the [example XDR CR](https://github.com/aerospike/aerospike-kubernetes-operator/blob/v4.4.1/config/samples/xdr_src_cluster_cr.yaml).

This and other example CRs are available in [the main Aerospike Kubernetes Operator repository](https://github.com/aerospike/aerospike-kubernetes-operator/tree/v4.4.1/config/samples).

If the destination cluster has security enabled, add `password_DC1.txt` to the mounted `aerospike-secret` before applying the CR. The file must contain the password for the destination datacenter user:

password\_DC1.txt

```txt
passwordForDC1
```

Apply the updated CR:

Terminal window

```shell
kubectl apply -f aerospike-cluster.yaml
```

Verify that AKO applied the XDR configuration:

Terminal window

```shell
kubectl describe aerospikecluster AEROSPIKE_CLUSTER_NAME -n NAMESPACE
```

Check `Status > Aerospike Config > XDR` and confirm that the remote datacenter appears under `DCs`.

## Server versions

Aerospike Database instances in different destination clusters can run different versions of the database. For example, if you have clusters running Database 6.0, you can add a new cluster with the [latest version](https://aerospike.com/products/database/) and preserve XDR functionality.