-
Notifications
You must be signed in to change notification settings - Fork 238
K8s: add more secrets and connectivity info #1918
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mich-elle-luna
wants to merge
5
commits into
main
Choose a base branch
from
DOC-3151
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
22560a8
Add Kubernetes configuration secrets documentation
mich-elle-luna fcefc04
Update content/operate/kubernetes/security/configuration-secrets.md
mich-elle-luna 4493ba7
add database connectivity info
kaitlynmichael ec6e8de
reduce duplicated info
kaitlynmichael 4d2aba5
copy edit
kaitlynmichael File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
content/operate/kubernetes/security/configuration-secrets.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
--- | ||
categories: | ||
- docs | ||
- operate | ||
- kubernetes | ||
description: Store Redis Enterprise configuration items in Kubernetes Secrets for automatic updates and secure management. | ||
linkTitle: Configuration secrets | ||
title: Store configuration in Kubernetes Secrets | ||
weight: 96 | ||
--- | ||
|
||
When using Redis Enterprise for Kubernetes, you can store certain configuration items in Kubernetes Secrets. This approach has the advantage that updates to these Secrets, once configured, are read immediately by the Operator and propagated to the Redis Enterprise Cluster (REC). | ||
|
||
## License configuration | ||
|
||
Redis Enterprise clusters require a valid license to operate. You can apply licenses using Kubernetes Secrets or by embedding them directly in the cluster specification. This section covers how to determine your cluster's FQDN for licensing purposes and demonstrates both methods for license configuration. | ||
|
||
### Determine your cluster FQDN | ||
|
||
For licensing purposes, you need to know your Redis Enterprise cluster's fully qualified domain name (FQDN). In Kubernetes, the REC's FQDN is the fully qualified name of the REC API service and follows this format: | ||
|
||
``` | ||
<REC name>.<namespace>.svc.cluster.local | ||
``` | ||
|
||
For example, if a REC is named `my-rec` and is deployed in the namespace `my-ns`, the FQDN will be `my-rec.my-ns.svc.cluster.local`. | ||
|
||
### Method 1: Using a Kubernetes Secret (Recommended) | ||
|
||
You can set the license in the REC through the `licenseSecretName` YAML property. | ||
|
||
1. Add your raw license to a text file (for example, `license.txt`). | ||
|
||
2. Execute the following command to create the Secret (in this example called `rec-license`) with a key called `license`: | ||
|
||
```sh | ||
kubectl -n <namespace> create secret generic rec-license --from-file=license=./license.txt | ||
``` | ||
|
||
3. Edit the REC definition and add the property `licenseSecretName: rec-license`. This will be immediately read by the Operator. | ||
|
||
```sh | ||
kubectl edit rec <rec-name> | ||
``` | ||
|
||
Add the following to the spec: | ||
|
||
```yaml | ||
spec: | ||
licenseSecretName: rec-license | ||
``` | ||
|
||
### Method 2: Direct license in REC specification | ||
|
||
Alternatively, you can specify the license key string directly in the REC YAML: | ||
|
||
```yaml | ||
spec: | ||
nodes: 3 | ||
license: | | ||
----- LICENSE START ----- | ||
eai14c/y6XNVykffDQSPUsHKcmpgOFUlmyTBDUEZEz+GLbXAgQFOmxcdbR9J | ||
...remaining license key content... | ||
----- LICENSE END ----- | ||
``` | ||
|
||
{{<note>}} | ||
Pay attention to the indentation and spaces in the file and make sure the pipe symbol (`|`) is included after `license:`. | ||
{{</note>}} | ||
|
||
## TLS certificate configuration | ||
|
||
TLS certificates are essential for securing communication between clients and Redis Enterprise databases, as well as between internal cluster components. This section explains how to store client certificates for mutual TLS authentication and how to configure certificates for different Redis Enterprise services using Kubernetes Secrets. | ||
|
||
### Client certificates for mTLS | ||
|
||
Here's how to set a client certificate for mutual TLS (mTLS). | ||
|
||
1. Create a Secret called `client-cert-secret` with a property named `cert` using the following command: | ||
|
||
```sh | ||
kubectl -n <namespace> create secret generic client-cert-secret --from-file=cert=<path-to-cert> | ||
``` | ||
|
||
2. Add this secret to the relevant Redis Enterprise Database (REDB) using the `clientAuthenticationCertificates` property as documented in [Add client certificates]({{< relref "/operate/kubernetes/security/add-client-certificates" >}}). | ||
|
||
{{<note>}} | ||
At the time of writing (November 14, 2023), the public documentation describes creating the secret directly in YAML. This approach has the disadvantage that it requires the user to ensure the certificate is correctly encoded to base64. This can be done using a command like `cat my-cert.pem | openssl base64`. Then paste the output into the YAML source file. | ||
{{</note>}} | ||
|
||
### Certificates for different services | ||
|
||
The notes above were valid for a client certificate. If you want to create a secret for proxy, API, or other services, they expect different keys: | ||
|
||
```sh | ||
kubectl create secret generic <secret-name> \ | ||
--from-file=certificate=</PATH/TO/certificate.pem> \ | ||
--from-file=key=</PATH/TO/key.pem> \ | ||
--from-literal=name=<proxy | api | cm | syncer | metrics_exporter> | ||
``` | ||
|
||
## Best practices | ||
|
||
- Store sensitive configuration items like licenses and certificates in Secrets rather than directly in YAML files | ||
- Use the `--from-file` option when creating secrets to avoid manual base64 encoding | ||
- Ensure secrets are created in the same namespace as your REC or REDB resources | ||
- Use descriptive names for your secrets to make them easy to identify and manage | ||
- Regularly rotate certificates and update the corresponding secrets | ||
|
||
## See also | ||
|
||
- [Manage REC credentials]({{< relref "/operate/kubernetes/security/manage-rec-credentials" >}}) | ||
- [Manage REC certificates]({{< relref "/operate/kubernetes/security/manage-rec-certificates" >}}) | ||
- [Add client certificates]({{< relref "/operate/kubernetes/security/add-client-certificates" >}}) | ||
- [Redis Enterprise Cluster API reference]({{< relref "/operate/kubernetes/reference/redis_enterprise_cluster_api" >}}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.