Skip to main content

Python client library for Kubernetes

Project description

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)

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

Uploaded Source

Built Distribution

pykube-0.10.0-py2.py3-none-any.whl (13.2 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for pykube-0.10.0.tar.gz
Algorithm Hash digest
SHA256 dc1dbcea3daf91a74fb9f3c4b50b8aca0b4c4ee2d66a39ae2baa7d8deff45272
MD5 c3151310beb676d9519a165bac3d1f08
BLAKE2b-256 93192251ff638c42e5119d0fca3e76a052abc09dcb2ee2a29f82f735bb786dab

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pykube-0.10.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0350e967b65713d77f3bbb6e9fd0148d282de65402fc540feb75a3e55762fa1d
MD5 d80a5c0e607c3ce588ea07868fa5b4bb
BLAKE2b-256 75922c398b0a70b326c2e3b4f6152c8c50f0952abc2b06712cff9adea1326903

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