You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
subresource to obtain a token to access the API is recommended instead.
198
200
{{< /note >}}
199
201
@@ -215,6 +217,7 @@ EOF
215
217
```
216
218
217
219
If you view the Secret using:
220
+
218
221
```shell
219
222
kubectl get secret/build-robot-secret -o yaml
220
223
```
@@ -251,8 +254,7 @@ token: ...
251
254
The content of `token` is elided here.
252
255
253
256
Take care not to display the contents of a `kubernetes.io/service-account-token`
254
-
Secret somewhere that your terminal / computer screen could be seen by an
255
-
onlooker.
257
+
Secret somewhere that your terminal / computer screen could be seen by an onlooker.
256
258
{{< /note >}}
257
259
258
260
When you delete a ServiceAccount that has an associated Secret, the Kubernetes
@@ -263,31 +265,32 @@ control plane automatically cleans up the long-lived token from that Secret.
263
265
First, [create an imagePullSecret](/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod).
264
266
Next, verify it has been created. For example:
265
267
266
-
- Create an imagePullSecret, as described in [Specifying ImagePullSecrets on a Pod](/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod).
268
+
- Create an imagePullSecret, as described in
269
+
[Specifying ImagePullSecrets on a Pod](/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod).
Using your editor, delete the line with key `resourceVersion`, add lines for `imagePullSecrets:` and save it.
317
-
Leave the `uid` value set the same as you found it.
319
+
Using your editor, delete the line with key `resourceVersion`, add lines for
320
+
`imagePullSecrets:`and save it. Leave the `uid` value set the same as you found it.
318
321
319
322
After you made those changes, the edited ServiceAccount looks something like this:
320
323
@@ -327,12 +330,13 @@ metadata:
327
330
namespace: default
328
331
uid: 052fb0f4-3d50-11e5-b066-42010af0d7b6
329
332
imagePullSecrets:
330
-
- name: myregistrykey
333
+
- name: myregistrykey
331
334
```
332
335
333
336
### Verify that imagePullSecrets are set for new Pods
334
337
335
-
Now, when a new Pod is created in the current namespace and using the default ServiceAccount, the new Pod has its `spec.imagePullSecrets` field set automatically:
338
+
Now, when a new Pod is created in the current namespace and using the default
339
+
ServiceAccount, the new Pod has its `spec.imagePullSecrets` field set automatically:
336
340
337
341
```shell
338
342
kubectl run nginx --image=nginx --restart=Never
@@ -354,13 +358,31 @@ To enable and use token request projection, you must specify each of the followi
354
358
command line arguments to `kube-apiserver`:
355
359
356
360
`--service-account-issuer`
357
-
: defines the Identifier of the service account token issuer. You can specify the `--service-account-issuer` argument multiple times, this can be useful to enable a non-disruptive change of the issuer. When this flag is specified multiple times, the first is used to generate tokens and all are used to determine which issuers are accepted. You must be running Kubernetes v1.22 or later to be able to specify `--service-account-issuer` multiple times.
361
+
: defines the Identifier of the service account token issuer. You can specify the
362
+
`--service-account-issuer`argument multiple times, this can be useful to enable
363
+
a non-disruptive change of the issuer. When this flag is specified multiple times,
364
+
the first is used to generate tokens and all are used to determine which issuers
365
+
are accepted. You must be running Kubernetes v1.22 or later to be able to specify
366
+
`--service-account-issuer`multiple times.
367
+
358
368
`--service-account-key-file`
359
-
: specifies the path to a file containing PEM-encoded X.509 private or public keys (RSA or ECDSA), used to verify ServiceAccount tokens. The specified file can contain multiple keys, and the flag can be specified multiple times with different files. If specified multiple times, tokens signed by any of the specified keys are considered valid by the Kubernetes API server.
369
+
: specifies the path to a file containing PEM-encoded X.509 private or public keys
370
+
(RSA or ECDSA), used to verify ServiceAccount tokens. The specified file can contain
371
+
multiple keys, and the flag can be specified multiple times with different files.
372
+
If specified multiple times, tokens signed by any of the specified keys are considered
373
+
valid by the Kubernetes API server.
374
+
360
375
`--service-account-signing-key-file`
361
-
: specifies the path to a file that contains the current private key of the service account token issuer. The issuer signs issued ID tokens with this private key.
376
+
: specifies the path to a file that contains the current private key of the service
377
+
account token issuer. The issuer signs issued ID tokens with this private key.
378
+
362
379
`--api-audiences`(can be omitted)
363
-
: defines audiences for ServiceAccount tokens. The service account token authenticator validates that tokens used against the API are bound to at least one of these audiences. If `api-audiences` is specified multiple times, tokens for any of the specified audiences are considered valid by the Kubernetes API server. If you specify the `--service-account-issuer` command line argument but you don't set `--api-audiences`, the control plane defaults to a single element audience list that contains only the issuer URL.
380
+
: defines audiences for ServiceAccount tokens. The service account token authenticator
381
+
validates that tokens used against the API are bound to at least one of these audiences.
382
+
If `api-audiences` is specified multiple times, tokens for any of the specified audiences
383
+
are considered valid by the Kubernetes API server. If you specify the `--service-account-issuer`
384
+
command line argument but you don't set `--api-audiences`, the control plane defaults to
385
+
a single element audience list that contains only the issuer URL.
364
386
365
387
{{< /note >}}
366
388
@@ -452,18 +474,19 @@ to the public endpoint, rather than the API server's address, by passing the
452
474
`--service-account-jwks-uri`flag to the API server. Like the issuer URL, the
453
475
JWKS URI is required to use the `https` scheme.
454
476
455
-
456
477
## {{% heading "whatsnext" %}}
457
478
458
479
See also:
459
480
460
-
* Read the [Cluster Admin Guide to Service Accounts](/docs/reference/access-authn-authz/service-accounts-admin/)
461
-
* Read about [Authorization in Kubernetes](/docs/reference/access-authn-authz/authorization/)
462
-
* Read about [Secrets](/docs/concepts/configuration/secret/)
463
-
* or learn to [distribute credentials securely using Secrets](/docs/tasks/inject-data-application/distribute-credentials-secure/)
464
-
* but also bear in mind that using Secrets for authenticating as a ServiceAccount
481
+
-Read the [Cluster Admin Guide to Service Accounts](/docs/reference/access-authn-authz/service-accounts-admin/)
482
+
-Read about [Authorization in Kubernetes](/docs/reference/access-authn-authz/authorization/)
483
+
-Read about [Secrets](/docs/concepts/configuration/secret/)
484
+
-or learn to [distribute credentials securely using Secrets](/docs/tasks/inject-data-application/distribute-credentials-secure/)
485
+
-but also bear in mind that using Secrets for authenticating as a ServiceAccount
* Read about [projected volumes](/docs/tasks/configure-pod-container/configure-projected-volume-storage/).
468
-
* For background on OIDC discovery, read the [ServiceAccount signing key retrieval](https://github.com/kubernetes/enhancements/tree/master/keps/sig-auth/1393-oidc-discovery) Kubernetes Enhancement Proposal
469
-
* Read the [OIDC Discovery Spec](https://openid.net/specs/openid-connect-discovery-1_0.html)
488
+
- Read about [projected volumes](/docs/tasks/configure-pod-container/configure-projected-volume-storage/).
0 commit comments