|
| 1 | +--- |
| 2 | +Title: Log collector RBAC |
| 3 | +alwaysopen: false |
| 4 | +categories: |
| 5 | +- docs |
| 6 | +- operate |
| 7 | +- kubernetes |
| 8 | +description: RBAC configurations for Redis Enterprise log collector in all and restricted modes. |
| 9 | +linkTitle: Log collector RBAC |
| 10 | +weight: 90 |
| 11 | +--- |
| 12 | + |
| 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 | + |
| 15 | +## Overview |
| 16 | + |
| 17 | +The Redis Enterprise log collector script helps gather diagnostic information for troubleshooting. It has two collection modes that require different RBAC permissions: |
| 18 | + |
| 19 | +- **Restricted mode**: Collects only Redis Enterprise-related resources and logs (default for versions 6.2.18-3+) |
| 20 | +- **All mode**: Collects comprehensive cluster information including non-Redis resources (default for versions 6.2.12-1 and earlier) |
| 21 | + |
| 22 | +## When to use each mode |
| 23 | + |
| 24 | +### Restricted mode (recommended) |
| 25 | + |
| 26 | +Use restricted mode when: |
| 27 | +- You want to minimize security exposure |
| 28 | +- Your organization has strict RBAC policies |
| 29 | +- You only need Redis Enterprise-specific troubleshooting data |
| 30 | +- You're running version 6.2.18-3 or later (default mode) |
| 31 | + |
| 32 | +### All mode |
| 33 | + |
| 34 | +Use all mode when: |
| 35 | +- You need comprehensive cluster diagnostics |
| 36 | +- Redis Support specifically requests additional cluster information |
| 37 | +- You're troubleshooting complex issues that may involve non-Redis resources |
| 38 | +- You're running version 6.2.12-1 or earlier (default mode) |
| 39 | + |
| 40 | +## Permission differences |
| 41 | + |
| 42 | +The key differences between the two modes: |
| 43 | + |
| 44 | +| Resource Category | Restricted Mode | All Mode | |
| 45 | +|------------------|----------------|----------| |
| 46 | +| **Cluster-level resources** | Limited | Full access | |
| 47 | +| **Node information** | ❌ No access | ✅ Full access | |
| 48 | +| **Storage classes** | ❌ No access | ✅ Full access | |
| 49 | +| **Volume attachments** | ❌ No access | ✅ Full access | |
| 50 | +| **Certificate signing requests** | ❌ No access | ✅ Full access | |
| 51 | +| **Operator resources** | ❌ No access | ✅ Full access | |
| 52 | +| **Istio resources** | ❌ No access | ✅ Full access | |
| 53 | + |
| 54 | +## Restricted mode RBAC |
| 55 | + |
| 56 | +Use restricted mode for minimal security exposure while still collecting essential Redis Enterprise diagnostics. |
| 57 | + |
| 58 | +{{<embed-md "k8s/log_collector_role_restricted_mode.md">}} |
| 59 | + |
| 60 | +### Restricted mode permissions |
| 61 | + |
| 62 | +The restricted mode provides access to: |
| 63 | + |
| 64 | +**Role permissions (namespace-scoped):** |
| 65 | +- **Pods and logs**: Read pod information and access container logs |
| 66 | +- **Pod exec**: Execute commands inside containers for diagnostics |
| 67 | +- **Core resources**: Access to services, endpoints, ConfigMaps, secrets, and storage resources |
| 68 | +- **Workload resources**: Read deployments, StatefulSets, DaemonSets, and jobs |
| 69 | +- **Redis Enterprise resources**: Full read access to all Redis Enterprise custom resources |
| 70 | +- **Networking**: Read ingress and network policy configurations |
| 71 | +- **OpenShift routes**: Read route configurations (for OpenShift environments) |
| 72 | + |
| 73 | +**ClusterRole permissions (cluster-scoped):** |
| 74 | +- **Persistent volumes**: Read cluster-wide storage information |
| 75 | +- **Namespaces**: Read namespace information |
| 76 | +- **RBAC**: Read cluster roles and bindings |
| 77 | +- **Custom resource definitions**: Read Redis Enterprise CRDs |
| 78 | +- **Admission controllers**: Read ValidatingWebhook configurations |
| 79 | + |
| 80 | +## All mode RBAC |
| 81 | + |
| 82 | +Use all mode when you need comprehensive cluster diagnostics or when specifically requested by Redis Support. |
| 83 | + |
| 84 | +{{<embed-md "k8s/log_collector_role_all_mode.md">}} |
| 85 | + |
| 86 | +### All mode additional permissions |
| 87 | + |
| 88 | +In addition to all restricted mode permissions, all mode provides: |
| 89 | + |
| 90 | +**Additional ClusterRole permissions:** |
| 91 | +- **Nodes**: Read cluster node information and status |
| 92 | +- **Storage classes**: Read storage class configurations |
| 93 | +- **Volume attachments**: Read volume attachment status |
| 94 | +- **Certificate signing requests**: Read certificate management information |
| 95 | +- **Operator resources**: Read OLM (Operator Lifecycle Manager) resources |
| 96 | +- **Istio resources**: Read Istio service mesh configurations |
| 97 | + |
| 98 | +## Role binding |
| 99 | + |
| 100 | +Bind the Role to your service account in each namespace where you want to collect logs. |
| 101 | + |
| 102 | +```yaml |
| 103 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 104 | +kind: RoleBinding |
| 105 | +metadata: |
| 106 | + name: redis-enterprise-log-collector |
| 107 | + namespace: <target-namespace> |
| 108 | +subjects: |
| 109 | +- kind: ServiceAccount |
| 110 | + name: redis-enterprise-log-collector |
| 111 | + namespace: <service-account-namespace> |
| 112 | +roleRef: |
| 113 | + kind: Role |
| 114 | + name: redis-enterprise-log-collector |
| 115 | + apiGroup: rbac.authorization.k8s.io |
| 116 | +``` |
| 117 | +
|
| 118 | +## Cluster role binding |
| 119 | +
|
| 120 | +Bind the ClusterRole to your service account for cluster-wide permissions. |
| 121 | +
|
| 122 | +```yaml |
| 123 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 124 | +kind: ClusterRoleBinding |
| 125 | +metadata: |
| 126 | + name: redis-enterprise-log-collector |
| 127 | +subjects: |
| 128 | +- kind: ServiceAccount |
| 129 | + name: redis-enterprise-log-collector |
| 130 | + namespace: <service-account-namespace> |
| 131 | +roleRef: |
| 132 | + kind: ClusterRole |
| 133 | + name: redis-enterprise-log-collector |
| 134 | + apiGroup: rbac.authorization.k8s.io |
| 135 | +``` |
| 136 | +
|
| 137 | +## Usage |
| 138 | +
|
| 139 | +Apply the appropriate RBAC configuration and role bindings, then run the log collector with the desired mode: |
| 140 | +
|
| 141 | +```bash |
| 142 | +# Restricted mode (default for 6.2.18-3+) |
| 143 | +python log_collector.py -m restricted -n <namespace> |
| 144 | + |
| 145 | +# All mode |
| 146 | +python log_collector.py -m all -n <namespace> |
| 147 | +``` |
| 148 | + |
| 149 | +## Security considerations |
| 150 | + |
| 151 | +### Principle of least privilege |
| 152 | + |
| 153 | +- **Start with restricted mode**: Use restricted mode unless you specifically need additional cluster information |
| 154 | +- **Limit namespace access**: Only grant permissions in namespaces where log collection is needed |
| 155 | +- **Time-bound access**: Consider creating temporary RBAC resources for log collection activities |
| 156 | + |
| 157 | +### Sensitive data handling |
| 158 | + |
| 159 | +Both modes collect: |
| 160 | +- **Secrets metadata**: Names and types of secrets (not the actual secret values) |
| 161 | +- **ConfigMap data**: Configuration information that may contain sensitive settings |
| 162 | +- **Pod logs**: Application logs that may contain sensitive information |
| 163 | + |
| 164 | +Ensure collected logs are handled according to your organization's data security policies. |
| 165 | + |
| 166 | +## Troubleshooting |
| 167 | + |
| 168 | +### Permission denied errors |
| 169 | + |
| 170 | +If you encounter permission errors: |
| 171 | + |
| 172 | +1. **Verify RBAC resources**: Ensure roles and bindings are applied correctly |
| 173 | +2. **Check service account**: Confirm the service account has the necessary bindings |
| 174 | +3. **Validate namespace access**: Ensure role bindings exist in target namespaces |
| 175 | +4. **Review mode requirements**: Verify you're using the correct mode for your needs |
| 176 | + |
| 177 | +### Missing resources |
| 178 | + |
| 179 | +If the log collector reports missing resources: |
| 180 | + |
| 181 | +1. **Check cluster role permissions**: Ensure ClusterRole is applied and bound |
| 182 | +2. **Verify CRD access**: Confirm access to Redis Enterprise custom resource definitions |
| 183 | +3. **Review mode selection**: Consider switching to all mode if additional resources are needed |
| 184 | + |
| 185 | +## Next steps |
| 186 | + |
| 187 | +- [Learn about log collection]({{< relref "/operate/kubernetes/logs/collect-logs" >}}) |
| 188 | +- [Explore YAML deployment examples]({{< relref "/operate/kubernetes/reference/yaml-examples" >}}) |
| 189 | +- [Configure monitoring]({{< relref "/operate/kubernetes/re-clusters/connect-prometheus-operator" >}}) |
| 190 | + |
| 191 | +## Related documentation |
| 192 | + |
| 193 | +- [Collect logs guide]({{< relref "/operate/kubernetes/logs/collect-logs" >}}) |
| 194 | +- [Kubernetes RBAC](https://kubernetes.io/docs/reference/access-authn-authz/rbac/) |
| 195 | +- [Redis Enterprise troubleshooting]({{< relref "/operate/kubernetes/logs" >}}) |
0 commit comments