Define ClusterRole
and ClusterRoleBinding
. The netobserv-reader
ClusterRole
enables multi-tenancy and allows individual user access, or group access, to the flows stored in Loki. You can create a YAML file to define these roles.
Procedure
-
Using the web console, click the Import icon, +.
-
Drop your YAML file into the editor and click Create:
Example ClusterRole reader yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: netobserv-reader (1)
rules:
- apiGroups:
- 'loki.grafana.com'
resources:
- network
resourceNames:
- logs
verbs:
- 'get'
1 |
This role can be used for multi-tenancy. |
Example ClusterRole writer yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: netobserv-writer
rules:
- apiGroups:
- 'loki.grafana.com'
resources:
- network
resourceNames:
- logs
verbs:
- 'create'
Example ClusterRoleBinding yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: netobserv-writer-flp
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: netobserv-writer
subjects:
- kind: ServiceAccount
name: flowlogs-pipeline (1)
namespace: netobserv
- kind: ServiceAccount
name: flowlogs-pipeline-transformer
namespace: netobserv
1 |
The flowlogs-pipeline writes to Loki. If you are using Kafka, this value is flowlogs-pipeline-transformer . |