Skip to content

Commit b9aa1e9

Browse files
Merge pull request #1455 from maelvls/docs-external-vault
Vault: document serviceAccountRef with an external Vault
2 parents 1d939fd + 18dbb7e commit b9aa1e9

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

.spelling

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ v1.12.0
532532
v1.12.1.
533533
v1.12.2.
534534
v1.12.3.
535+
v1.15.0.
535536
v1alpha1
536537
v1alpha2
537538
v1alpha3

content/docs/configuration/vault.md

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,9 @@ Kubernetes service account token can be provided in two ways:
361361
- [Secretless Authentication with a Service Account](#secretless-authentication-with-a-service-account) (recommended),
362362
- [Authentication with a Static Service Account Token](#static-service-account-token).
363363

364-
#### Secretless Authentication with a Service Account
364+
<a name="static-service-account-token"></a>
365+
366+
#### Secretless Authentication with a Service Account (In-Cluster Vault)
365367

366368
ℹ️ This feature is available in cert-manager >= v1.12.0.
367369

@@ -464,7 +466,49 @@ needs to talks to Vault.
464466
Although it is not recommended, you can also use the same Vault role for all of
465467
your Issuers and ClusterIssuers by omitting the `audience` field and re-using
466468
the same service account.
467-
<a name="static-service-account-token"></a>
469+
470+
#### Secretless Authentication with a Service Account (External Vault)
471+
472+
ℹ️ This feature is available in cert-manager >= v1.15.0.
473+
474+
If you are using a Vault instance external to your cluster, you will need to set
475+
the `audiences` to an audience accepted by your Kubernetes cluster. When using
476+
an external Vault instance, the short-lived token created by cert-manager to
477+
authenticate to Vault will be used by Vault for authenticating to Kubernetes.
478+
First, find what your cluster's issuer is:
479+
480+
```sh
481+
kubectl get --raw /.well-known/openid-configuration | jq .issuer -r
482+
```
483+
484+
Then, set the `audiences` field to the issuer URL:
485+
486+
```yaml
487+
apiVersion: cert-manager.io/v1
488+
kind: Issuer
489+
metadata:
490+
name: vault-issuer
491+
namespace: sandbox
492+
spec:
493+
vault:
494+
path: pki_int/sign/example-dot-com
495+
server: https://vault.local
496+
auth:
497+
kubernetes:
498+
role: my-app-1
499+
mountPath: /v1/auth/kubernetes
500+
serviceAccountRef:
501+
name: vault-issuer
502+
audiences: [https://kubernetes.default.svc.cluster.local]
503+
```
504+
505+
When using `audiences`, the JWT will still include the generated audience
506+
`vault://namespace/issuer-name` or `vault://cluster-issuer`. The generated
507+
audience is useful for restricting access to a Vault role to a certain issuer.
508+
509+
When configuring the Kubernetes Vault auth method, omit the `token_reviewer_jwt`
510+
parameter so that Vault uses the token provided by cert-manager to authenticate
511+
with the Kubernetes API server when reviewing the token.
468512

469513
#### Authentication with a Static Service Account Token
470514

0 commit comments

Comments
 (0)