[英]Airflow Kubernetes Executor logs
我已经使用stable/airflow
airflow helm 图在 Kubernetes 上部署了 Airflow 实例。 我稍微修改了puckel/docker-airflow
映像,以便能够安装 Kubernetes 执行器。 现在所有任务都在我们的 Kubernetes 集群上成功执行,但是找不到这些任务的日志。
我想将日志上传到我们的 Azure Blob 存储帐户。 我已经像这样配置了我的环境变量:
AIRFLOW__CORE__REMOTE_BASE_LOG_FOLDER="wasb-airflow"
AIRFLOW__CORE__REMOTE_LOG_CONN_ID="wasb_default"
AIRFLOW__CORE__REMOTE_LOGGING="True"
wasb_default
连接包括 Azure Blob 存储帐户的登录名和密码。 我已经使用WasbHook
测试了这个连接,并且能够成功删除一个虚拟文件。
当我尝试查看日志时,会显示以下消息:
*** Log file does not exist: /usr/local/airflow/logs/example_python_operator/print_the_context/2019-11-29T15:42:25+00:00/1.log
*** Fetching from: http://examplepythonoperatorprintthecontext-4a6e6a1f11fd431f8c2a1dc081:8793/log/example_python_operator/print_the_context/2019-11-29T15:42:25+00:00/1.log
*** Failed to fetch log file from worker. HTTPConnectionPool(host='examplepythonoperatorprintthecontext-4a6e6a1f11fd431f8c2a1dc081', port=8793): Max retries exceeded with url: /log/example_python_operator/print_the_context/2019-11-29T15:42:25+00:00/1.log (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f34ecdbe990>: Failed to establish a new connection: [Errno -2] Name or service not known'))
关于如何解决这个问题的任何想法?
找到了解决办法。 将AIRFLOW__WEBSERVER__LOG_FETCH_TIMEOUT_SEC
环境变量增加到 15 之类的值。
首先,你的 ENV VARS 需要遵循这个结构
AIRFLOW__VAR__YOUR_VARIABLE_NAME
例如
AIRFLOW__VAR__CORE__REMOTE_BASE_LOG_FOLDER="wasb-airflow"。
如果您正在使用 helm 图表,您可以修改 values.yaml 或使用 set tags 到您的 helm upgrade 命令
修改值。yaml
helm 显示值 apache-airflow/airflow > values.yaml
然后在 values.yaml 中修改文件末尾的日志部分,它是这样的:
logs:
persistence:
enabled: true
# Volume size for logs
size: 100Gi
# If using a custom storageClass, pass the name here
storageClassName: YOUR_STORAGE_CLASS
## the name of an existing PVC to use
existingClaim: YOUR_EXISTING_CLAIM
然后应用升级命令,例如
helm upgrade --install airflow apache-airflow/airflow --namespace $YOUR_NAMESPACE -f values.yaml
用命令
helm upgrade --install airflow apache-airflow/airflow --namespace $YOUR_NAMESPACE --set logs.persistence.enabled=true --set logs.persistence.size=10Gi --set logs.persistence.storageClassName=azurefile --set logs .persistence.existingClaim=YOUR_CLAIM_NAME
如果您想查看 azure 中可用的 storageClass,请运行以下命令
kubectl 获取 sc
您将收到默认存储类的列表
如果您需要创建 PVC,请遵循此文档页面
https://docs.microsoft.com/en-us/azure/aks/azure-files-dynamic-pv
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.