Asynchronous Kubernetes Client for asyncio and Python 3.6+.

Key Features

Library Installation

$ pip install aiokubernetes

Getting Started

"""Print the name of all pods in the cluster."""
import asyncio

import aiokubernetes as k8s

async def main():
    # Create a client instance and load the credentials from ~/.kube/kubeconfig
    api_client = k8s.config.new_client_from_config()

    # Ask for all Pods.
    v1 = k8s.api.CoreV1Api(api_client)
    ret = await v1.list_pod_for_all_namespaces()

    # Ensure the API call to Kubernetes succeeded.
    assert ret.http.status == 200

    # Print the pod names.
    for i in ret.obj.items:
        print(f"{i.metadata.namespace} {i.metadata.name}")

    # Terminate the connection pool for a clean shutdown.
    await api_client.session.close()

if __name__ == '__main__':
    loop = asyncio.get_event_loop()

More examples are available here.

Source code

The project is hosted on GitHub

Please feel free to file an issue on the bug tracker if you have found a bug or have some suggestion in order to improve the library.

The library uses Travis for Continuous Integration.


Feel free to improve this package and send pull requests to GitHub.


The aiokubernetes package is Apache 2 licensed and freely available.

Table Of Contents