-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adjust prometheus query to use token (#520)
* Adjust prometheus query to use token * Add section for prometheus token handling * Correction for RBAC changes * Add link to OCP token secret docs * Specifics about UI perms * Update doc-Service-Telemetry-Framework/modules/proc_connecting-an-external-dashboard-system.adoc Co-authored-by: Leif Madsen <[email protected]> * Update doc-Service-Telemetry-Framework/modules/proc_connecting-an-external-dashboard-system.adoc Co-authored-by: Leif Madsen <[email protected]> * Update doc-Service-Telemetry-Framework/modules/proc_connecting-an-external-dashboard-system.adoc Co-authored-by: Leif Madsen <[email protected]> * Update doc-Service-Telemetry-Framework/modules/proc_connecting-an-external-dashboard-system.adoc Co-authored-by: Leif Madsen <[email protected]> * Update doc-Service-Telemetry-Framework/modules/proc_accessing-uis-for-stf-components.adoc Co-authored-by: mickogeary <[email protected]> * Update doc-Service-Telemetry-Framework/modules/proc_accessing-uis-for-stf-components.adoc Co-authored-by: mickogeary <[email protected]> --------- Co-authored-by: Leif Madsen <[email protected]> Co-authored-by: mickogeary <[email protected]>
- Loading branch information
1 parent
eea657b
commit 3b88889
Showing
5 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
...e-Telemetry-Framework/modules/proc_connecting-an-external-dashboard-system.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
|
||
[id="connecting-an-external-dashboard-system_{context}"] | ||
= Connecting an external dashboard system | ||
|
||
It is possible to configure third-party visualization tools to connect to the {ProjectShort} Prometheus for metrics retrieval. Access is controlled via an OAuth token, and a ServiceAccount is already created that has (only) the required permissions. A new OAuth token can be generated against this account for the external system to use. | ||
|
||
To use the authentication token, the third-party tool must be configured to supply an HTTP Bearer Token Authorization header as described in RFC6750. Consult the documentation of the third-party tool for how to configure this header. For example link:https://grafana.com/docs/grafana/latest/datasources/prometheus/configure-prometheus-data-source/#custom-http-headers[Configure Prometheus - Custom HTTP Headers] in the _Grafana Documentation_. | ||
|
||
.Procedure | ||
|
||
. Log in to {OpenShift}. | ||
|
||
. Change to the `service-telemetry` namespace: | ||
+ | ||
[source,bash] | ||
---- | ||
$ oc project service-telemetry | ||
---- | ||
|
||
. Create a new token secret for the stf-prometheus-reader service account | ||
+ | ||
[source,bash] | ||
---- | ||
$ oc create -f - <<EOF | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: my-prometheus-reader-token | ||
namespace: service-telemetry | ||
annotations: | ||
kubernetes.io/service-account.name: stf-prometheus-reader | ||
type: kubernetes.io/service-account-token | ||
EOF | ||
---- | ||
|
||
. Retrieve the token from the secret | ||
+ | ||
[source,bash] | ||
---- | ||
$ TOKEN=$(oc get secret my-prometheus-reader-token -o template='{{.data.token}}' | base64 -d) | ||
---- | ||
|
||
. Retrieve the Prometheus host name | ||
+ | ||
[source,bash] | ||
---- | ||
$ PROM_HOST=$(oc get route default-prometheus-proxy -ogo-template='{{ .spec.host }}') | ||
---- | ||
|
||
. Test the access token | ||
+ | ||
[source,bash] | ||
---- | ||
$ curl -k -H "Authorization: Bearer ${TOKEN}" https://${PROM_HOST}/api/v1/query?query=up | ||
{"status":"success",[...] | ||
---- | ||
|
||
. Configure your third-party tool with the PROM_HOST and TOKEN values from above | ||
+ | ||
[source,bash] | ||
---- | ||
$ echo $PROM_HOST | ||
$ echo $TOKEN | ||
---- | ||
|
||
. The token remains valid as long as the secret exists. You can revoke the token by deleting the secret. | ||
+ | ||
[source,bash] | ||
---- | ||
$ oc delete secret my-prometheus-reader-token | ||
secret "my-prometheus-reader-token" deleted | ||
---- | ||
|
||
.Additional information | ||
|
||
For more information about service account token secrets, see link:https://docs.openshift.com/container-platform/{NextSupportedOpenShiftVersion}/nodes/pods/nodes-pods-secrets.html#nodes-pods-secrets-creating-sa_nodes-pods-secrets[Creating a service account token secret] in the _OpenShift Container Platform Documentation_. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters