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

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

Uploaded Source

Built Distribution

pykube-0.7.0-py2.py3-none-any.whl (11.9 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for pykube-0.7.0.tar.gz
Algorithm Hash digest
SHA256 75e64265711cbae90bb70936b4ae7464411b5affe623928fc8d6268722af8b95
MD5 00bacd9490fa1fc3b59a2e9ddfd86e4b
BLAKE2b-256 43fa405553f905c38a98a18e439f7dabecffee51af2a07a0be053455d3b003e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pykube-0.7.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3b3af831d91a841054b4d7cdb84b60fdaf6eed2579db9424c7b0d7a270fef3cd
MD5 d3155e6db1f9ed554c2258f7174b6c90
BLAKE2b-256 fbb77148cce46eab037c2d82cef3b7885429f65686563435c4e88e443969eb9d

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