Laerte opened a new issue, #45047: URL: https://github.com/apache/airflow/issues/45047
### Apache Airflow Provider(s) cncf-kubernetes ### Versions of Apache Airflow Providers apache-airflow-providers-cncf-kubernetes==8.3.4 ### Apache Airflow version v2.9.1 ### Operating System Debian GNU/Linux 11 (bullseye) ### Deployment Google Cloud Composer ### Deployment details _No response_ ### What happened xcom sidecar container fail to terminate because it tries to kill pid 1: https://github.com/apache/airflow/blob/09d8a803ca3f76d8598e7eeeb86397cf1cd4076d/providers/src/airflow/providers/cncf/kubernetes/utils/pod_manager.py#L858 But fail: ``` [2024-12-18, 16:26:28 UTC] {pod_manager.py:725} INFO - Checking if xcom sidecar container is started. [2024-12-18, 16:26:28 UTC] {pod_manager.py:728} INFO - The xcom sidecar container is started. [2024-12-18, 16:26:29 UTC] {pod_manager.py:805} INFO - Running command... if [ -s /***/xcom/return.json ]; then cat /***/xcom/return.json; else echo __***_xcom_result_empty__; fi [2024-12-18, 16:26:30 UTC] {pod_manager.py:805} INFO - Running command... kill -2 1 [2024-12-18, 16:26:30 UTC] {pod_manager.py:815} INFO - stderr from command: sh: can't kill pid 1: Permission denied [2024-12-18, 16:26:30 UTC] {pod.py:586} INFO - xcom result: {"hello": "world"} ``` This happen because when we use `shareProcessName` process will not run as PID 1. ### What you think should happen instead The xcom sidecar container should terminate gracefully, maybe we should switch the command to `kill -9 $(pgrep -f trap)` by default? ### How to reproduce Create a task using `GKEStartPodOperator` and set `full_pod_spec` on `V1PodSpec` set `share_process_namespace` to `True` ```python GKEStartPodOperator( task_id="gke-pod", do_xcom_push=True, full_pod_spec=k8s.V1Pod( spec=k8s.V1PodSpec( share_process_namespace=True, containers=[ k8s.V1Container( name="container1", image="alpine", command=["sh", "-c"], args=[ """mkdir -p /airflow/xcom && echo '{"Hello": "World"}' > /airflow/xcom/return.json && echo 'Done'""", ], ), k8s.V1Container( name="container2", image="alpine", command=["sh", "-c"], args=["sleep 15"], ), ], ), ), ) ``` ### Anything else Every time. ### Are you willing to submit PR? - [X] 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]
