diff --git a/docs/howto/how-to-consume-metrics.md b/docs/howto/how-to-consume-metrics.md new file mode 100644 index 000000000..2c0cd1d97 --- /dev/null +++ b/docs/howto/how-to-consume-metrics.md @@ -0,0 +1,254 @@ +# Consuming Metrics + +Operator-Controller and CatalogD are configured to export metrics by default. The metrics are exposed on the `/metrics` endpoint of the respective services. + +The metrics are protected by RBAC policies, and you need to have the appropriate permissions to access them. +By default, the metrics are exposed over HTTPS, and you need to have the appropriate certificates to access them via other services such as Prometheus. + +Below, you will learn how to enable the metrics, validate access, and integrate with [Prometheus Operator][prometheus-operator]. + +--- + +## Operator-Controller Metrics + +### Step 1: Enable Access + +To enable access to the Operator-Controller metrics, create a `ClusterRoleBinding` to allow the Operator-Controller service account to access the metrics. + +```shell +kubectl create clusterrolebinding operator-controller-metrics-binding \ + --clusterrole=operator-controller-metrics-reader \ + --serviceaccount=olmv1-system:operator-controller-controller-manager +``` + +### Step 2: Validate Access Manually + +#### Create a Token and Extract Certificates + +Generate a token for the service account: + +```shell +TOKEN=$(kubectl create token operator-controller-controller-manager -n olmv1-system) +echo $TOKEN +``` + +#### Deploy a Pod to Consume Metrics + +```shell +kubectl apply -f - <