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.
 
 
Ian Duffy aaa9e07c34 Fix GCP support (#22) 2 years ago
docs kube-ops-view now uses pykube-ng 2 years ago
pykube Fix GCP support (#22) 2 years ago
tests fix setting annotations/labels if it was empty before (#20) 2 years ago
.gitignore test Query class 2 years ago
.travis.yml How Tos (#16) 2 years ago
CHANGELOG.md changelog for 0.17 and 0.18 2 years ago
LICENSE initial port of code 6 years ago
Makefile More tests (#19) 2 years ago
Pipfile improve docs 2 years ago
Pipfile.lock improve docs 2 years ago
README.rst mention interactive console in README 2 years ago
setup.cfg Added Travis CI 5 years ago
setup.py remove Python 2 compatibility (six) 2 years ago
tox.ini update README 2 years ago

README.rst

pykube-ng

Build status

Code Coverage

Documentation

PyPI version

Python versions

Apache License

Pykube (pykube-ng) is a lightweight Python 3+ 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.