Skip to main content

Python client library for Kubernetes

Project description

Python client for Kubernetes

https://img.shields.io/pypi/dm/pykube.svg https://img.shields.io/pypi/v/pykube.svg https://img.shields.io/badge/license-apache-blue.svg

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


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.0.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

pykube-0.8.0-py2.py3-none-any.whl (12.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pykube-0.8.0.tar.gz.

File metadata

  • Download URL: pykube-0.8.0.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pykube-0.8.0.tar.gz
Algorithm Hash digest
SHA256 005fadc4e55249d61a71336b4d76c5f5d50293721eaec343eef43343a0337494
MD5 176b592d0945b8fe0237760870815513
BLAKE2b-256 3746f74a572e1305ae0bb3d207b9acc0af36a00629d485344ed1b8fdf8642bca

See more details on using hashes here.

File details

Details for the file pykube-0.8.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pykube-0.8.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7fe0477decb04ea6eadc65a1d1d61a472ced8d6e77bccd16af08274872c2a0dd
MD5 2b3dc2f0eb7438c51a555aa72c347aed
BLAKE2b-256 875bd8a60cda2be8e34c17a4041e19ad2c8824c6ab19ebd0f037a80b1f490ec7

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page