Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added doc for metrics setup #4023

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/resource-metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Resource Metrics Setup

For Registry to get metrics from Prometheus, the following things are needed:
- a Service Account `registry-metrics-reader`
- the cluster role and rolebinding for the SA to access metrics from all namespaces
- a non-rotating service account token secret `registry-metrics-reader-sa-token` that can be used for Prometheus query

These are created as part of the CCM from https://github.com/bcgov-c/platform-gitops-gen/tree/master/roles/cluster_checks/files

To obtain the SA token for the query and test it out:
```bash
# get the token:
export REGISTRY_TOKEN=$(oc get secret registry-metrics-reader-sa-token -n gitops-tools -o jsonpath='{.data.token}' | base64 --decode)
# check token:
echo $REGISTRY_TOKEN
# test query (this is just an example, make sure to update the URL and query used for different environments)
curl \
-H 'Accept: application/json' \
-H "Authorization: Bearer $REGISTRY_TOKEN" \
-d 'query=sum(pod:container_cpu_usage:sum{namespace="e9b123-prod", pod=~"getok-app.*"})' \
https://thanos-querier-openshift-monitoring.apps.klab.devops.gov.bc.ca/api/v1/query

```
Loading