{
  "schema_version": 2,
  "id": "operate/kubernetes/active-active/global-db-secret",
  "title": "Set global database secret",
  "url": "https://redis.io/docs/latest/operate/kubernetes/active-active/global-db-secret/",
  "summary": "The REAADB contains the field '.spec.globalConfigurations' to set the global database secret.",
  "tags": [
    "docs",
    "operate",
    "kubernetes"
  ],
  "last_updated": "2026-09-28T15:03:12+01:00",
  "page_type": "content",
  "content_hash": "98173971606148a84a32f85a4fe797f1213fc47cfcbb10da90dcd18e6ef7af9b",
  "sections": [
    {
      "id": "set-global-database-secret",
      "title": "Set global database secret",
      "role": "overview",
      "text": "One of the fields available for `globalConfigurations` is `databaseSecretName` which can point to a secret containing the database password. To set the database secret name and sync the data to all participating clusters, follow the steps below.\n\nTo edit other global configruations, see [global configuration](https://redis.io/docs/latest/operate/kubernetes/active-active/global-config)\n\n1. On an existing participating cluster, generate a YAML file containing the database secret with the database password.\n\n  This example shoes a secret named `my-db-secret` with the password `my-password` encoded in base 64.\n\n  [code example]\n\n1. Apply the secret file from the previous step, substituting your own value for `<db-secret-file>`.\n\n    [code example]\n\n1. Patch the REAADB custom resource to specify the database secret, substituting your own values for `<reaadb-name>` and `<secret-name>`.\n\n    [code example]\n\n1. Check the REAADB status for an `active` status and `Valid` spec status.\n\n    [code example]\n\n1. On each other participating cluster, check the secret status.\n\n    ``sh\n    kubectl get reaadb <reaadb-name> -o=jsonpath='{.status.secretsStatus}'\n    [code example]sh\n    [{\"name\":\"my-db-secret\",\"status\":\"Invalid\"}]\n    [code example]sh\n    kubectl apply -f <db-secret-file>\n    ```\n\n1. Repeat the previous two steps on every participating cluster."
    }
  ],
  "examples": [
    {
      "id": "set-global-database-secret-ex0",
      "language": "yaml",
      "code": "apiVersion: v1\n  data:\n    password: bXktcGFzcw\n  kind: Secret\n  metadata:\n    name: my-db-secret\n  type: Opaque",
      "section_id": "set-global-database-secret"
    },
    {
      "id": "set-global-database-secret-ex1",
      "language": "sh",
      "code": "kubectl apply -f <db-secret-file>",
      "section_id": "set-global-database-secret"
    },
    {
      "id": "set-global-database-secret-ex2",
      "language": "sh",
      "code": "kubectl patch reaadb <reaadb-name> --type merge --patch \\\n    '{\"spec\": {\"globalConfigurations\": {\"databaseSecretName\": \"secret-name\"}}}'",
      "section_id": "set-global-database-secret"
    },
    {
      "id": "set-global-database-secret-ex3",
      "language": "sh",
      "code": "kubectl get reaadb <reaadb-name>\n\n    NAME             STATUS   SPEC STATUS   GLOBAL CONFIGURATIONS REDB   LINKED REDBS\n    example-aadb-1   active   Valid",
      "section_id": "set-global-database-secret"
    },
    {
      "id": "set-global-database-secret-ex4",
      "language": "plaintext",
      "code": "The output should show the status as `Invalid`.",
      "section_id": "set-global-database-secret"
    },
    {
      "id": "set-global-database-secret-ex5",
      "language": "plaintext",
      "code": "1. Sync the secret on each participating cluster.",
      "section_id": "set-global-database-secret"
    }
  ]
}
