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

Uploaded Source

Built Distribution

pykube-0.8.1-py2.py3-none-any.whl (12.5 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for pykube-0.8.1.tar.gz
Algorithm Hash digest
SHA256 3f5445e660b21d77efc67b942e4208012d8a9ca64fb60b6d12e96841cac4b1c2
MD5 d4c86d703601d1825e77a679845534d4
BLAKE2b-256 65d629f641e940388936835d85b1954ab9752338717f5982b3f3c72d439364be

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pykube-0.8.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e4b4b6626a27f9391c7945d0f97066574ef862d230839d28806a84d2f1d327c8
MD5 04eebeb463f8b9ff3f2ee9433e92a053
BLAKE2b-256 a17e90cd0b68691671c786abc7416d3c08068ce6c1f3cb2843c29a389ee58e8c

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