Merge pull request #117 from kurokobo/backup-ansible

fix: add description for the way to obtain token for sa
This commit is contained in:
kurokobo 2022-08-11 15:43:07 +09:00 committed by GitHub
commit 33b3c9cfe4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -58,11 +58,14 @@ rolebinding.rbac.authorization.k8s.io/awx-backup created
Obtain the API Token which required to authenticate the Kubernetes API. This token will be used later. Obtain the API Token which required to authenticate the Kubernetes API. This token will be used later.
```bash ```bash
# Kubernetes 1.24 or later # For Kubernetes 1.24 or later:
# This will generate new token that valid for 87600 hours (10 years).
# Of course you can modify the value since "87600h" is just an example.
$ kubectl -n awx create token awx-backup --duration=87600h $ kubectl -n awx create token awx-backup --duration=87600h
eyJhbGciOiJSUzI...hcGsPI5MzmaMHQvw eyJhbGciOiJSUzI...hcGsPI5MzmaMHQvw
# Kubernetes 1.23 or earlier # For Kubernetes 1.23 or earlier:
# Obtain and decode token from Secret that automatically generated for the Service Account.
$ SECRET=$(kubectl -n ${NAMESPACE} get sa awx-backup -o jsonpath='{.secrets[0].name}') $ SECRET=$(kubectl -n ${NAMESPACE} get sa awx-backup -o jsonpath='{.secrets[0].name}')
$ kubectl -n ${NAMESPACE} get secret ${SECRET} -o jsonpath='{.data.token}' | base64 -d $ kubectl -n ${NAMESPACE} get secret ${SECRET} -o jsonpath='{.data.token}' | base64 -d
eyJhbGciOiJSUzI...hcGsPI5MzmaMHQvw eyJhbGciOiJSUzI...hcGsPI5MzmaMHQvw