Lightweight Python 3+ client library for Kubernetes (pykube-ng) https://pykube.readthedocs.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Henning Jacobs c95e066d30 Merge pull request '#4 ADD certificate authority env variable to override CA used to validate http calls' (#5) from liamsorsby/pykube-ng:issue-4 into main 1 month ago
docs github.com -> codeberg.org 10 months ago
pykube Merge pull request '#4 ADD certificate authority env variable to override CA used to validate http calls' (#5) from liamsorsby/pykube-ng:issue-4 into main 1 month ago
tests Merge pull request '#4 ADD certificate authority env variable to override CA used to validate http calls' (#5) from liamsorsby/pykube-ng:issue-4 into main 1 month ago
.flake8 Switch to poetry & black (#51) 2 years ago
.gitignore #4 ADD certificate authority env variable to override CA used to validate http calls 6 months ago
.pre-commit-config.yaml update pre-commit linters and format code (black) 9 months ago
.tools-version #4 ADD certificate authority env variable to override CA used to validate http calls 6 months ago
.travis.yml Switch to poetry & black (#51) 2 years ago
CHANGELOG.md changelog for 0.17 and 0.18 2 years ago
LICENSE initial port of code 6 years ago
Makefile add pre-commit hooks (#52) 2 years ago
README.rst github.com -> codeberg.org 10 months ago
poetry.lock update dependencies 5 months ago
pyproject.toml improve test coverage: provide tests for Service.proxy_http_request 9 months ago

README.rst

pykube-ng

Build status

Code Coverage

Documentation

PyPI version

Python versions

Apache License

CalVer

Pykube (pykube-ng) is a lightweight Python 3.6+ client library for Kubernetes.

This is a fork of kelproject/pykube which is no longer maintained (archived). Here the original text of the pykube README:

Kel is an open source Platform as a Service (PaaS) from Eldarion, Inc. that makes it easy to manage web application deployment and hosting through the entire lifecycle from development through testing to production. It adds components and tools on top of Kubernetes that help developers manage their application infrastructure. Kel builds on Eldarion's 7+ years experience running one of the leading Python and Django PaaSes. For more information about Kel, see kelproject.com or follow us on Twitter @projectkel.

Features

  • HTTP interface using requests using kubeconfig for authentication
  • Python native querying of Kubernetes API objects

Installation

To install pykube, use pip:

pip install pykube-ng

Interactive Console

The pykube library module can be run as an interactive console locally for quick exploration. It will automatically load ~/.kube/config to provide the api object, and it loads pykube classes (Deployment, Pod, ..) into local context:

Usage

Query for all ready pods in a custom namespace:

Access any attribute of the Kubernetes object:

Selector query:

Watch query:

Create a Deployment:

Delete a Deployment:

Check server version:

Requirements

  • Python 3.6+
  • requests (included in install_requires)
  • PyYAML (included in install_requires)

Local Development

You can run pykube against your current kubeconfig context, e.g. local Minikube:

To run PEP8 (flake8) checks and unit tests including coverage report:

License

The code in this project is licensed under the Apache License, version 2.0 (included in this repository under LICENSE).

Contributing

Easiest way to contribute is to provide feedback! We would love to hear what you like and what you think is missing. Create an issue or ping try_except_ on Twitter.

PRs are welcome. Please also have a look at issues labeled with "help wanted".

Code of Conduct

In order to foster a kind, inclusive, and harassment-free community, this project follows the Contributor Covenant Code of Conduct.