This procedure shows how to create a role that allows a user to set up metrics collection for a service as described in "Setting up metrics collection".
Procedure
-
Create a YAML file for the new role. In this example, it is called
custom-metrics-role.yaml
. -
Fill the file with the configuration for the
monitor-crd-edit
role:kind: ClusterRole apiVersion: rbac.authorization.k8s.io/v1 metadata: name: monitor-crd-edit rules: - apiGroups: ["monitoring.coreos.com"] resources: ["prometheusrules", "servicemonitors", "podmonitors"] verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
This role enables a user to set up metrics collection for services.
-
Apply the configuration file to the cluster:
$ oc apply -f custom-metrics-role.yaml
Now the role is created.