Kubernetes pod operator: More than one pod running with labels
See original GitHub issueApache Airflow version: 1.10.11
Kubernetes version (if you are using kubernetes) (use kubectl version
):
Server Version: version.Info{Major:"1", Minor:"17+", GitVersion:"v1.17.9-eks-4c6976", GitCommit:"4c6976793196d70bc5cd29d56ce5440c9473648e", GitTreeState:"clean", BuildDate:"2020-07-17T18:46:04Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}
Environment:
- Cloud provider or hardware configuration: AWS
- OS (e.g. from /etc/os-release): not relevant
- Kernel (e.g.
uname -a
): not relevant - Install tools: not relevant
- Others: not relevant
What happened:
When launching a failing kubernetesPodOperator job with 4 retries you get the following message on the second retry. This is because the failed pods still exist on kubernetes and thus the list call in the pod operator:
pod_list = client.list_namespaced_pod(self.namespace, label_selector=label_selector)
Also returns the failed objects. A fix would be to filter on only pods that are not completed or failed.
[2020-08-25 08:51:17,856] {taskinstance.py:1150} ERROR - Pod Launching failed: More than one pod running with labels: dag_id=sample-python-failing,execution_date=2020-08-24T0300000000-71ba3e273,task_id=ingest-weather
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/airflow/contrib/operators/kubernetes_pod_operator.py", line 276, in execute
'{label_selector}'.format(label_selector=label_selector))
airflow.exceptions.AirflowException: More than one pod running with labels: dag_id=sample-python-failing,execution_date=2020-08-24T0300000000-71ba3e273,task_id=ingest-weather
What you expected to happen:
To start my container anew.
How to reproduce it: To reproduce start a dag with a kubernetespodoperator with retries that fails. Set the retries to more then 2 as it starts happening on the thrid try.
Anything else we need to know:
I will make a PR myself to fix this.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Use the KubernetesPodOperator | Cloud Composer
This page describes how to use the KubernetesPodOperator to launch Kubernetes pods from Cloud Composer into the Google Kubernetes Engine cluster that is...
Read more >More than one pod running with labels - The Mail Archive
... on issue #10544: Kubernetes pod operator: More than one pod running with labels ... found a running pod with labels {'dag_id': 'xxxx, ......
Read more >airflow.contrib.operators.kubernetes_pod_operator
If more than one secret is required, provide a comma separated list: ... Volume] :param labels: labels to apply to the Pod :type...
Read more >Assigning Pods to Nodes - Kubernetes
You can constrain a Pod using labels on other Pods running on the node (or other topological domain), instead of just node labels, ......
Read more >Use the KubernetesPodOperator | Astronomer Documentation
Use the KubernetesPodOperator in Airflow to run tasks in Kubernetes Pods. ... To get the most out of this guide, you should have...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The problem still exists on Airflow version 1.10.14+composer
We’ve tested this with
1.10.12
which includes the #10230 fix, and the issue still exists. When the first job errors out, the subsequent retries reattach to the errored out pod.The pod is in
Error
status in the cluster so should not be considered a candidate for re-attachment.