Kubectl wrapper in Python with OAuth token auth
Project description
Zalando Kubectl
Description
Kubernetes CLI (kubectl) wrapper in Python with OAuth token authentication.
This wrapper script zkubectl serves as a drop-in replacement for the
kubectl binary:
- it downloads the current
kubectlbinary from Google - it generates a new
~/.kube/configwith an OAuth Bearer token acquired via zign. - it passes through commands to the
kubectlbinary
User Facing documentation
- https://cloud.docs.zalando.net/reference/zkubectl/
- https://cloud.docs.zalando.net/howtos/install-tools/
Contribute
Setup project
- It's recommended to use uv for the project.
Go to the project dir and install dependencies with uv
$ cd <project-path>
$ uv sync
- [Optional] install pre-commit hooks
$ pre-commit install
- [Optional] The project uses ruff for code formatting, configure your editor to use it.
Unit Tests
Run unit tests with Docker:
docker build --build-arg PYTHON_VERSION=3.10 --build-arg PACKAGE_NAME=zalando_kubectl -f Dockerfile.test .
docker build --build-arg PYTHON_VERSION=3.11 --build-arg PACKAGE_NAME=zalando_kubectl -f Dockerfile.test .
docker build --build-arg PYTHON_VERSION=3.12 --build-arg PACKAGE_NAME=zalando_kubectl --build-arg DEBIAN_DISTRO=bullseye -f Dockerfile.test .
docker build --build-arg PYTHON_VERSION=3.13 --build-arg PACKAGE_NAME=zalando_kubectl --build-arg DEBIAN_DISTRO=bullseye -f Dockerfile.test .
Run Locally
via uv
$ uv run zkubectl
Or first activate the virtualenv
$ source .venv/bin/activate
$ zkubectl login playground
Use as kubectl plugin
The project exposes scripts that use the kubectl plugin format
You can see which ones are available in the scripts section of pyproject.toml
In order for kubectl to detect the subcommands provided by the script, they must be in the PATH, so you need first to activate the virtualenv
$ source .venv/bin/activate
$ kubectl login playground
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zalando_kubectl-1.34.4.380.tar.gz.
File metadata
- Download URL: zalando_kubectl-1.34.4.380.tar.gz
- Upload date:
- Size: 50.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
885eea5ed6cc0dfe5340a4b3e13bd57a3998d3add169664d5b2ec666ad49bc39
|
|
| MD5 |
0bfb145e6344f95a79321d490524177a
|
|
| BLAKE2b-256 |
010a8283aea0e47d699689a4badc66d542602ec5e3896e5e8206f4f9732ada3a
|
File details
Details for the file zalando_kubectl-1.34.4.380-py3-none-any.whl.
File metadata
- Download URL: zalando_kubectl-1.34.4.380-py3-none-any.whl
- Upload date:
- Size: 53.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0af8d8b4d86921f0aac4f9ddd782e0430add3536fe9ebe7a2d081f60e9911ba
|
|
| MD5 |
a2558479eb7111432a065eb950d40771
|
|
| BLAKE2b-256 |
a4542296dab627037e2d19851cf4538a32090316ae65a440985f8eefe1a6e2be
|