Sti*_*ing 6 amazon-ecr kubernetes-helm
我们在 AWS 上有一个 ecr 存储库。其中包含所有舵图。此 ecr 受到保护,有人为我分配了一个角色。这个角色允许我从 aws cli 控制台获取所有图像。
现在我正在使用 helm 来部署图表。所以对于我使用的以下代码。当我运行 helm dep update 命令时,这只拉取 postgres 图像和测试图表请求失败,并出现错误 401。
我知道我需要在某个地方提到 aws 凭证,但不知道应该在哪里使用它。还有一件事,如果有人能告诉我如何使用 AWS 访问令牌来访问它,那就太好了。
dependencies:
- name: postgresql
version: 9.2.1
repository: https://charts.bitnami.com/bitnami
condition: postgresql.enabled
- name: createdb
version: latest
repository: https://111.ecr.eu-central-1.amazonaws.com/test-chart
Run Code Online (Sandbox Code Playgroud)
Jun*_*aid 12
从版本3.7+开始,从任何 OCI 兼容注册表存储/拉取/安装图表不再是实验性的
使用 ECR,登录后:
$ aws ecr get-login-password --region eu-west-1 | helm registry login \
--username AWS --password-stdin 12345678910.dkr.ecr.eu-west-1.amazonaws.com
Run Code Online (Sandbox Code Playgroud)
您可以通过以下方式提取图表:
$ helm pull \
oci://12345678910.dkr.ecr.eu-west-1.amazonaws.com/my/helm/chart --version 0.1.19
Pulled: 12345678910.dkr.ecr.eu-west-1.amazonaws.com/my/helm/chart:0.1.19
Digest: sha256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Run Code Online (Sandbox Code Playgroud)
经头盔测试3.9.0
Helm 客户端版本 3 现在支持 ECR 作为 Helms 图表存储库。尽管如此,目前任何基于 OCI 的注册表支持在 Helms 官方文档中都被认为是实验性的。
假设您拥有所需的权限并且已经将 Helm Chart 推送到 ECR(如果没有,请按照此处的aws ecr describe-images文档进行操作),您可以(可选)快速获取 ECR 存储库上 Helm Chart 的可用标签列表。
aws ecr describe-images --repository-name <your-repo-name> --region <region> --profile <profile>
{
"imageDetails": [
{
"registryId": "************",
"repositoryName": "<your-repo-name>",
"imageDigest": "sha256:******************************************",
"imageTags": [
"0.1.6"
],
"imageSizeInBytes": 3461,
"imagePushedAt": "2021-04-07T00:16:31+01:00",
"imageManifestMediaType": "application/vnd.oci.image.manifest.v1+json",
"artifactMediaType": "application/vnd.cncf.helm.config.v1+json"
}
]
}
Run Code Online (Sandbox Code Playgroud)
获取 ECR 令牌并登录 helm 存储库:
aws ecr get-login-password --region <region> | helm registry login --username AWS --password-stdin <aws_account_id>.dkr.ecr.<region>.amazonaws.com
Run Code Online (Sandbox Code Playgroud)
获得所需的详细信息后,您可以运行helm chart pull命令从 ECR 中提取图表。
helm chart pull <aws_account_id>.dkr.ecr.<region>.amazonaws.com/<your-repo-name>:0.1.6
0.1.6: Pulling from <aws_account_id>.dkr.ecr.<region>.amazonaws.com/<your-repo-name>
ref: <aws_account_id>.dkr.ecr.<region>.amazonaws.com/<your-repo-name>:0.1.6
digest: d16af8672604ebe54********************************************
size: 3.2 KiB
name: <your-chart-name>
version: 0.1.6
Status: Chart is up to date for <aws_account_id>.dkr.ecr.<region>.amazonaws.com/<your-repo-name>:0.1.6
Run Code Online (Sandbox Code Playgroud)
核实:
helm chart list
REF NAME VERSION DIGEST SIZE CREATED
<aws_account_id>.dkr.ecr.<region>.amazonaws.com/<your-repo-name>... <your-chart-name> 0.1.6 50f03e4 3.2 KiB 22 second
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
14487 次 |
| 最近记录: |