From cf4dfb828dda1b93fb2bb3df8b4621329704cd61 Mon Sep 17 00:00:00 2001 From: kurokobo <2920259+kurokobo@users.noreply.github.com> Date: Thu, 11 Aug 2022 15:42:03 +0900 Subject: [PATCH] fix: add description for the way to obtain token for sa --- backup/ansible/README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backup/ansible/README.md b/backup/ansible/README.md index 841ac45..354c84f 100644 --- a/backup/ansible/README.md +++ b/backup/ansible/README.md @@ -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. ```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 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}') $ kubectl -n ${NAMESPACE} get secret ${SECRET} -o jsonpath='{.data.token}' | base64 -d eyJhbGciOiJSUzI...hcGsPI5MzmaMHQvw