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

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for pykube-0.6.0.tar.gz
Algorithm Hash digest
SHA256 ac5c2d836b660d735e939b25289a45215c6c99e20b94bc6c36587e9d56264d06
MD5 4938e46ea886ee8e948986bf49efd77e
BLAKE2b-256 627b45b7be7778abbfb6fdc004171e7a56311e8d59746e2b085734033e779f9c

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