@@ -127,39 +127,48 @@ CPU/Memory for pods returned by the API server. Defaults to `false`.
127127# #### `clusters.\*.serviceAccountToken` (optional)
128128
129129The service account token to be used when using the `serviceAccount` auth
130- provider. On versions of Kubernetes [prior to
131- 1.24](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.24.md#no-really-you-must-read-this-before-you-upgrade-1),
132- you could get an (automatically-generated) token for a service account with :
133-
134- ` ` ` sh
135- kubectl -n <NAMESPACE> get secret $(kubectl -n <NAMESPACE> get sa <SERVICE_ACCOUNT_NAME> -o=json \
136- | jq -r '.secrets[0].name') -o=json \
137- | jq -r '.data["token"]' \
138- | base64 --decode
139- ` ` `
140-
141- For Kubernetes 1.24+, as described in [this
142- guide](https://kubernetes.io/docs/concepts/configuration/secret/#service-account-token-secrets),
143- you can obtain a long-lived token by creating a secret :
144-
145- ` ` ` sh
146- kubectl apply -f - <<EOF
147- apiVersion: v1
148- kind: Secret
149- metadata:
150- name: <SECRET_NAME>
151- namespace: <NAMESPACE>
152- annotations:
153- kubernetes.io/service-account.name: <SERVICE_ACCOUNT_NAME>
154- type: kubernetes.io/service-account-token
155- EOF
156- ` ` `
157-
158- waiting for the token controller to populate a token, and retrieving it with :
159-
160- ` ` ` sh
161- kubectl -n <NAMESPACE> get secret <SECRET_NAME> -o go-template='{{.data.token | base64decode}}'
162- ` ` `
130+ provider. Note that, unless you have an effective credential rotation procedure
131+ in place or have a single Kubernetes cluster running both Backstage and all your
132+ services, this auth provider is probably not ideal for production.
133+
134+ Assuming you have already created a service account named `SERVICE_ACCOUNT_NAME`
135+ in namespace `NAMESPACE` and it has adequate
136+ [permissions](#role-based-access-control), here are some sample procedures to
137+ procure a long-lived service account token for use with this provider :
138+
139+ - On versions of Kubernetes [prior to
140+ 1.24](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.24.md#no-really-you-must-read-this-before-you-upgrade-1),
141+ you could get an (automatically-generated) token for a service account with :
142+
143+ ` ` ` sh
144+ kubectl -n <NAMESPACE> get secret $(kubectl -n <NAMESPACE> get sa <SERVICE_ACCOUNT_NAME> -o=json \
145+ | jq -r '.secrets[0].name') -o=json \
146+ | jq -r '.data["token"]' \
147+ | base64 --decode
148+ ` ` `
149+
150+ - For Kubernetes 1.24+, as described in [this
151+ guide](https://kubernetes.io/docs/concepts/configuration/secret/#service-account-token-secrets),
152+ you can obtain a long-lived token by creating a secret :
153+
154+ ` ` ` sh
155+ kubectl apply -f - <<EOF
156+ apiVersion: v1
157+ kind: Secret
158+ metadata:
159+ name: <SECRET_NAME>
160+ namespace: <NAMESPACE>
161+ annotations:
162+ kubernetes.io/service-account.name: <SERVICE_ACCOUNT_NAME>
163+ type: kubernetes.io/service-account-token
164+ EOF
165+ ` ` `
166+
167+ waiting for the token controller to populate a token, and retrieving it with :
168+
169+ ` ` ` sh
170+ kubectl -n <NAMESPACE> get secret <SECRET_NAME> -o go-template='{{.data.token | base64decode}}'
171+ ` ` `
163172
164173If a cluster has `authProvider : serviceAccount` and the `serviceAccountToken`
165174field is omitted, Backstage will ignore the configured URL and certificate data,
0 commit comments