From 79641fbd64a7dcda689b29a417a11e1a08b31259 Mon Sep 17 00:00:00 2001 From: David Kwon Date: Tue, 29 Apr 2025 15:53:10 -0400 Subject: [PATCH 1/2] Update metrics doc token creation Signed-off-by: David Kwon --- docs/grafana/README.md | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/grafana/README.md b/docs/grafana/README.md index b375bc78f..d6c040375 100644 --- a/docs/grafana/README.md +++ b/docs/grafana/README.md @@ -15,12 +15,9 @@ To quickly test metrics locally (without installing Prometheus Grafana in the cl ``` 2. Get the serviceaccount's token to enable local access to metrics ```bash - TOKEN=$(kubectl get secrets -o=json -n ${NAMESPACE} | jq -r '[.items[] | - select ( - .type == "kubernetes.io/service-account-token" and - .metadata.annotations."kubernetes.io/service-account.name" == "devworkspace-controller-serviceaccount")][0].data.token' \ - | base64 --decode) + TOKEN=$(kubectl create token devworkspace-controller-serviceaccount -n ${NAMESPACE} --duration=1h | base64 --decode) ``` + NOTE: For development purposes, a non-expiring token can be created instead: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#manually-create-a-long-lived-api-token-for-a-serviceaccount 3. In another terminal, use `kubectl port-forward` to expose the controller's service locally ```bash kubectl port-forward service/devworkspace-controller-metrics 8443:8443 & From 8b30b68cc5fc63018848d956a18d4555b1a93c99 Mon Sep 17 00:00:00 2001 From: David Kwon Date: Fri, 2 May 2025 17:39:23 -0400 Subject: [PATCH 2/2] Update according to feedback Signed-off-by: David Kwon --- docs/grafana/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/grafana/README.md b/docs/grafana/README.md index d6c040375..cc10fce6e 100644 --- a/docs/grafana/README.md +++ b/docs/grafana/README.md @@ -15,7 +15,7 @@ To quickly test metrics locally (without installing Prometheus Grafana in the cl ``` 2. Get the serviceaccount's token to enable local access to metrics ```bash - TOKEN=$(kubectl create token devworkspace-controller-serviceaccount -n ${NAMESPACE} --duration=1h | base64 --decode) + TOKEN=$(kubectl create token devworkspace-controller-serviceaccount -n ${NAMESPACE} --duration=1h) ``` NOTE: For development purposes, a non-expiring token can be created instead: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#manually-create-a-long-lived-api-token-for-a-serviceaccount 3. In another terminal, use `kubectl port-forward` to expose the controller's service locally