k8
Kubernetes Python Models
What it is and what it does
k8 is a Python package that provides type-safe models for Kubernetes resources. It generates these models from OpenAPI specifications, allowing developers to work with Kubernetes API objects as strongly-typed Python classes rather than raw dictionaries. The package depends on pydantic for data validation and aenum for enumeration support, making it suitable for applications that need to programmatically interact with Kubernetes clusters or manifests.
The package is generated via a refresh script, suggesting it is derived from upstream Kubernetes OpenAPI definitions. It targets Python 3.11 and maintains a permissive MIT license. Maintenance is dormant with the last release on 2024-05-23. This makes it appropriate for stable, read-heavy use cases but not for projects requiring active development or rapid API updates.
Use it for:
- Generate type-checked Python code for Kubernetes manifests and configurations.
- Build CLI tools or automation scripts that interact with Kubernetes APIs with IDE autocomplete.
- Validate Kubernetes resource definitions programmatically before deployment.
- Integrate Kubernetes object models into Python-based infrastructure-as-code frameworks.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides Python type models for Kubernetes resources, generated from OpenAPI specifications, enabling type-safe interaction with Kubernetes APIs.
Yes, if you need type-safe Kubernetes models and can tolerate dormant maintenance. The low install friction, permissive license, and stable API surface make it suitable for production use in applications that don't require frequent Kubernetes API updates. Not recommended if you need active maintenance or support for the latest Kubernetes features.
Install
k8 on PyPI
pip
pip install k8uv
uv add k8poetry
poetry add k8Installing k8
Before you install
Low install friction with a pure-Python wheel. Maintenance is dormant—last release was in May 2024, though the repository remains active. Suitable for stable use cases but expect no updates.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal restrictions, making it safe for both open-source and commercial projects.
Quickstart
pip install k8
from k8 import models
# Use Kubernetes model types for API interactions
deployment = models.Deployment(...)
Requires Python 3.11 or later.
Verify before relying
- Whether the generated models cover all current Kubernetes API versions or only a specific version.
- How frequently the models need regeneration to stay aligned with Kubernetes API changes.
- Whether pydantic v2 or v1 compatibility is maintained.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — pydantic, aenum |
| Maintenance | dormant — 813 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 305,114/month — #7,798 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: k8-29.0.9-py3-none-any.whl
Keywords: OpenAPI, OpenAPI-Generator, Kubernetes
Tags
More Distributed Computing packages
gRPC Python is an HTTP/2-based RPC framework…
permissive · top 100 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
cloudpickleCloudpickle extends Python's standard pickle…
permissive · top 1,000 on PyPI
smart-openProvides a unified, open()-compatible Python…
permissive · top 1,000 on PyPI
portalockerPortalocker provides cross-platform file…
permissive · top 1,000 on PyPI
rayRay is a distributed computing framework that…
permissive · top 1,000 on PyPI
openresponses-typesProvides Pydantic models for the OpenResponses…
permissive · top 15,000 on PyPI
lightkube-modelsProvides Python type definitions and model…
permissive · top 15,000 on PyPI
kopfKopf is a Python framework for building…
permissive · top 5,000 on PyPI
kubernetes-asyncioAsynchronous Python client for the Kubernetes…
permissive · top 5,000 on PyPI
turnkey-sdk-typesProvides generated Pydantic type definitions…
permissive · top 15,000 on PyPI
sigstore-rekor-typesProvides Python data models for Rekor's API…
permissive · top 5,000 on PyPI
connector-sdk-typesProvides auto-generated Pydantic type…
permissive · top 15,000 on PyPI
cdk8scdk8s is a framework for defining Kubernetes…
permissive · top 15,000 on PyPI
kubernetes-stubsProvides Python type stubs for the Kubernetes…
permissive · top 15,000 on PyPI
openccu-loom-typesProvides generated Pydantic models and string…
permissive · top 15,000 on PyPI