将 helm chart 从 public 存储库迁移到私有

Migrate helm chart from public repository to private

我正在尝试在 AWS EKS 上使用 helm chart 部署一些服务。

$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm install postgresql --version 8.6.4 bitnami/postgresql

在我 运行 helm 命令之后,没有创建 pod,因为与 docker.io 的连接在 EKS 中被阻止。

$ kubectl describe po 
...
Events:
  Type     Reason                  Age                  From                     Message
  ----     ------                  ----                 ----                     -------
  Normal   Scheduled               12m                  default-scheduler        Successfully assigned airflow/postgresql-postgresql-0 to xxxxxx.compute.internal
  Normal   SuccessfulAttachVolume  12m                  attachdetach-controller  AttachVolume.Attach succeeded for volume "pvc-e3e438ef-50a4-4c19-a788-3d3755b89bae"
  Normal   Pulling                 9m50s (x4 over 12m)  kubelet                  Pulling image "docker.io/bitnami/postgresql:11.7.0-debian-10-r26"
  Warning  Failed                  9m35s (x4 over 11m)  kubelet                  Failed to pull image "docker.io/bitnami/postgresql:11.7.0-debian-10-r26": rpc error: code = Unknown desc = Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
  Warning  Failed                  9m35s (x4 over 11m)  kubelet                  Error: ErrImagePull
  Warning  Failed                  9m23s (x6 over 11m)  kubelet                  Error: ImagePullBackOff
  Normal   BackOff                 113s (x36 over 11m)  kubelet                  Back-off pulling image "docker.io/bitnami/postgresql:11.7.0-debian-10-r26"

如何将存储库域从 docker.io 更改为我的 ECR 存储库?

  1. 我想将此图表推送到我的 ECR 存储库。
  2. 我想制作图表而不是从 docker.io 而是从我的 ECR 存储库中提取图像。

尝试使用 --set 覆盖 bitnami/postgresql 的 values.yaml 中的存储库域值怎么样?请参阅 here 了解更多详情。

image:
  registry: docker.io
  repository: bitnami/postgresql
  tag: 11.10.0-debian-10-r24

您可以按如下方式覆盖 image.registry 以上的值。

$ helm install postgresql \
  --set image=your-registry/bitnami/postgresql:11.10.0-debian-10-r24 \
  --version 8.6.4 bitnami/postgresql