Skip to content

Commit 2ada912

Browse files
committed
add minimal RBAC example with statusInformer
1 parent 212c6cc commit 2ada912

File tree

1 file changed

+120
-1
lines changed

1 file changed

+120
-1
lines changed

docs/vendor/replicated-sdk-customizing.md

Lines changed: 120 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This section describes role-based access control (RBAC) for the Replicated SDK,
1010

1111
### Default RBAC
1212

13-
The SDK creates default Role, RoleBinding, and ServiceAccount objects during installation. The default Role allows the SDK to get, list, and watch all resources in the namespace, to create Secrets, and to update the `replicated` and `replicated-instance-report` Secrets:
13+
The SDK creates default Role, RoleBinding, and ServiceAccount objects during installation. The default Role allows the SDK to get, list, and watch all resources in the namespace, to create Secrets, and to update the `replicated`, `replicated-instance-report`, `replicated-custom-app-metrics-report`, and `replicated-meta-data` Secrets:
1414

1515
```yaml
1616
apiVersion: rbac.authorization.k8s.io/v1
@@ -44,6 +44,7 @@ rules:
4444
- replicated
4545
- replicated-instance-report
4646
- replicated-custom-app-metrics-report
47+
- replicated-meta-data
4748
```
4849
4950
### Minimum RBAC Requirements
@@ -269,3 +270,121 @@ This is the format produced by `kubectl create secret tls <secret_name> --cert=<
269270
tlsCertSecretName: YOUR_TLS_SECRET
270271
```
271272
Where `YOUR_TLS_SECRET` is the secret in the namespace containing the TLS certificate and key.
273+
274+
## Minimal RBAC
275+
276+
With the Replicated SDK version 1.7.0 and later, you can enable the use of a less-permissive RBAC role for the SDK pod by setting the `replicated.minimalRBAC` Helm value in your Helm chart.
277+
278+
```yaml
279+
# Helm chart values.yaml
280+
281+
replicated:
282+
minimalRBAC: true
283+
```
284+
285+
If statusInformers are not set manually, this RBAC role will include permissions to `get`, `list`, and `watch` all secrets, deployments, statefulsets, daemonsets, services, ingresses, PVCs, pods, replicasets, and endpoints within the namespace.
286+
This allows Replicated to discover the Helm chart secret for your application, parse it to determine what resources to monitor, and then monitor those resources.
287+
288+
If statusInformers are set manually, then the generated role will not be created with the ability to access all secrets, and other resources will be specified by name when possible.
289+
An example statusInformer configuration and generated role is presented below.
290+
291+
```yaml
292+
# Helm chart values.yaml
293+
294+
replicated:
295+
minimalRBAC: true
296+
statusInformers:
297+
- deployment/replicated
298+
- deployment/myapp
299+
- service/replicated
300+
- service/myapp
301+
```
302+
303+
```yaml
304+
# Generated RBAC role
305+
306+
apiVersion: rbac.authorization.k8s.io/v1
307+
kind: Role
308+
metadata:
309+
name: replicated-role
310+
rules:
311+
- apiGroups:
312+
- ""
313+
resources:
314+
- secrets
315+
verbs:
316+
- create
317+
- apiGroups:
318+
- ""
319+
resourceNames:
320+
- replicated
321+
- replicated-instance-report
322+
- replicated-custom-app-metrics-report
323+
- replicated-meta-data
324+
resources:
325+
- secrets
326+
verbs:
327+
- update
328+
- apiGroups:
329+
- apps
330+
resourceNames:
331+
- replicated
332+
resources:
333+
- deployments
334+
verbs:
335+
- get
336+
- apiGroups:
337+
- apps
338+
resources:
339+
- replicasets
340+
verbs:
341+
- get
342+
- apiGroups:
343+
- ""
344+
resources:
345+
- pods
346+
verbs:
347+
- get
348+
- apiGroups:
349+
- ""
350+
resourceNames:
351+
- replicated
352+
resources:
353+
- secrets
354+
verbs:
355+
- get
356+
- apiGroups:
357+
- apps
358+
resources:
359+
- deployments
360+
verbs:
361+
- list
362+
- watch
363+
- apiGroups:
364+
- apps
365+
resourceNames:
366+
- replicated
367+
- myapp
368+
resources:
369+
- deployments
370+
verbs:
371+
- get
372+
- apiGroups:
373+
- ""
374+
resources:
375+
- services
376+
- endpoints
377+
verbs:
378+
- list
379+
- watch
380+
- apiGroups:
381+
- ""
382+
resourceNames:
383+
- replicated
384+
- myapp
385+
resources:
386+
- services
387+
- endpoints
388+
verbs:
389+
- get
390+
```

0 commit comments

Comments
 (0)