Skip to main content
https://img.shields.io/pypi/v/kustomize.svg https://img.shields.io/pypi/pyversions/kustomize.svg tests Ruff https://img.shields.io/badge/skeleton-2024-informational

Build your Kubernetes manifests for Kustomize in Python!

Overview

The reason for this project to exist is to make it easier to create dynamic manifests to be exported for usage in Kubernetes’ “Kustomize” tool. And, by using Python and supporting the “dataclasses” language feature, it also helps reducing boilerplate by encouraging code reuse.

Kustomize, by itself, is already a very powerful tool, and it’s possible to deal with different apps and environments by using the “overlays” approach; but it’s not dynamic enough if you need to define manifests parameters through environment variables, for example. So this project aims to cover that gap.

A complement for Kustomize

This project is by no means a replacement for Kustomize, but rather a complement. The idea is to generate kustomization files from Python files, and then use kubectl apply -k or kustomize build to transform them into final manifests for Kubernetes (even applying them to the cluster).

In other words, the idea is to “compile” Python files into Kustomize files, then just use Kustomize for the rest of the deployment.

Installing

The only mandatory dependency to this project is PyYAML. This library supports a number of object definition types:

  • dict

  • dataclasses

  • BaseModel (from Pydantic)

  • attr (needs the library installed)

  • kubernetes (needs the library installed)

This package will be available as kustomize; you may install it with pip, for example:

$ pip install kustomize

This will also install PyYAML if it’s not already installed.

Alternatively, you can use any other package manager capable of installing packages from PyPI.

Usage

The summary is:

  1. You write a source directory with Python files representing the Kustomize files (see directories at python-kustomize/tests/fixtures/);

  2. You run:

    $ pykustomize <source-dir> <dest-dir>

    where <dest-dir> will be the directory where Kustomize YAML files will be put at;

  3. Then you can apply the generated Kustomize files into your cluster:

    $ kubectl apply -f <dest-dir>

    and done!

Release files for kustomize 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kustomize 0.6.0
File Size Uploaded
kustomize-0.6.0.tar.gz 29.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kustomize 0.6.0
File Interpreter ABI Platform
kustomize-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 36.0 kB

Release files / kustomize-0.6.0.tar.gz

Download URL kustomize-0.6.0.tar.gz
Size 29.1 kB
Tags Source
SHA-256 checksum
How to use checksums
75a7587a6428e58e73aa52691ca4fb0fee355a9435f39dcb6c6f8600f7fc4ea3
BLAKE2b-256 checksum
How to use checksums
56cff07cb2ca4a685d650d84399c23b9ba30eb7a841398e993ce654a9d65c10b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / kustomize-0.6.0-py3-none-any.whl

Download URL kustomize-0.6.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d63da5e4461d369d16dccb1e4754f2aefe17d506ec0a19aac6ead0924638ced9
BLAKE2b-256 checksum
How to use checksums
7753a50ddd71075b9fb3803772fbe9b72db3d734a4e7f8056e968f4c150f0ab3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page