Skip to content

Commit 3ca82f2

Browse files
add REDB password steps
1 parent 7fc418d commit 3ca82f2

10 files changed

Lines changed: 217 additions & 143 deletions

File tree

content/operate/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ hideListLinks: true
4545
| | <nobr>{{<color-bubble color="bg-blue-bubble" >}} Redis</nobr> Cloud | <nobr>{{<color-bubble color="bg-yellow-bubble">}} Redis</nobr> Software | <nobr>{{<color-bubble color="bg-purple-bubble">}} Redis</nobr> Open Source | <nobr><div class="h-3 w-3 rounded-md border border-redis-pen-600 inline-block mr-1" style="background-color: #8A99A0"></div> Redis for</nobr> Kubernetes |
4646
|:-----------|:--------------|:-----------|:--------------|:--------------|
4747
| Transport Layer Security (TLS) | [TLS]({{<relref "/operate/rc/security/database-security/tls-ssl">}}) | [TLS]({{<relref "/operate/rs/security/encryption/tls">}}) | [TLS]({{< relref "/operate/oss_and_stack/management/security/encryption" >}}) | [REDB tlsMode]({{<relref "/operate/kubernetes/reference/api/redis_enterprise_database_api/#spec">}}) |
48-
| Role-based access control (RBAC) | [Role-based access control]({{<relref "/operate/rc/security/access-control/data-access-control/role-based-access-control">}}) | [Access control]({{<relref "/operate/rs/security/access-control">}}) | [Access control list]({{< relref "/operate/oss_and_stack/management/security/acl" >}}) | [REC credentials]({{<relref "/operate/kubernetes/security/manage-rec-credentials/">}}) |
48+
| Role-based access control (RBAC) | [Role-based access control]({{<relref "/operate/rc/security/access-control/data-access-control/role-based-access-control">}}) | [Access control]({{<relref "/operate/rs/security/access-control">}}) | [Access control list]({{< relref "/operate/oss_and_stack/management/security/acl" >}}) | [REC credentials]({{<relref "/operate/kubernetes/security/manage-credentials/">}}) |
4949
| Lightweight Directory Access Protocol (LDAP) | | [LDAP authentication]({{<relref "/operate/rs/security/access-control/ldap">}}) | | [Enable LDAP]({{<relref "/operate/kubernetes/security/ldap/">}}) |
5050
| Single sign-on (SSO) | [SAML SSO]({{< relref "/operate/rc/security/access-control/saml-sso" >}}) | | | |
5151
| Self-signed certificates | | [Certificates]({{<relref "/operate/rs/security/certificates">}}) | [Certificate configuration]({{< relref "/operate/oss_and_stack/management/security/encryption#certificate-configuration" >}}) | [REC certificates]({{<relref "operate/kubernetes/security/manage-rec-certificates/">}}) |

content/operate/kubernetes/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Set up globally distributed [Active-Active databases]({{< relref "/operate/kuber
6767

6868
Manage [secure connections]({{< relref "/operate/kubernetes/security" >}}) and access control for your Redis Enterprise deployment.
6969

70-
- [Manage REC credentials]({{< relref "/operate/kubernetes/security/manage-rec-credentials" >}})
70+
- [Manage credentials]({{< relref "/operate/kubernetes/security/manage-credentials" >}})
7171
- [Manage REC certificates]({{< relref "/operate/kubernetes/security/manage-rec-certificates" >}})
7272
- [Internode encryption]({{< relref "/operate/kubernetes/security/internode-encryption" >}})
7373
- [LDAP authentication]({{< relref "/operate/kubernetes/security/ldap" >}})

content/operate/kubernetes/active-active/create-aa-crdb-cli.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ You'll need to create DNS aliases to resolve your API hostname `<api-hostname>`,
6969
- Description: Combined with database name to create the Active-Active database hostname
7070
- Format: string
7171
- Example value: `-cluster.ijk.example.com`
72-
- [**REC admin credentials**]({{< relref "/operate/kubernetes/security/manage-rec-credentials" >}}) `<username> <password>`:
72+
- [**REC admin credentials**]({{< relref "/operate/kubernetes/security/manage-credentials" >}}) `<username> <password>`:
7373
- Description: Admin username and password for the REC stored in a secret
7474
- Format: string
7575
- Example value: username: `user@example.com`, password: `something`

content/operate/kubernetes/architecture/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ Redis Enterprise for Kubernetes uses [secrets](https://kubernetes.io/docs/concep
9090

9191
Redis Enterprise for Kubernetes uses the [RedisEnterpriseCluster (REC)]({{<relref "/operate/kubernetes/reference/api/redis_enterprise_cluster_api">}}) [custom resource](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) to create a Redis Enterprise cluster. During creation it generates random credentials for the operator to use. The credentials are saved in a Kubernetes (K8s) [secret](https://kubernetes.io/docs/concepts/configuration/secret/). The secret name defaults to the name of the cluster.
9292

93-
See [Manage REC credentials]({{<relref "/operate/kubernetes/security/manage-rec-credentials">}}) for more details.
93+
See [Manage credentials]({{<relref "/operate/kubernetes/security/manage-credentials">}}) for more details.
9494

9595
### REC certificates
9696

content/operate/kubernetes/networking/database-connectivity.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,10 @@ spec:
212212
key: password
213213
```
214214

215+
### Rotate the database password
216+
217+
To rotate a database password, update the `password` key in the database secret. See [Change the REDB password]({{< relref "/operate/kubernetes/security/manage-credentials#change-the-redb-password" >}}).
218+
215219
### Default user configuration
216220

217221
By default, databases create a default user with full access. You can disable this behavior:

content/operate/kubernetes/re-databases/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Explore advanced database features and configurations:
3838
Connect applications to your Redis Enterprise databases:
3939

4040
- [Database connectivity]({{< relref "/operate/kubernetes/networking/database-connectivity" >}}) - Comprehensive guide to in-cluster and external database access, service discovery, and credentials management.
41+
- [Manage credentials]({{< relref "/operate/kubernetes/security/manage-credentials" >}}) - Retrieve and rotate REC admin credentials and REDB database passwords.
4142
- [Networking]({{< relref "/operate/kubernetes/networking" >}}) - Configure ingress, routes, and service exposure for database access
4243
- [Security]({{< relref "/operate/kubernetes/security" >}}) - Set up TLS, authentication, and access control for secure database connections
4344

content/operate/kubernetes/security/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Configure security settings for your Redis Enterprise deployment on Kubernetes.
1717

1818
Manage cluster credentials and authentication settings:
1919

20-
- [Manage REC credentials]({{< relref "/operate/kubernetes/security/manage-rec-credentials" >}}) - Configure and manage Redis Enterprise cluster credentials
20+
- [Manage credentials]({{< relref "/operate/kubernetes/security/manage-credentials" >}}) - Retrieve and rotate REC admin credentials and REDB database passwords
2121
- [Configuration secrets]({{< relref "/operate/kubernetes/security/configuration-secrets" >}}) - Store Redis Enterprise configuration items in Kubernetes Secrets for automatic updates and secure management
2222
- [LDAP authentication]({{< relref "/operate/kubernetes/security/ldap" >}}) - Integrate with LDAP for centralized authentication
2323
- [SSO authentication]({{< relref "/operate/kubernetes/security/sso" >}}) - Enable SAML-based single sign-on for Cluster Manager UI access

content/operate/kubernetes/security/configuration-secrets.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ You can customize the credential secret name during cluster creation using the `
7070
The `clusterCredentialSecretName` field cannot be changed after cluster creation.
7171
{{</note>}}
7272

73-
For detailed instructions, see [Customize the credential secret name]({{< relref "/operate/kubernetes/security/manage-rec-credentials#customize-the-credential-secret-name" >}}).
73+
For detailed instructions, see [Manage credentials]({{< relref "/operate/kubernetes/security/manage-credentials" >}}).
7474

7575
## TLS certificate configuration
7676

@@ -150,7 +150,7 @@ Field names vary by deployment.
150150
151151
## See also
152152
153-
- [Manage REC credentials]({{< relref "/operate/kubernetes/security/manage-rec-credentials" >}})
153+
- [Manage credentials]({{< relref "/operate/kubernetes/security/manage-credentials" >}})
154154
- [Manage REC certificates]({{< relref "/operate/kubernetes/security/manage-rec-certificates" >}})
155155
- [Add client certificates]({{< relref "/operate/kubernetes/security/add-client-certificates" >}})
156156
- [Redis Enterprise Cluster API reference]({{< relref "/operate/kubernetes/reference/api/redis_enterprise_cluster_api" >}})
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
---
2+
Title: Manage Redis Enterprise credentials
3+
aliases: [/operate/kubernetes/security/manage-rec-credentials/]
4+
alwaysopen: false
5+
categories:
6+
- docs
7+
- operate
8+
- kubernetes
9+
description: Retrieve and rotate Redis Enterprise cluster (REC) admin credentials and Redis Enterprise database (REDB) passwords on Kubernetes.
10+
linkTitle: Manage credentials
11+
weight: 93
12+
---
13+
14+
Redis Enterprise for Kubernetes stores both cluster admin credentials and database passwords in Kubernetes [secrets](https://kubernetes.io/docs/concepts/configuration/secret/). The operator reconciles changes to these secrets and applies them to the cluster, so you rotate credentials by updating the secret rather than calling the cluster API directly.
15+
16+
{{<note>}}
17+
The procedures on this page are supported for operator versions 6.0.20-12 and later.
18+
{{</note>}}
19+
20+
## Redis Enterprise cluster (REC) credentials
21+
22+
The [`RedisEnterpriseCluster`]({{< relref "/operate/kubernetes/reference/api/redis_enterprise_cluster_api" >}}) custom resource generates random admin credentials during cluster creation. The credentials are stored in a Kubernetes secret named by the `clusterCredentialSecretName` field (defaults to the cluster name).
23+
24+
### Retrieve the REC username and password
25+
26+
REC credentials authenticate to the Redis Enterprise admin console or REST API. You need cluster connectivity through a service or port forwarding.
27+
28+
1. Read the secret created by the operator:
29+
30+
```sh
31+
kubectl get secret rec -o jsonpath='{.data}'
32+
```
33+
34+
The command outputs the base64-encoded password and username:
35+
36+
```sh
37+
map[password:MTIzNDU2NzgK username:ZGVtb0BleGFtcGxlLmNvbQo=]
38+
```
39+
40+
1. Decode each value:
41+
42+
```sh
43+
echo MTIzNDU2NzgK | base64 --decode
44+
```
45+
46+
In this example, the plain text password is `12345678` and the username is `demo@example.com`.
47+
48+
### Change the REC password for the current username
49+
50+
1. Open a shell in a Redis Enterprise [pod](https://kubernetes.io/docs/concepts/workloads/pods/):
51+
52+
```sh
53+
kubectl exec -it <rec-resource-name>-0 -c redis-enterprise-node -- /bin/bash
54+
```
55+
56+
2. Add a new password for the existing user:
57+
58+
```bash
59+
REC_USER="`cat /opt/redislabs/credentials/username`" \
60+
REC_PASSWORD="`cat /opt/redislabs/credentials/password`" \
61+
curl -k --request POST \
62+
--url https://localhost:9443/v1/users/password \
63+
-u "$REC_USER:$REC_PASSWORD" \
64+
--header 'Content-Type: application/json' \
65+
--data "{\"username\":\"$REC_USER\", \
66+
\"old_password\":\"$REC_PASSWORD\", \
67+
\"new_password\":\"<NEW PASSWORD>\"}"
68+
```
69+
70+
3. From outside the pod, update the REC credential secret:
71+
72+
```sh
73+
kubectl create secret generic <cluster_secret_name> \
74+
--save-config \
75+
--dry-run=client \
76+
--from-literal=username=<current-username> \
77+
--from-literal=password=<new-password> \
78+
-o yaml | \
79+
kubectl apply -f -
80+
```
81+
82+
4. Wait five minutes for all components to read the new password. Proceeding too soon can lock the account.
83+
84+
5. Open a shell in the pod again:
85+
86+
```sh
87+
kubectl exec -it <rec-resource-name>-0 -c redis-enterprise-node -- /bin/bash
88+
```
89+
90+
6. Remove the previous password so only the new one applies:
91+
92+
```sh
93+
REC_USER="`cat /opt/redislabs/credentials/username`"; \
94+
REC_PASSWORD="`cat /opt/redislabs/credentials/password`"; \
95+
curl -k --request DELETE \
96+
--url https://localhost:9443/v1/users/password \
97+
-u "$REC_USER:$REC_PASSWORD" \
98+
--header 'Content-Type: application/json' \
99+
--data "{\"username\":\"$REC_USER\", \
100+
\"old_password\":\"<OLD PASSWORD\"}"
101+
```
102+
103+
{{<note>}}
104+
The username in the K8s secret is the email displayed in the Redis Enterprise admin console.
105+
{{</note>}}
106+
107+
### Change both the REC username and password
108+
109+
1. [Connect to the admin console]({{< relref "/operate/kubernetes/re-clusters/connect-to-admin-console.md" >}}).
110+
111+
2. [Add another admin user]({{< relref "/operate/rs/security/access-control/create-users" >}}) and choose a new password.
112+
113+
3. Set the new username in the `username` field of your REC custom resource spec.
114+
115+
4. Update the REC credential secret:
116+
117+
```sh
118+
kubectl create secret generic <cluster_secret_name> \
119+
--save-config \
120+
--dry-run=client \
121+
--from-literal=username=<new-username> \
122+
--from-literal=password=<new-password> \
123+
-o yaml | \
124+
kubectl apply -f -
125+
```
126+
127+
5. Wait five minutes for all components to read the new password. Proceeding too soon can lock the account.
128+
129+
6. Delete the previous admin user from the cluster.
130+
131+
{{<note>}}
132+
The operator may log errors between updating the username in the REC spec and updating the secret.
133+
{{</note>}}
134+
135+
### Update the REC credentials secret in Vault
136+
137+
If you store secrets in HashiCorp Vault, update the REC credential secret with these key-value pairs:
138+
139+
```sh
140+
username:<desired_username>, password:<desired_password>
141+
```
142+
143+
For more details, see [Integrate Redis Enterprise for Kubernetes with HashiCorp Vault](https://github.com/RedisLabs/redis-enterprise-k8s-docs/blob/master/vault/README.md).
144+
145+
## Redis Enterprise database (REDB) password
146+
147+
Each [`RedisEnterpriseDatabase`]({{< relref "/operate/kubernetes/reference/api/redis_enterprise_database_api" >}}) resource has a password stored under the `password` key of the secret named by `spec.databaseSecretName`. If you don't set `databaseSecretName`, the operator creates a secret named `redb-<database-name>` with a random password and updates the REDB spec to reference it.
148+
149+
The operator reads the `password` key on every reconciliation and applies it to the database, so you rotate the password by updating the secret.
150+
151+
### Retrieve the REDB password
152+
153+
1. Find the secret name for the database:
154+
155+
```sh
156+
kubectl get redb <database-name> -o jsonpath="{.spec.databaseSecretName}"
157+
```
158+
159+
2. Decode the password:
160+
161+
```sh
162+
kubectl get secret <secret-name> -o jsonpath="{.data.password}" | base64 --decode
163+
```
164+
165+
### Change the REDB password
166+
167+
{{<note>}}
168+
If the REDB spec sets `defaultUser: false`, the operator does not create or update the database secret. Rotating the secret has no effect in that mode — manage credentials through [Redis ACLs]({{< relref "/operate/rs/security/access-control/create-roles" >}}) instead.
169+
{{</note>}}
170+
171+
1. Base64-encode the new password. Use `echo -n` to avoid encoding a trailing newline:
172+
173+
```sh
174+
echo -n '<new-password>' | base64
175+
```
176+
177+
2. Patch the secret with the encoded value:
178+
179+
```sh
180+
kubectl patch secret <secret-name> -p='{"data":{"password":"<base64-encoded-password>"}}'
181+
```
182+
183+
To edit the secret interactively, use `kubectl edit secret <secret-name>` and replace the `password` value.
184+
185+
3. Verify that the operator applied the change. The REDB status moves to `active-change-pending` while the update is in flight and returns to `active` when complete:
186+
187+
```sh
188+
kubectl get redb <database-name> -o jsonpath='{.status.status}'
189+
```
190+
191+
Then test the new password with a Redis client:
192+
193+
```sh
194+
redis-cli -h <service-name> -p <port> -a '<new-password>' PING
195+
```
196+
197+
To disable authentication for the default user, set the `password` value to an empty string.
198+
199+
#### Impact on existing client connections
200+
201+
Existing client connections authenticated with the old password remain open — Redis Enterprise does not drop sessions when the password changes. New connections, and any `AUTH` commands issued on existing connections, must use the new password. Coordinate the secret update with your client configuration to avoid authentication errors.
202+
203+
{{<note>}}
204+
For Active-Active databases, the database secret is not created automatically. See [Create a global database secret]({{< relref "/operate/kubernetes/active-active/global-db-secret" >}}).
205+
{{</note>}}

0 commit comments

Comments
 (0)