--- id: kr8s version: "0.20.15" license: BSD-3-Clause license_treatment: permissive maintenance: active --- # kr8s — A Kubernetes API library License: permissive · Maintenance: active · Downloads: 912.7K/mo ## What it is and what it does kr8s is a Python client for Kubernetes designed to feel familiar to users of kubectl. Instead of wrestling with Swagger-generated code or low-level API calls, you work with human-readable objects and methods that mirror kubectl's command structure. It handles authentication with sensible defaults, reducing boilerplate setup. The library provides both synchronous and asynchronous APIs (compatible with asyncio and trio), client-side caching to avoid redundant API calls, and batteries-included utilities for common tasks like pod execution, port forwarding, node cordoning, and deployment scaling. You can list resources with label selectors, generate objects from templates, and manipulate cluster state in a Pythonic way. Use it for: - Automate cluster operations (scaling deployments, cordoning nodes, adding labels) in Python scripts or applications. - Build monitoring or admin dashboards that query Kubernetes resources without learning the raw API. - Execute commands in pods or set up port forwards programmatically for debugging or data transfer. - Write integration tests that create, inspect, and clean up Kubernetes resources in a familiar syntax. - Migrate kubectl workflows into Python-based CI/CD pipelines or infrastructure-as-code tools. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. A Python client library for Kubernetes that mirrors kubectl's command patterns, offering both sync and async APIs to query, create, and manage cluster resources. Yes. kr8s is actively maintained, has no known vulnerabilities, low install friction, and a permissive license. It solves a real problem—making Kubernetes automation accessible to Python developers without requiring deep API knowledge. The kubectl-inspired design and async support make it suitable for both simple scripts and production automation. ## Install pip install kr8s uv add kr8s poetry add kr8s ## Installing kr8s Before you install: Low friction: pure Python wheel with 11 runtime dependencies (httpx, pyyaml, cryptography, and others) all common and well-maintained. Active maintenance with a recent commit on 2026-08-12 and 963 repository stars. License in practice: BSD-3-Clause is permissive; you can use this in commercial or proprietary projects with minimal restrictions, provided you include the license text. Quickstart: pip install kr8s import kr8s for node in kr8s.get("nodes"): print(node.name) Requires Python >=3.9 and a running Kubernetes cluster or valid kubeconfig for authentication. Verify before relying: - Whether sensible defaults for authentication work seamlessly in all common deployment environments (local, cloud, CI/CD). - Performance characteristics when querying large clusters or handling high-frequency operations. - Scope of kubectl-inspired utilities beyond the documented examples (pod operations, scaling, labeling). ## Package facts - License: BSD-3-Clause (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 912.7K/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags kubernetes python client, kubectl-like api library, k8s cluster management, async kubernetes client, python kubernetes automation, kubectl python wrapper, kubernetes resource operations, kubernetes, devops-automation, async-ready [View on SkillFed](https://skillfed.io/packages/kr8s) · [View on PyPI](https://pypi.org/project/kr8s/)