raphaelauv opened a new issue, #29488:
URL: https://github.com/apache/airflow/issues/29488

   ### Apache Airflow Provider(s)
   
   cncf-kubernetes
   
   ### Versions of Apache Airflow Providers
   
   5.2.0
   
   ### Apache Airflow version
   
   2.5.1
   
   ### Operating System
   
   linux 5.15.0-60-generic - Ubuntu 22.04
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   _No response_
   
   ### What happened
   
   airflow connection - kubernetes_default ->
   
   ```json
   {
       "conn_type": "kubernetes",
       "extra": "{\"extra__kubernetes__in_cluster\": false, 
\"extra__kubernetes__kube_config_path\": \"/opt/airflow/include/.kube/config\", 
\"extra__kubernetes__namespace\": \"default\", 
\"extra__kubernetes__cluster_context\": \"kind-kind\", 
\"extra__kubernetes__disable_verify_ssl\": false, 
\"extra__kubernetes__disable_tcp_keepalive\": false}"
   }
   ```
   
   ```python
   from pendulum import today
   from airflow import DAG
   from airflow.providers.cncf.kubernetes.operators.kubernetes_pod import 
KubernetesPodOperator
   from kubernetes.client import V1ResourceRequirements
   
   dag = DAG(
       dag_id="kubernetes_dag",
       schedule_interval="0 0 * * *",
       start_date=today("UTC").add(days=-1)
   )
   
   with dag:
       cmd = "echo toto && sleep 10 && echo finish"
   
       KubernetesPodOperator(
           task_id="task-a",
           namespace="default",
           kubernetes_conn_id="kubernetes_default",
           name="airflow-test-pod",
           image="alpine:3.16.2",
           cmds=["sh", "-c", cmd],
           is_delete_operator_pod=True,
           deferrable=True,
           get_logs=True,
       )
       KubernetesPodOperator(
           task_id="task-B",
           namespace="default",
           kubernetes_conn_id="kubernetes_default",
           name="airflow-test-pod",
           image="alpine:3.16.2",
           cmds=["sh", "-c", cmd],
           is_delete_operator_pod=True,
           get_logs=True,
       )
   ```
   
   ```log
   [2023-02-12, 09:53:24 UTC] {taskinstance.py:1768} ERROR - Task failed with 
exception
   Traceback (most recent call last):
     File 
"/home/airflow/.local/lib/python3.10/site-packages/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py",
 line 611, in execute_complete
       raise AirflowException(event["message"])
   airflow.exceptions.AirflowException: Invalid kube-config file. Expected key 
contexts in kube-config
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File 
"/home/airflow/.local/lib/python3.10/site-packages/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py",
 line 630, in execute_complete
       self.post_complete_action(
     File 
"/home/airflow/.local/lib/python3.10/site-packages/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py",
 line 654, in post_complete_action
       self.cleanup(
     File 
"/home/airflow/.local/lib/python3.10/site-packages/airflow/providers/cncf/kubernetes/operators/kubernetes_pod.py",
 line 673, in cleanup
       raise AirflowException(
   airflow.exceptions.AirflowException: Pod airflow-test-pod-vw8fxf25 returned 
a failure:
   ```
   
   
   ```
   ```
   
   ### What you think should happen instead
   
   deferrable KPO should work same as KPO and not fail
   
   ### How to reproduce
   
   _No response_
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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]

Reply via email to