This Python module provides definitions of Kubernetes models and resources for use with the `lightkube` client library. The version of this package (major.minor.micro) directly corresponds to the Kubernetes API schema version it defines. Users should install the module version that matches their target Kubernetes installation or ensure compatibility. It is currently active, with new versions released to support the latest Kubernetes API schemas.
pip install lightkube-modelsVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and instantiate basic Kubernetes model objects like `ObjectMeta` and `PodSpec` using their specific API group and version paths.
Install a `lightkube-models` version that aligns with your target Kubernetes cluster API version. For example, for Kubernetes 1.29, use `lightkube-models>=1.29,<1.30`.
When interacting with the `lightkube` client, prefer importing from `lightkube.resources.{group}_{version}` (e.g., `from lightkube.resources.core_v1 import Pod`) rather than `lightkube.models`. If you only need schema definition without client interaction, `lightkube.models` is appropriate.For `lightkube-models` versions older than 1.33, ensure `apiVersion` and `kind` are explicitly set in the model's constructor, or upgrade to a `lightkube-models` version >= 1.33, which sets these automatically during `post_init`.