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.7.1.tar.gz
(9.2 kB
view details)
Built Distribution
File details
Details for the file pykube-0.7.1.tar.gz
.
File metadata
- Download URL: pykube-0.7.1.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a36337bc705af247bdad00f25623c00b473ae11a1edff2681c8e930bd92855b1 |
|
MD5 | 44a8218241dd5aa3d3c20ccbd3189596 |
|
BLAKE2b-256 | 1295e1d2ee88b3f7544df7f4b505c9cd33e010713e668ef981155cac442fc299 |
File details
Details for the file pykube-0.7.1-py2.py3-none-any.whl
.
File metadata
- Download URL: pykube-0.7.1-py2.py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5576a84f0e575f85f8521f687dfb362587050d5c6b5b9a3a2b536552d890d0d5 |
|
MD5 | f4390c69ab0a7798ec0211a32a2a77b5 |
|
BLAKE2b-256 | be827a050e593301cfc47139ccbe39842f5b69e463c320a83b53fd82b7431ccb |