Python client library for Kubernetes
Перейти к файлу
Brian Rosner b6b0431a3a
Added build and dist to .gitignore
2016-03-01 18:08:56 -07:00
pykube Fixed bug recently introduced in RollingUpdater 2016-02-17 17:34:00 -07:00
test Start of unittesting and some exception work. 2015-11-24 20:57:14 -05:00
.gitignore Added build and dist to .gitignore 2016-03-01 18:08:56 -07:00
LICENSE initial port of code 2015-07-26 15:02:38 -06:00
README.rst Fixed installation code in README 2016-02-12 08:19:20 -07:00
setup.cfg Added wheel support 2016-02-03 17:01:43 -07:00
setup.py Bumped version for next release 2016-02-17 17:34:14 -07:00

README.rst

======
pykube
======

*Python client for Kubernetes*

.. image:: https://img.shields.io/pypi/dm/pykube.svg
    :target:  https://pypi.python.org/pypi/pykube/

.. image:: https://img.shields.io/pypi/v/pykube.svg
    :target:  https://pypi.python.org/pypi/pykube/

.. image:: https://img.shields.io/badge/license-apache-blue.svg
    :target:  https://pypi.python.org/pypi/pykube/


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``)