我在设置具有 ECR 访问权限的 Spinnaker 时遇到问题。
背景:我在 EKS 集群上使用 helm 安装了 spinnaker,并且我已经确认集群具有必要的 ECR 权限(通过从 clouddriver pod 中手动运行 ECR 命令)。我按照此处的说明设置 Spinnaker+ECR:https ://www.spinnaker.io/setup/install/providers/docker-registry/
问题:当我运行时:
hal config provider docker-registry account add my-ecr-registry \
--address $ADDRESS \
--username AWS \
--password-command "aws --region us-west-2 ecr get-authorization-token --output text --query 'authorizationData[].authorizationToken' | base64 -d | sed 's/^AWS://'"
我得到以下输出:
+ Get current deployment
Success
- Add the some-ecr-registry account
Failure
Problems in default.provider.dockerRegistry.some-ecr-registry:
- WARNING Resolved Password was empty, missing dependencies for
running password command?
- WARNING You have a supplied a username but no password.
! ERROR Unable to fetch tags from the docker repository: code, 400
Bad Request
? Can the provided user access this repository?
- WARNING None of your supplied repositories contain any tags.
Spinnaker will not be able to deploy any docker images.
? Push some images to your registry.
Problems in halconfig:
- WARNING There is a newer version of Halyard available (1.28.0),
please update when possible
? Run 'sudo apt-get update && sudo apt-get install
spinnaker-halyard -y' to upgrade
- Failed to add account some-ecr-registry for provider
dockerRegistry.
- 我已确认 aws-cli 已安装在 clouddriver pod 上。而且我已经确认我可以直接从 clouddriver pod 输入密码命令,并且它成功返回了一个令牌。
- 我还确认,如果我手动生成 ECR 令牌并且
run hal config provider docker-registry account add my-ecr-registry --address $ADDRESS --username AWS --password-command "echo $MANUALLY_GENERATED_TOKEN"
一切正常。所以有一些特定于密码命令的东西出错了,我不知道如何调试它。 - 另一个奇怪的行为:如果我将密码命令简化为:
hal config provider docker-registry account add some-ecr-registry --address $ADDRESS --username AWS --repositories code --password-command "aws --region us-west-2 ecr get-authorization-token"
,我会得到一个附加的输出,上面写着"- WARNING Password command returned non 0 return code stderr/stdout was:bash: aws: command not found"
. 此输出仅针对此简化命令显示。
任何有关如何调试的建议将不胜感激。