Skip to main content

Python client library 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

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)

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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for pykube-0.9.0.tar.gz
Algorithm Hash digest
SHA256 dd5becdf837e99f9da28c27b23a529efd4b4e29eb64038ddf93b7d12bd14722c
MD5 4fc23f5c29ab9c5e181d894e54e65cc5
BLAKE2b-256 7f7f096a7d4602e235828401bccd8d2db2f0771b01a4c52f24f112245febf139

See more details on using hashes here.

Release history Release notifications | RSS feed

0.15.0

2 files

0.14.0

2 files

0.13.0

2 files

0.12.0

2 files

0.11.3

2 files

0.11.2

2 files

0.11.1

2 files

0.11.0

2 files

0.10.0

2 files

This release

0.9.0 This release

1 file

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.3

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.1

2 files

0.6.0

1 file

0.5.1

1 file

0.5.0

1 file

0.4.0

1 file

0.3.0

1 file

0.2.0

1 file

0.1.0

1 file

0.1a1

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page