amazon-web-services - 如何为 EKS 集群刷新 AWS 身份验证令牌
问题描述
我正在通过以下方式进行身份验证
首先,我通过以下方式向 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
推荐阅读
- node.js - 错误:addReview 不是 MERN 应用程序中的函数
- arrays - 数组字符串中有多少这个词
- sharepoint - SharePoint 配置向导失败 - 无法创建新的 Web 应用程序
- node.js - 如何让我的应用程序无法连接到 Mongo 数据库?
- javascript - 使用 express 和 mongoose,如何使用 POST 路由将多个 ID 的数组从客户端发送到服务器端?
- python - 检查第二个字母是否大写,
- python - 模块“project_name”没有属性“celery”
- java - 解析jar文件中类文件的代码
- javascript - 即使在发送响应时也能在不发送响应错误的情况下解析 API
- json - 如何在 android studio 中使用改造发送 woocomerce 的元数据和计费数据?