Python client library for Kubernetes
Project description
Python client for Kubernetes
Client library written in Python to interface to 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.8.2.tar.gz
(9.7 kB
view details)
Built Distribution
File details
Details for the file pykube-0.8.2.tar.gz
.
File metadata
- Download URL: pykube-0.8.2.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e0b001fbe9a91199523eb72671289bccca7b911c3880b4b6a17e7431e07f58d |
|
MD5 | 3d52e3f75eec938b3b3a0efccf7caa72 |
|
BLAKE2b-256 | 836cc6686ffb6bf8f9ab349934a31259e467d9139771cc9547f79059611a9466 |
File details
Details for the file pykube-0.8.2-py2.py3-none-any.whl
.
File metadata
- Download URL: pykube-0.8.2-py2.py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 052b509f8ee49e87b945495fa9488816062bc4061cba5c12206337a5499bae25 |
|
MD5 | 211ea3564805d652df41cae511eef405 |
|
BLAKE2b-256 | 3828094a73fa569650a2a5f17687f1cc5acdc30dadec3a82325334e9c07e12e9 |