functicons commented on issue #34644:
URL: https://github.com/apache/airflow/issues/34644#issuecomment-1815764689
I reproduced the problem with the following DAG:
```
from airflow.providers.cncf.kubernetes.operators.pod import
KubernetesPodOperator
import airflow
from airflow import DAG
from datetime import timedelta
default_args = {
'start_date': airflow.utils.dates.days_ago(0),
'retries': 1,
'retry_delay': timedelta(minutes=5)
}
with DAG(
'kpo',
default_args=default_args,
description='KPO',
schedule_interval='@once',
max_active_runs=2,
catchup=False,
dagrun_timeout=timedelta(minutes=10),
) as dag:
task1 = KubernetesPodOperator(
name="deferrable-true",
image="python:3.11-slim",
cmds=['python', '-c', "print('hello world deferrable=true')"],
task_id="deferrable-true",
config_file="/home/airflow/composer_kube_config",
deferrable=True,
in_cluster=False
)
task1
```
Very interesting. **The container actually succeeded**, we can see
`Container logs: hello world deferrable=true` in logs but the error happened
after that.
```
Running: ['airflow', 'tasks', 'run', 'kpo', 'deferrable-true',
'scheduled__2023-11-17T00:00:00+00:00', '--job-id', '5896', '--raw',
'--subdir', 'DAGS_FOLDER/kpo.py', '--cfg-path', '/tmp/tmp5vwp6_0t']
Container logs: hello world deferrable=true
2023-11-17 05:03:48.808 UTC
Container logs:
2023-11-17 05:03:48.826 UTC
Pod deferrable-true-b6ju3o4y has phase Pending
2023-11-17 05:03:50.852 UTC
Deleting pod: deferrable-true-b6ju3o4y
2023-11-17 05:03:51.075 UTC
Task failed with exception Traceback (most recent call last): File
"/opt/python3.8/lib/python3.8/site-packages/airflow/providers/cncf/kubernetes/operators/pod.py",
line 648, in execute_complete raise AirflowException(event["message"])
airflow.exceptions.AirflowException: Invalid kube-config file. Expected key
current-context in kube-config
2023-11-17 05:03:51.083 UTC
Marking task as FAILED. dag_id=kpo, task_id=deferrable-true,
execution_date=20231117T000000, start_date=20231117T050342,
end_date=20231117T050351
2023-11-17 05:03:51.121 UTC
Failed to execute job 5896 for task deferrable-true (Invalid kube-config
file. Expected key current-context in kube-config; 1262793)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]