kubernetes-asyncio 35.0.1


pip install kubernetes-asyncio

  Latest version

Released: Feb 25, 2026

Project Links

Meta
Author: Tomasz Prus
Requires Python: >=3.10

Classifiers

Development Status
  • 5 - Production/Stable

Intended Audience
  • Developers
  • Information Technology

License
  • OSI Approved :: Apache Software License

Operating System
  • OS Independent

Programming Language
  • Python
  • Python :: 3
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13

Topic
  • Utilities

Kubernetes Python Client

Build status PyPI version Docs codecov pypi supported versions Client Capabilities Client Support Level

Asynchronous (AsyncIO) client library for the Kubernetes API.

This library is created in the same way as official https://github.com/kubernetes-client/python but uses asynchronous version of OpenAPI generator. My motivation is described here: https://github.com/kubernetes-client/python/pull/324

Installation

From PyPi directly:

pip install kubernetes_asyncio

It requires Python 3.10+

Example

To list all pods:

import asyncio
from kubernetes_asyncio import client, config
from kubernetes_asyncio.client.api_client import ApiClient


async def main():
    # Configs can be set in Configuration class directly or using helper
    # utility. If no argument provided, the config will be loaded from
    # default location.
    await config.load_kube_config()

    # use the context manager to close http sessions automatically
    async with ApiClient() as api:

        v1 = client.CoreV1Api(api)
        print("Listing pods with their IPs:")
        ret = await v1.list_pod_for_all_namespaces()

        for i in ret.items:
            print(i.status.pod_ip, i.metadata.namespace, i.metadata.name)


if __name__ == '__main__':
    asyncio.run(main())

More complicated examples, like asynchronous multiple watch or tail logs from pods, you can find in examples/ folder.

Documentation

https://kubernetes-asyncio.readthedocs.io/

Compatibility

This library is generated in the same way as the official Kubernetes Python Library. It uses swagger-codegen and the same concepts like streaming, watching or reading configuration. Because of an early stage of this library some differences still exist:

synchronous library kubernetes-client/python this library
authentication method gcp-token, azure-token, user-token, oidc-token, user-password, in-cluster gcp-token (only via gcloud command), user-token, oidc-token, user-password, in-cluster
streaming data via websocket from PODs bidirectional read-only is already implemented

Microsoft Windows

In case this library is used against Kubernetes cluster using client-go credentials plugin, the default asyncio event loop is SelectorEventLoop. This event loop selector, however, does NOT support pipes and subprocesses, so exec_provider.py::ExecProvider is failing. In order to avoid failures the ProactorEventLoop has to be selected. The ProactorEventLoop can be enabled via WindowsProactorEventLoopPolicy.

Application's code needs to contain following code:

import asyncio

asyncio.set_event_loop_policy(
    asyncio.WindowsProactorEventLoopPolicy()
)

Versions

This library is versioned in the same way as the synchronous library. The schema version has been changed with version v18.20.0. Now, first two numbers from version are Kubernetes version (v.1.18.20). The last number is for changes in the library not directly connected with K8s.

Development

# Create and activate virtual environment
uv venv
source .venv/bin/activate

# Install dependencies
uv sync

# Run ruff
ruff check .
ruff format --diff .

# Run tests
pytest
35.0.1 Feb 25, 2026
35.0.0 Feb 13, 2026
34.3.3 Jan 12, 2026
34.3.2 Jan 11, 2026
34.3.1 Jan 11, 2026
34.3.0 Jan 11, 2026
33.3.0 Aug 11, 2025
32.3.2 Apr 30, 2025
32.3.1 Apr 30, 2025
32.3.0 Mar 30, 2025
32.0.0 Dec 17, 2024
31.1.1 Dec 08, 2024
31.1.0 Sep 14, 2024
30.3.1 Aug 10, 2024
30.3.0 Jul 31, 2024
30.1.1 Jun 30, 2024
30.1.0 Jun 09, 2024
29.0.1 Jun 28, 2024
29.0.0 Jan 18, 2024
28.2.1 Nov 18, 2023
28.2.0 Oct 07, 2023
27.6.0 Oct 01, 2023
26.9.0 Sep 24, 2023
25.11.0 Aug 21, 2023
24.2.3 May 01, 2023
24.2.2 Aug 22, 2022
24.2.1 Aug 17, 2022
24.2.0 Jul 29, 2022
23.6.0 Jun 17, 2022
22.6.5 May 24, 2022
22.6.4 Apr 09, 2022
22.6.3 Apr 05, 2022
22.6.2 Mar 29, 2022
22.6.1 Mar 22, 2022
22.6.0 Mar 17, 2022
21.7.1 Mar 10, 2022
21.7.0 Mar 09, 2022
20.13.0 Mar 09, 2022
19.15.1 Feb 02, 2022
19.15.0 Dec 10, 2021
18.20.1 Dec 02, 2021
18.20.0 Sep 05, 2021
12.1.2 Jul 27, 2021
12.1.1 Jul 16, 2021
12.1.0 Mar 25, 2021
12.0.1 Oct 22, 2020
12.0.0 Oct 18, 2020
11.3.0 Jun 07, 2020
11.2.0 Apr 13, 2020
11.1.0 Mar 15, 2020
11.0.0 Feb 26, 2020
10.0.1 Dec 16, 2019
10.0.0 Sep 16, 2019
9.1.0 May 03, 2019
9.0.0 Mar 24, 2019
8.1.0 Feb 22, 2019
8.0.3 Jan 08, 2019
8.0.2 Dec 30, 2018
8.0.1 Dec 09, 2018
8.0.0 Nov 10, 2018
7.0.0 Oct 27, 2018
1.0.0b9 Oct 08, 2018
1.0.0b8 Oct 06, 2018
1.0.0b7 Aug 21, 2018
1.0.0b6 Aug 15, 2018
1.0.0b5 Aug 03, 2018
1.0.0b4 Jul 31, 2018
1.0.0b3 Jul 28, 2018
1.0.0b2 Jul 08, 2018
1.0.0b1 Jun 30, 2018
1.0.0a4 Jun 21, 2018
1.0.0a3 Jun 09, 2018
1.0.0a2 May 19, 2018
Extras: None
Dependencies:
aiohttp (<4.0.0,>=3.9.0)
certifi (>=14.05.14)
python-dateutil (>=2.5.3)
pyyaml (>=3.12)
six (>=1.9.0)
urllib3 (>=1.24.2)