Skip to content

Kubernetes Python Client Returns "Running" Status for Terminating Pods Instead of "Terminating" #2397

Open
@RichwithPoor

Description

@RichwithPoor

When using list_namespaced_pod() or list_pod_for_all_namespaces() from the Python Kubernetes client, pods that are in the process of being deleted (showing "Terminating" status in kubectl) continue to report their status as "Running" until they completely disappear from the cluster.

What happened:
When a pod is being deleted (kubectl delete pod )
kubectl get pods correctly shows status "Terminating"
However, both list_namespaced_pod() and list_pod_for_all_namespaces() keep reporting the status as "Running"
This persists until the pod is completely removed from the cluster

What you expected to happen:
The Python client should return "Terminating" status when a pod is in the deletion process, matching kubectl behavior

Environment:

  • Kubernetes version (kubectl version): v1.31.0
  • OS (e.g., MacOS 10.13.6): Macbook 14.5 (23F79)
  • Python version (python --version) Python 3.12.2
  • Python client version (pip list | grep kubernetes) 32.0.1

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions