簡體   English   中英

如何為 EKS 集群刷新 AWS 身份驗證令牌

[英]How to refresh AWS authentication token for EKS cluster

我正在通過以下方式進行身份驗證

首先,我通過以下方式向 AWS 進行身份驗證

aws ecr get-login-password --region cn-north-1 | docker login --username AWS --password-stdin xxxxxxxxxx.dkr.ecr.cn-north-1.amazonaws.com.cn

然后我創建了我在部署配置中引用的regcred文件

kubectl create secret generic regcred --from-file=.dockerconfigjson=/home/noobskie/.docker/config.json --type=kubernetes.io/dockerconfigjson

所以這在前 12 小時內運行良好,但現在 AWS 令牌已過期,我無法弄清楚如何正確刷新它。 我重新運行了第一個命令,但它不起作用。

我得到的錯誤是

Error response from daemon: pull access denied for xxxxxxxxxxx.dkr.ecr.cn-north-1.amazonaws.com.cn/baopals, repository does not exist or may require 'docker login': denied: Your authorization token has expired. Reauthenticate and try again.

編輯

我剛剛發現我可以使用以下命令重新配置,但我很好奇這是否是處理它的正確方法以及是否提供任何其他 AWS 方法。

kubectl create secret generic regcred --from-file=.dockerconfigjson=/home/noobskie/.docker/config.json --dry-run -o yaml | kubectl apply -f -

如果安裝並配置了 aws-cli 和 aws-iam-authenticator,請使用以下命令生成令牌。

aws-iam-authenticator token -i cluster name

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM