Skip to main content

pykube

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)

Metadata

Release files for pykube 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pykube 0.9.0
File Size Uploaded Provenance
pykube-0.9.0.tar.gz 9.9 kB Without provenance Details

Release files / pykube-0.9.0.tar.gz

Download URL pykube-0.9.0.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
dd5becdf837e99f9da28c27b23a529efd4b4e29eb64038ddf93b7d12bd14722c
BLAKE2b-256 checksum
How to use checksums
7f7f096a7d4602e235828401bccd8d2db2f0771b01a4c52f24f112245febf139
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pykube 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page