kubernetes_asyncio
Asyncio-based Python client library for the Kubernetes API, built on aiohttp.
Repository Health
Technical Analysis
kubernetes_asyncio is an asynchronous Python client for the Kubernetes API. It mirrors the official kubernetes-client/python library but is generated with an async-aware OpenAPI generator and built on aiohttp, so every API call is a non-blocking coroutine suitable for asyncio applications.
The library covers the full Kubernetes API surface — pods, deployments, services, and other resources — plus configuration loading from kubeconfig or in-cluster service accounts, resource watches, exec/log streaming, leader election, and a dynamic client for custom resources.
What You Get
- A fully async client covering the complete Kubernetes API surface
- Config loading from kubeconfig files or in-cluster service accounts
- Resource watch support for streaming add/update/delete events
- A dynamic client, leader election, and exec/log streaming utilities
Common Use Cases
- Managing Kubernetes resources from asyncio-based Python services and operators
- Watching cluster resources for changes without blocking the event loop
- Streaming pod logs or exec sessions inside async tooling
Under The Hood
Architecture - The client package holds the OpenAPI-generated api methods, models, and an aiohttp-backed api_client; config resolves credentials from kubeconfig or in-cluster tokens, while watch, stream, dynamic, and leaderelection modules layer higher-level async capabilities over the raw client. Tech Stack - Pure Python 3.10+ built on aiohttp for the async HTTP transport, generated from Kubernetes’ swagger spec via an asynchronous fork of the OpenAPI generator; packaged with setuptools/pyproject. Code Quality - The repo carries an extensive test suite plus e2e tests (e2e_test/), CI, and codecov reporting, and ships py.typed for type checking; it is actively maintained by 50+ contributors. API Design - The surface intentionally parallels the official synchronous client, so users familiar with kubernetes-client/python adapt quickly — the main change is awaiting calls and using async with for the API client — giving an ergonomic path to async Kubernetes access.