gpt4 book ai didi

kubernetes - Airflow KubePodOperator 从私有(private)仓库拉取镜像

转载 作者:行者123 更新时间:2023-12-02 12:02:57 25 4
gpt4 key购买 nike

Apache Airflow 的 KubernetesPodOperator从私有(private)存储库中提取 docker 镜像?
KubernetesPodOperator有一个 image_pull_secrets您可以通过 Secrets对象与私有(private)存储库进行身份验证。但是 secrets 对象只能表示一个环境变量或一个卷 - 这两者都不符合我对 Kubernetes 如何使用 secret 对私有(private) repos 进行身份验证的理解。

使用 kubectl您可以使用类似的东西创建所需的 secret

$ kubectl create secret docker-registry $SECRET_NAME \
--docker-server=https://${ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com \
--docker-username=AWS \
--docker-password="${TOKEN}" \
--docker-email="${EMAIL}"

但是如何在 Airflow 中创建身份验证 key ?

最佳答案

secret带有 docker-registry 的对象根据 Kubernetes 输入 documentation可用于对私有(private)存储库进行身份验证。
正如您在问题中提到的那样;您可以使用 kubectl创建 docker-registry的 secret 类型 然后您可以尝试通过 image_pull_secrets .
但是,根据您使用的平台,可能有 有限完全没用根据 kubernetes documentation :

Configuring Nodes to Authenticate to a Private Registry

Note: If you are running on Google Kubernetes Engine, there will already be a .dockercfg on each node with credentials for Google Container Registry. You cannot use this approach.

Note: If you are running on AWS EC2 and are using the EC2 Container Registry (ECR), the kubelet on each node will manage and update the ECR login credentials. You cannot use this approach.

Note: This approach is suitable if you can control node configuration. It will not work reliably on GCE, and any other cloud provider that does automatic node replacement.

Note: Kubernetes as of now only supports the auths and HttpHeaders section of docker config. This means credential helpers (credHelpers or credsStore) are not supported.


在上述平台上进行这项工作是可能的,但需要自动化脚本和第三方工具。
就像在 Amazon ECR 示例中一样: Amazon ECR Docker Credential Helper需要定期将 AWS 凭证提取到 docker 注册表配置,然后使用另一个脚本来更新 kubernetes docker-registry secret 。
至于 Airflow 本身,我认为它没有创建自己的 docker-repository secret 的功能。
您可以在 Apache Airflow JIRA 中请求类似的功能.
附言
如果您的 K8s 集群仍然存在问题,您可能需要在堆栈上创建新问题来解决这些问题。

关于kubernetes - Airflow KubePodOperator 从私有(private)仓库拉取镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58293057/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com