【问题标题】:How to deploy airflow via Helm on Kubernetes while using a custom image?使用自定义镜像时如何在 Kubernetes 上通过 Helm 部署气流?
【发布时间】:2020-12-10 10:19:01
【问题描述】:

我的目标是能够使用自定义映像(放置在 ECR 中)在 Kubernetes 上部署气流。我想使用此自定义映像的原因是因为我想部署另一个带有气流的工具 (dbt)容器(也可以在那里接受其他建议)

实际效果: 我已经设法使用this Helm chart(默认使用以下image)来部署

我尝试过但没有成功: 我现在想用我在 ECR 中的自定义图像交换默认的image,所以我创建了values.yaml,其中包含:

airflow:
  image:
    repository: 000000000.dkr.ecr.eu-central-1.amazonaws.com/foo/meow
    tag: latest

然后跑:

helm upgrade airflow-pod airflow-stable/airflow --version "7.14.0" --values values.yaml

我希望覆盖默认的 yaml 并从 ECR 中提取图像。然后我运行describe pod airflow-pod,发现错误日志如下(sn-p):

  Type     Reason     Age                   From               Message
  ----     ------     ----                  ----               -------
  Normal   Scheduled  12m                   default-scheduler  Successfully assigned 000000000.dkr.ecr.eu-central-1.amazonaws.com/foo/meow to ip-10-0-0-0eu-central-1.compute.internal
  Normal   Pulling    12m                   kubelet            Pulling image "000000000.dkr.ecr.eu-central-1.amazonaws.com/foo/meow:latest"
  Normal   Pulled     11m                   kubelet            Successfully pulled image "000000000.dkr.ecr.eu-central-1.amazonaws.com/foo/meow:latest"
  Normal   Created    9m39s (x5 over 11m)   kubelet            Created container airflow-web
  Normal   Pulled     9m39s (x4 over 11m)   kubelet            Container image "000000000.dkr.ecr.eu-central-1.amazonaws.com/foo/meow:latest" already present on machine
  Warning  Failed     9m38s (x5 over 11m)   kubelet            Error: failed to start container "airflow-web": Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "/usr/bin/dumb-init": stat /usr/bin/dumb-init: no such file or directory: unknown

我尝试确认/解决问题的方法

首先,我尝试查看这是否是 ECR 问题。于是我把同样的original image放到了ECR中(而不是我自己用dbt的图片),发现上面同样的错误依然存在。

其次,我挖掘并发现了以下 question,这让我觉得我不能使用来自 ECR 回购(非官方)的气流舵 chart

我最后采用的另一种方法: 我尝试使用chart on the Apache airflow repo 之类的:

helm install airflow . --namespace airflow-deploy --set executor=CeleryExecutor --set workers.keda.enabled=true --set workers.persistence.enabled=false

但我得到了错误:

Error: failed post-install: timed out waiting for the condition

【问题讨论】:

    标签: kubernetes airflow


    【解决方案1】:

    原始图像似乎包含“dumb-init”二进制文件,所以它应该可以工作。但是,如果您使用“imagePullPolicy: IfNotPresent”,那么 Kubernetes 可能会缓存该图像,即使您将新图像重新上传到 ECR,它也可能不会被拉取(尽管我相信它应该是最新的,除非 Kubernetes 的一些自定义配置就位。

    https://kubernetes.io/docs/concepts/containers/images/#updating-images

    您始终可以在本地运行映像并检查其内容。 Airflow官方Docker镜像已经支持bash命令:

    docker run -it apache/airflow:1.10.12-python3.6 bash
    airflow@18278a339579:/opt/airflow$ /usr/bin/dumb-init --help
    dumb-init v1.2.2
    Usage: /usr/bin/dumb-init [option] command [[arg] ...]
    dumb-init is a simple process supervisor that forwards signals to children.
    It is designed to run as PID1 in minimal container environments.
    Optional arguments:
       -c, --single-child   Run in single-child mode.
                            In this mode, signals are only proxied to the
                            direct child and not any of its descendants.
       -r, --rewrite s:r    Rewrite received signal s to new signal r before proxying.
                            To ignore (not proxy) a signal, rewrite it to 0.
                            This option can be specified multiple times.
       -v, --verbose        Print debugging information to stderr.
       -h, --help           Print this help message and exit.
       -V, --version        Print the current version and exit.
    Full help is available online at https://github.com/Yelp/dumb-init
    

    【讨论】:

      猜你喜欢
      • 2021-11-12
      • 2019-02-28
      • 1970-01-01
      • 2020-03-20
      • 2018-11-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多