气流 KubernetesPodOperator AirflowException('Pod Launching failed: {error}'.format(error=ex))

Airflow KubernetesPodOperator AirflowException('Pod Launching failed: {error}'.format(error=ex))

我是 运行 一个 KubernetesPodOperator,有一个用 microk8s 导入的自定义 docker 图像。当 运行 气流中的 DAG 时,我会看到以下日志,直到收到超时消息 AirflowException('Pod Launching failed: {error}'.format(error=ex))

[2020-04-14 23:06:39,875] {logging_mixin.py:95} INFO - [[34m2020-04-14 23:06:39,875[0m] {[34mpod_launcher.py:[0m141} INFO[0m - Event: [1mk8s-pod-ml-3a541375[0m had an event of type [1mPending[0m[0m

在 ubuntus 终端上搜索我 运行 microk8s kubectl get pods 的问题并得到:

如您所见,pod 的名称在日志中几乎完全相同(除了开头的 1m 之外),但状态为 ErrImageNeverPull。除了 this 上面写着“KubernetesPodOperator 的默认超时是 120 秒,这可能会导致在较大的图像下载之前发生超时,我在内部找不到关于该状态或错误的任何信息。 ' 我将默认超时更改为 600 秒,但没有用。

问题

Microk8s 无法访问 docker。我通过 运行 microk8s.inspect 发现了它并获得了

WARNING:  Docker is installed. 
File "/etc/docker/daemon.json" does not exist. 
You should create it and add the following lines: 
{
    "insecure-registries" : ["localhost:32000"] 
}

and then restart docker with: sudo systemctl restart docker
Building the report tarball
  Report tarball is at /var/snap/microk8s/1320/inspection-report-20200415_141500.tar.gz

按照警告说的那样进行操作后,airflow 设法将映像部署到 pod 中。