|
| 1 | +# Start ArangoDB Cluster to Cluster Synchronization on Kubernetes |
| 2 | + |
| 3 | +This tutorial guides you through the steps needed to configure |
| 4 | +an ArangoDB datacenter to datacenter replication between two ArangoDB |
| 5 | +clusters running in Kubernetes. |
| 6 | + |
| 7 | +## Requirements |
| 8 | + |
| 9 | +1. This tutorial assumes that you have 2 ArangoDB clusters running in 2 different Kubernetes clusters. |
| 10 | +1. Both Kubernetes clusters are equipped with support for `Services` of type `LoadBalancer`. |
| 11 | +1. You can create (global) DNS names for configured `Services` with low propagation times. E.g. use Cloudflare. |
| 12 | +1. You have 4 DNS names available: |
| 13 | + - One for the database in the source ArangoDB cluster. E.g. `src-db.mycompany.com` |
| 14 | + - One for the ArangoDB syncmasters in the source ArangoDB cluster. E.g. `src-sync.mycompany.com` |
| 15 | + - One for the database in the destination ArangoDB cluster. E.g. `dst-db.mycompany.com` |
| 16 | + - One for the ArangoDB syncmasters in the destination ArangoDB cluster. E.g. `dst-sync.mycompany.com` |
| 17 | + |
| 18 | +## Step 1: Enable Datacenter Replication Support on source ArangoDB cluster |
| 19 | + |
| 20 | +Set your current Kubernetes context to the Kubernetes source cluster. |
| 21 | + |
| 22 | +Edit the `ArangoDeployment` of the source ArangoDB clusters. |
| 23 | + |
| 24 | +Set: |
| 25 | + |
| 26 | +- `spec.tls.altNames` to `["src-db.mycompany.com"]` (can include more names / IP addresses) |
| 27 | +- `spec.sync.enabled` to `true` |
| 28 | +- `spec.sync.externalAccess.masterEndpoint` to `["https://src-sync.mycompany.com:8629"]` |
| 29 | +- `spec.sync.externalAccess.accessPackageSecretNames` to `["src-accesspackage"]` |
| 30 | + |
| 31 | +## Step 2: Extract access-package from source ArangoDB cluster |
| 32 | + |
| 33 | +Run: |
| 34 | + |
| 35 | +```bash |
| 36 | +kubectl get secret src-accesspackage --template='{{index .data "accessPackage.yaml"}}' | \ |
| 37 | + base64 -D > accessPackage.yaml |
| 38 | +``` |
| 39 | + |
| 40 | +## Step 3: Configure source DNS names |
| 41 | + |
| 42 | +Run: |
| 43 | + |
| 44 | +```bash |
| 45 | +kubectl get service |
| 46 | +``` |
| 47 | + |
| 48 | +Find the IP address contained in the `LoadBalancer` column for the following `Services`: |
| 49 | + |
| 50 | +- `<deployment-name>-ea` Use this IP address for the `src-db.mycompany.com` DNS name. |
| 51 | +- `<deployment-name>-sync` Use this IP address for the `src-sync.mycompany.com` DNS name. |
| 52 | + |
| 53 | +The process for configuring DNS names is specific to each DNS provider. |
| 54 | + |
| 55 | +## Step 4: Enable Datacenter Replication Support on destination ArangoDB cluster |
| 56 | + |
| 57 | +Set your current Kubernetes context to the Kubernetes destination cluster. |
| 58 | + |
| 59 | +Edit the `ArangoDeployment` of the source ArangoDB clusters. |
| 60 | + |
| 61 | +Set: |
| 62 | + |
| 63 | +- `spec.tls.altNames` to `["dst-db.mycompany.com"]` (can include more names / IP addresses) |
| 64 | +- `spec.sync.enabled` to `true` |
| 65 | +- `spec.sync.externalAccess.masterEndpoint` to `["https://dst-sync.mycompany.com:8629"]` |
| 66 | + |
| 67 | +## Step 5: Import access package in destination cluster |
| 68 | + |
| 69 | +Run: |
| 70 | + |
| 71 | +```bash |
| 72 | +kubectl apply -f accessPackage.yaml |
| 73 | +``` |
| 74 | + |
| 75 | +Note: This imports two `Secrets`, containing TLS information about the source cluster, |
| 76 | +into the destination cluster |
| 77 | + |
| 78 | +## Step 6: Configure destination DNS names |
| 79 | + |
| 80 | +Run: |
| 81 | + |
| 82 | +```bash |
| 83 | +kubectl get service |
| 84 | +``` |
| 85 | + |
| 86 | +Find the IP address contained in the `LoadBalancer` column for the following `Services`: |
| 87 | + |
| 88 | +- `<deployment-name>-ea` Use this IP address for the `dst-db.mycompany.com` DNS name. |
| 89 | +- `<deployment-name>-sync` Use this IP address for the `dst-sync.mycompany.com` DNS name. |
| 90 | + |
| 91 | +The process for configuring DNS names is specific to each DNS provider. |
| 92 | + |
| 93 | +## Step 7: Create an `ArangoDeploymentReplication` resource |
| 94 | + |
| 95 | +Create a yaml file (e.g. called `src-to-dst-repl.yaml`) with the following content: |
| 96 | + |
| 97 | +```yaml |
| 98 | +apiVersion: "replication.database.arangodb.com/v1alpha" |
| 99 | +kind: "ArangoDeploymentReplication" |
| 100 | +metadata: |
| 101 | + name: "replication-src-to-dst" |
| 102 | +spec: |
| 103 | + source: |
| 104 | + masterEndpoint: ["https://src-sync.mycompany.com:8629"] |
| 105 | + auth: |
| 106 | + keyfileSecretName: src-accesspackage-auth |
| 107 | + tls: |
| 108 | + caSecretName: src-accesspackage-ca |
| 109 | + destination: |
| 110 | + deploymentName: <dst-deployment-name> |
| 111 | +``` |
| 112 | +
|
| 113 | +## Step 8: Wait for DNS names to propagate |
| 114 | +
|
| 115 | +Wait until the DNS names configured in step 3 and 6 resolve to their configured |
| 116 | +IP addresses. |
| 117 | +
|
| 118 | +Depending on your DNS provides this can take a few minutes up to 24 hours. |
| 119 | +
|
| 120 | +## Step 9: Activate replication |
| 121 | +
|
| 122 | +Run: |
| 123 | +
|
| 124 | +```bash |
| 125 | +kubectl apply -f src-to-dst-repl.yaml |
| 126 | +``` |
| 127 | + |
| 128 | +Replication from the source cluster to the destination cluster will now be configured. |
| 129 | + |
| 130 | +Check the status of the replication by inspecting the status of the `ArangoDeploymentReplication` resource using: |
| 131 | + |
| 132 | +```bash |
| 133 | +kubectl describe ArangoDeploymentReplication replication-src-to-dst |
| 134 | +``` |
| 135 | + |
| 136 | +As soon as the replication is configured, the `Add collection` button in the `Collections` |
| 137 | +page of the web UI (of the destination cluster) will be grayed out. |
0 commit comments