Skip to content

Scheduler does not release slots correctly when kubernetes sends no reason for container waiting status #60527

Closed

Description

@florian-meyrueis-al

Apache Airflow Provider(s)

cncf-kubernetes

Versions of Apache Airflow Providers

version 10.5.0.

Assuming it affects all version above

Apache Airflow version

2.11.0, 3.x not tested but it's not an airflow core issue, so should be affected too

Operating System

Debian

Deployment

Official Apache Airflow Helm Chart

Deployment details

No response

What happened

In the scheduler logs we receive a series of errors like :

2026-01-11 19:11:33.092 | [2026-01-11T19:11:33.091+0000] {kubernetes_executor_utils.py:98} ERROR - Unknown error in KubernetesJobWatcher. Failing |  
-- | -- | --
  |   | 2026-01-11 19:11:33.092 | Traceback (most recent call last): |  
  |   | 2026-01-11 19:11:33.092 | File "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py", line 91, in run |  
  |   | 2026-01-11 19:11:33.092 | self.resource_version = self._run( |  
  |   | 2026-01-11 19:11:33.092 | ^^^^^^^^^^ |  
  |   | 2026-01-11 19:11:33.092 | File "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py", line 171, in _run |  
  |   | 2026-01-11 19:11:33.092 | self.process_status( |  
  |   | 2026-01-11 19:11:33.092 | File "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py", line 249, in process_status |  
  |   | 2026-01-11 19:11:33.092 | container_status_state["waiting"]["reason"] |  
  |   | 2026-01-11 19:11:33.092 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^ |  
  |   | 2026-01-11 19:11:33.092 | KeyError: 'reason' |  
  |   | 2026-01-11 19:11:33.093 | Process KubernetesJobWatcher-3: |  
  |   | 2026-01-11 19:11:33.093 | Traceback (most recent call last): |  
  |   | 2026-01-11 19:11:33.093 | File "/usr/local/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap |  
  |   | 2026-01-11 19:11:33.093 | self.run() |  
  |   | 2026-01-11 19:11:33.093 | File "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py", line 91, in run |  
  |   | 2026-01-11 19:11:33.094 | self.resource_version = self._run( |  
  |   | 2026-01-11 19:11:33.094 | ^^^^^^^^^^ |  
  |   | 2026-01-11 19:11:33.094 | File "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py", line 171, in _run |  
  |   | 2026-01-11 19:11:33.094 | self.process_status( |  
  |   | 2026-01-11 19:11:33.094 | File "/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/cncf/kubernetes/executors/kubernetes_executor_utils.py", line 249, in process_status |  
  |   | 2026-01-11 19:11:33.094 | container_status_state["waiting"]["reason"] |  
  |   | 2026-01-11 19:11:33.094 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^ |  
  |   | 2026-01-11 19:11:33.094 | KeyError: 'reason'

At this hour most of our dags are started and run for the all night.

In the morning, our monitoring of available slots showed this :

Image

where the blue line is opened execution slots and green line is running execution slots.

The problem is, at that hour (08:00 and after), no dags were running anymore on airflow. Our only solution was to restart the scheduler to get all our opened slots available

What you think should happen instead

The kubernetesjobwatcher should not have crashed because a problem of missing key in the K8s api response and the opened slot should all have been released properly at the end of the dags.

How to reproduce

I don't know.

Anything else

The code of the kubernetes providers should handle correctly optional keys answer from kubernetes.
It this case, k8s api do not enforce "reason" and "message" keys as required in the specification of the ContainerStateWaiting object .

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    kind:bug
    needs-triage
    on Jan 14, 2026
  2. added
    provider:cncf-kubernetes
    on Jan 14, 2026
  3. anishgirianish commented on Jan 19, 2026

    @anishgirianish
    Contributor

    Hi, I'd like to work on this issue. Could I be assigned? Thanks!

  4. added a commit that references this issue on Jan 20, 2026
  5. anishgirianish commented on Jan 20, 2026

    @anishgirianish
    Contributor

    Hi, I've opened #60805 to fix this. Would appreciate a review when you get a chance.

  6. added a commit that references this issue on Feb 5, 2026
  7. added a commit that references this issue on Feb 8, 2026
  8. added a commit that references this issue on Feb 15, 2026
  9. added a commit that references this issue on Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:providersarea:schedulerkind:bugneeds-triageprovider:cncf-kubernetes

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions