【发布时间】:2022-01-21 06:01:43
【问题描述】:
谁能告诉我如何在本地气流部署中配置 kuberenetes 执行器。我创建了一个名为airflow-cluster 的类集群并创建了pod_template.yaml,并在airflow.cfg 中进行了以下更改。
[kubernetes]
# Path to the YAML pod file that forms the basis for KubernetesExecutor workers.
pod_template_file = /home/caxe/airflow/logs/yamls/pod_template.yaml
worker_container_repository = apache/airflow
worker_container_tag = 2.2.3
namespace = airflow
in_cluster = False
cluster_context = kind-airflow-cluster
config_file = /home/caxe/.kube/config
pod_template.yaml
---
apiVersion: v1
kind: Pod
metadata:
name: dummy-name
spec:
containers:
- env:
- name: AIRFLOW__CORE__EXECUTOR
value: LocalExecutor
# Hard Coded Airflow Envs
- name: AIRFLOW__CORE__SQL_ALCHEMY_CONN
value: postgresql+psycopg2://airflow:airflow@localhost:5432/airflow
image: apache/airflow:2.2.3
imagePullPolicy: IfNotPresent
name: base
volumeMounts:
- mountPath: "/opt/airflow/logs"
name: airflow-logs
- mountPath: "/opt/airflow/dags"
name: airflow-dags
readOnly: true
- mountPath: "/opt/airflow/airflow.cfg"
name: airflow-config
readOnly: true
subPath: airflow.cfg
restartPolicy: Never
securityContext:
runAsUser: 50000
fsGroup: 50000
serviceAccountName: airflow
volumes:
- name: airflow-logs
persistentVolumeClaim:
claimName: logs-pv-claim
- name: airflow-dags
persistentVolumeClaim:
claimName: dag-pv-claim
- configMap:
name: k8s-config
name: airflow-config
不执行。正在运行kubectl get pods -n airflow
NAME READY STATUS RESTARTS AGE
examplebashoperatoralsorunthis.dd577351d4554c87923bc1eabe5e617e 0/1 Pending 0 114s
examplebashoperatorrunme0.afd364b8033643549a29ab536e9fc83f 0/1 Pending 0 116s
examplebashoperatorrunme1.47c97859639543bcab04a2ef0001ee9a 0/1 Pending 0 116s
examplebashoperatorrunme2.7296c3f011624f5ab62c1777187a006f 0/1 Pending 0 115s
examplebashoperatorthiswillskip.b9474f2673524a538ed2fddb6af00dd0 0/1 Pending 0 113s
我不是 kubernetes 人,我已经创建了持久卷并声明了日志和 dag,但我认为非集群 postgres 连接可能存在问题。因为除了在 config 和 yaml 文件中提供值之外,我还没有在集群中配置 postgres。此外,psycopg2 (apache-airflow[postgres]) 安装在本地气流中,但由于我没有修改基本图像apace/airflow:2.2.3,它会丢失吗?
【问题讨论】:
-
我已经取得了相当大的进步。马上分享!!!现在处理日志
标签: linux airflow ubuntu-20.04 airflow-2.x