Python client library for Kubernetes
Project description
Python client library for Kubernetes
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
Usage
A simple query for all ready pods in a custom namespace:
import operator from pykube.config import KubeConfig from pykube.http import HTTPClient from pykube.objects import Pod api = HTTPClient(KubeConfig.from_file("/Users/<username>/.kube/config")) pods = Pod.objects(api).filter(namespace="gondor-system") ready_pods = filter(operator.attrgetter("ready"), pods)
Selector query:
pods = Pod.objects(api).filter( namespace="gondor-system", selector={"gondor.io/name__in": {"api-web", "api-worker"}}, )
Requirements
Python 2.7 or 3.4+
requests (included in install_requires)
PyYAML (included in install_requires)
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
pykube-0.10.0.tar.gz
(10.2 kB
view hashes)
Built Distribution
Close
Hashes for pykube-0.10.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0350e967b65713d77f3bbb6e9fd0148d282de65402fc540feb75a3e55762fa1d |
|
MD5 | d80a5c0e607c3ce588ea07868fa5b4bb |
|
BLAKE2b-256 | 75922c398b0a70b326c2e3b4f6152c8c50f0952abc2b06712cff9adea1326903 |