我正在通过以下方式进行身份验证
首先,我通过以下方式向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 token 已过期,我很难弄清楚如何正确刷新它。我已经重新运行了第一个命令,但是它不起作用。我得到的错误是
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,请使用以下命令生成 token 。
aws-iam-authenticator token -i cluster name
关于amazon-web-services - 如何刷新EKS集群的AWS身份验证 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62547132/