Enabling multi-tenancy in network observability
Enable multi-tenancy in network observability by configuring cluster roles and namespace roles to grant project administrators and developers granular, restricted access to flows and metrics in Loki and Prometheus.
Access is enabled for project administrators. Project administrators who have limited access to some namespaces can access flows for only those namespaces.
For Developers, multi-tenancy is available for both Loki and Prometheus but requires different access rights.
-
If you are using Loki, you have installed at least Loki Operator version 5.7.
-
You must be logged in as a project administrator.
-
For per-tenant access, you must have the
netobserv-loki-readercluster role and thenetobserv-metrics-readernamespace role to use the developer perspective. Run the following commands for this level of access:$ oc adm policy add-cluster-role-to-user netobserv-loki-reader <user_group_or_name>$ oc adm policy add-role-to-user netobserv-metrics-reader <user_group_or_name> -n <namespace> -
For cluster-wide access, non-cluster-administrators must have the
netobserv-loki-reader,cluster-monitoring-view, andnetobserv-metrics-readercluster roles. In this scenario, you can use either the admin perspective or the developer perspective. Run the following commands for this level of access:$ oc adm policy add-cluster-role-to-user netobserv-loki-reader <user_group_or_name>$ oc adm policy add-cluster-role-to-user cluster-monitoring-view <user_group_or_name>$ oc adm policy add-cluster-role-to-user netobserv-metrics-reader <user_group_or_name>
Grant access to LokiStack secrets
Grant the Network Observability Operator permission to access the LokiStack secret when LokiStack is installed in a namespace other than netobserv.
-
The Network Observability Operator is installed.
-
You have
cluster-adminprivileges. -
You use the Loki Operator with
LokiStackinstalled in a namespace other thannetobserv.
-
Replace
<lokistack_namespace>with the namespace whereLokiStackis installed and<namespace>with the namespace configured inspec.namespaceof theFlowCollectorresource.-
Create the
secret-watcherrole binding in the LokiStack namespace by running the following command:$ oc create rolebinding secret-watcher \ -n <lokistack_namespace> \ --clusterrole=netobserv-secret-watcher \ --serviceaccount=openshift-netobserv-operator:netobserv-controller-manager -
Create the
secret-creatorrole binding by running the following command:$ oc create rolebinding secret-creator \ -n <namespace> \ --clusterrole=netobserv-secret-creator \ --serviceaccount=openshift-netobserv-operator:netobserv-controller-manager
-
-
Check the
FlowCollectorstatus for errors by running the following command:$ oc get flowcollector cluster -o jsonpath='{.status.conditions}' -
Verify that no conditions report permission-related errors.
If the
FlowCollectorstatus continues to show permission errors after you grant the required permissions, restart the Network Observability Operator pod for faster reconciliation:$ oc delete pods -n openshift-netobserv-operator -l app=netobserv-operator
Grant access to Kafka secrets
Grant the Network Observability Operator permission to access Kafka secrets when you use the Kafka deployment model with TLS or mTLS enabled.
-
The Network Observability Operator is installed.
-
You have
cluster-adminprivileges. -
You configured the
FlowCollectorresource withspec.deploymentModel: Kafkaand TLS or mTLS enabled.
-
Replace
<namespace>with the namespace configured inspec.namespaceof theFlowCollectorresource. The default value isnetobserv.-
If Kafka is installed in the same namespace as the Network Observability components, create the secret watcher role binding by running the following command:
$ oc create rolebinding secret-watcher \ -n <namespace> \ --clusterrole=netobserv-secret-watcher \ --serviceaccount=openshift-netobserv-operator:netobserv-controller-manager -
Create the secret creator role binding in the privileged namespace by running the following command:
$ oc create rolebinding secret-creator \ -n <namespace>-privileged \ --clusterrole=netobserv-secret-creator \ --serviceaccount=openshift-netobserv-operator:netobserv-controller-manager
-
-
If Kafka is installed in a different namespace, create the secret watcher role binding in the Kafka namespace.
-
Replace
<kafka_namespace>with the namespace where Kafka is installed by running the following command:$ oc create rolebinding secret-watcher \ -n <kafka_namespace> \ --clusterrole=netobserv-secret-watcher \ --serviceaccount=openshift-netobserv-operator:netobserv-controller-manager -
Create the secret creator role binding by running the following command:
$ oc create rolebinding secret-creator \ -n <namespace> \ --clusterrole=netobserv-secret-creator \ --serviceaccount=openshift-netobserv-operator:netobserv-controller-manager -
Create the secret creator role binding in the privileged namespace by running the following command:
$ oc create rolebinding secret-creator \ -n <namespace>-privileged \ --clusterrole=netobserv-secret-creator \ --serviceaccount=openshift-netobserv-operator:netobserv-controller-manager
-
-
Check the
FlowCollectorstatus for errors by running the following command:$ oc get flowcollector cluster -o jsonpath='{.status.conditions}' -
Verify that no conditions report permission-related errors.
If the
FlowCollectorstatus continues to show permission errors after you grant the required permissions, restart the Network Observability Operator pod for faster reconciliation:$ oc delete pods -n openshift-netobserv-operator -l app=netobserv-operator