|
1 | 1 | ---
|
2 |
| -Title: Log collector RBAC |
| 2 | +Title: Log collector RBAC examples |
3 | 3 | alwaysopen: false
|
4 | 4 | categories:
|
5 | 5 | - docs
|
6 | 6 | - operate
|
7 | 7 | - kubernetes
|
8 |
| -description: RBAC configurations for Redis Enterprise log collector in all and restricted modes. |
| 8 | +description: YAML examples for configuring RBAC permissions for the Redis Enterprise log collector tool in restricted and all modes. |
9 | 9 | linkTitle: Log collector RBAC
|
10 |
| -weight: 90 |
| 10 | +weight: 50 |
11 | 11 | ---
|
12 | 12 |
|
13 |
| -This page provides YAML examples for configuring RBAC permissions for the Redis Enterprise log collector tool. |
| 13 | +This page provides YAML examples for configuring RBAC permissions for the Redis Enterprise log collector tool. The log collector requires different permission levels depending on the collection mode you choose. |
14 | 14 |
|
15 |
| -## Overview |
| 15 | +For complete log collection instructions, see [Collect logs]({{< relref "/operate/kubernetes/logs/collect-logs" >}}). |
16 | 16 |
|
17 |
| -The Redis Enterprise log collector script helps gather diagnostic information for troubleshooting. |
18 |
| -The log collector requires different permission levels depending on the collection mode you choose. |
19 |
| -It has two collection modes that require different RBAC permissions: |
20 |
| -h |
21 |
| -- **Restricted mode** (recommended): Collects only Redis Enterprise resources with minimal security exposure. Default for versions 6.2.18-3+. |
22 |
| -- **All mode**: Collects comprehensive cluster information including nodes, storage classes, and operator resources. Use when specifically requested by Redis Support. |
| 17 | +## Prerequisites |
23 | 18 |
|
24 |
| -## RBAC configurations |
| 19 | +- [Deployment]({{< relref "/operate/kubernetes/deployment" >}}) must be installed |
| 20 | +- Appropriate permissions to create RBAC resources in target namespaces |
| 21 | +- Understanding of your deployment model (single namespace, multi-namespace, etc.) |
25 | 22 |
|
26 |
| -### Restricted mode |
| 23 | +## Collection modes |
27 | 24 |
|
28 |
| -{{<embed-md "k8s/log_collector_role_restricted_mode.md">}} |
| 25 | +The log collector has two collection modes that require different RBAC permissions: |
29 | 26 |
|
30 |
| -### All mode |
| 27 | +- **Restricted mode** (recommended): Collects only Redis Enterprise resources with minimal security exposure. Default for versions 6.2.18-3 and later. |
| 28 | +- **All mode**: Collects comprehensive cluster information including nodes, storage classes, and operator resources. Use when specifically requested by Redis Support. |
31 | 29 |
|
32 |
| -{{<embed-md "k8s/log_collector_role_all_mode.md">}} |
| 30 | +## Restricted mode |
33 | 31 |
|
34 |
| -{{< note >}} |
35 |
| -For the complete list of resources and permissions required by each mode, refer to the role definitions in the YAML files above. |
36 |
| -{{< /note >}} |
| 32 | +The restricted mode configuration provides minimal permissions for collecting Redis Enterprise resources only. |
37 | 33 |
|
38 |
| -## Applying RBAC configurations |
| 34 | +{{<embed-yaml "k8s/log_collector_role_restricted_mode.md" "log-collector-restricted-rbac.yaml">}} |
39 | 35 |
|
40 |
| -### Namespace requirements |
| 36 | +Restricted mode configuration: |
| 37 | +- `Role`: Namespace-scoped permissions for Redis Enterprise resources |
| 38 | +- `ClusterRole`: Cluster-wide permissions for CRDs and basic cluster resources |
| 39 | +- `rules`: Minimal permissions for Redis Enterprise diagnostics |
41 | 40 |
|
42 |
| -The Role and RoleBinding must be created in every namespace where you need to collect logs. This varies based on your deployment model: |
| 41 | +Key permissions: |
| 42 | +- `pods, pods/log, pods/exec`: Access to pod information and logs |
| 43 | +- `app.redislabs.com/*`: All Redis Enterprise custom resources |
| 44 | +- `persistentvolumes`: Storage information for troubleshooting |
43 | 45 |
|
44 |
| -- **Single namespace**: Apply to the namespace where Redis Enterprise runs |
45 |
| -- **Multi-namespace with single REC**: Apply to the REC namespace plus each REDB namespace |
46 |
| -- **Multi-namespace with multiple RECs**: Apply to each REC namespace |
| 46 | +## All mode |
47 | 47 |
|
48 |
| -The ClusterRole and ClusterRoleBinding need to be created only once per cluster. |
| 48 | +The all mode configuration provides comprehensive permissions for collecting detailed cluster information. |
| 49 | + |
| 50 | +{{<embed-yaml "k8s/log_collector_role_all_mode.md" "log-collector-all-rbac.yaml">}} |
| 51 | + |
| 52 | +All mode configuration: |
| 53 | +- `Role`: Extended namespace permissions including operator resources |
| 54 | +- `ClusterRole`: Additional cluster-wide permissions for nodes and storage |
| 55 | +- `rules`: Comprehensive permissions for full cluster diagnostics |
49 | 56 |
|
50 |
| -{{< note >}} |
51 |
| -Each YAML file contains both Role and ClusterRole objects. Running `kubectl apply` installs both components. You can safely run the command multiple times with different namespaces. |
52 |
| -{{< /note >}} |
| 57 | +Additional permissions in all mode: |
| 58 | +- `nodes`: Node information and status |
| 59 | +- `storageclasses, volumeattachments`: Storage system details |
| 60 | +- `operators.coreos.com/*`: OpenShift operator information |
| 61 | +- `networking.istio.io/*`: Istio service mesh resources |
| 62 | + |
| 63 | +## Apply the configuration |
53 | 64 |
|
54 | 65 | ### Manual deployment
|
55 | 66 |
|
56 |
| -If you prefer to apply the configurations manually, save the YAML content to local files and apply them: |
| 67 | +To apply the RBAC configurations manually: |
57 | 68 |
|
58 | 69 | ```bash
|
59 |
| -# Save the YAML content to a file |
60 |
| -kubectl apply -f log-collector-rbac.yaml --namespace <namespace> |
| 70 | +# Apply restricted mode RBAC |
| 71 | +kubectl apply -f log-collector-restricted-rbac.yaml --namespace <namespace> |
| 72 | + |
| 73 | +# Apply all mode RBAC |
| 74 | +kubectl apply -f log-collector-all-rbac.yaml --namespace <namespace> |
61 | 75 | ```
|
| 76 | +### Namespace requirements |
62 | 77 |
|
63 |
| -## Usage |
| 78 | +The Role and RoleBinding must be created in every namespace where you need to collect logs: |
64 | 79 |
|
65 |
| -After applying the RBAC configuration, run the log collector: |
| 80 | +- **Single namespace**: Apply to the namespace where Redis Enterprise runs |
| 81 | +- **Multi-namespace with single REC**: Apply to the REC namespace plus each REDB namespace |
| 82 | +- **Multi-namespace with multiple RECs**: Apply to each REC namespace |
66 | 83 |
|
67 |
| -```bash |
68 |
| -# Restricted mode (default for 6.2.18-3+) |
69 |
| -python log_collector.py -m restricted -n <namespace> |
| 84 | +The ClusterRole and ClusterRoleBinding need to be created only once per cluster. |
70 | 85 |
|
71 |
| -# All mode |
72 |
| -python log_collector.py -m all -n <namespace> |
73 |
| -``` |
| 86 | +Edit the values in the downloaded YAML file for your specific setup, updating the namespace references and role binding subjects to match your environment. |
74 | 87 |
|
75 | 88 | ## Security considerations
|
76 | 89 |
|
77 |
| -- **Use restricted mode** unless you specifically need additional cluster information |
78 |
| -- **Limit namespace access** to only where log collection is needed |
79 |
| -- **Handle collected data** according to your organization's security policies (logs may contain sensitive information) |
| 90 | +### Best practices |
| 91 | + |
| 92 | +- Use restricted mode unless you specifically need additional cluster information |
| 93 | +- Limit namespace access to only where log collection is needed |
| 94 | +- Handle collected data according to your organization's security policies |
80 | 95 |
|
81 | 96 | ### Secrets permission explanation
|
82 | 97 |
|
83 | 98 | The RBAC configurations request read access to secrets in the collected namespaces. **Secrets are not collected or included in the log package sent to Redis Support.** This permission is required because:
|
84 | 99 |
|
85 |
| -- The log collector uses Helm commands (`helm list`, `helm get all`) to gather information about Redis Enterprise Helm chart deployments |
| 100 | +- The log collector uses Helm commands (`helm list`, `helm get all`) to gather Redis Enterprise Helm chart deployment information |
86 | 101 | - Helm stores its deployment metadata in Kubernetes secrets
|
87 |
| -- For Redis Enterprise charts, this metadata contains only deployment configuration (not sensitive data), but follows Helm's standard storage pattern |
| 102 | +- This metadata contains only deployment configuration (not sensitive data) |
88 | 103 |
|
89 | 104 | If your security policies prohibit secrets access, you can remove the secrets permission from the Role, but this will limit the log collector's ability to gather Helm deployment information.
|
90 | 105 |
|
91 | 106 | ## Troubleshooting
|
92 | 107 |
|
93 |
| -If you encounter permission errors, verify that roles and bindings are applied correctly in the target namespaces. For missing resources, ensure the ClusterRole is applied and consider switching to all mode if additional resources are needed. |
| 108 | +### Permission errors |
| 109 | + |
| 110 | +- Verify that roles and bindings are applied correctly in the target namespaces |
| 111 | +- Check that the ClusterRole is applied cluster-wide |
| 112 | +- Ensure the service account has proper role bindings |
| 113 | + |
| 114 | +### Missing resources |
| 115 | + |
| 116 | +- Consider switching to all mode if additional cluster resources are needed |
| 117 | +- Verify that custom resource definitions are installed |
| 118 | +- Check that the operator has proper permissions |
| 119 | + |
| 120 | +## Next steps |
| 121 | + |
| 122 | +- [Collect logs]({{< relref "/operate/kubernetes/logs/collect-logs" >}}) |
94 | 123 |
|
95 | 124 | ## Related documentation
|
96 | 125 |
|
97 |
| -- [Collect logs guide]({{< relref "/operate/kubernetes/logs/collect-logs" >}}) |
98 | 126 | - [Kubernetes RBAC documentation](https://kubernetes.io/docs/reference/access-authn-authz/rbac/)
|
99 |
| -- [Redis Enterprise troubleshooting]({{< relref "/operate/kubernetes/logs" >}}) |
| 127 | +- [Logs]({{< relref "/operate/kubernetes/logs" >}}) |
| 128 | +- [Deployment]({{< relref "/operate/kubernetes/deployment" >}}) |
0 commit comments