Skip to main content

Utility wrapper around Kubectl

Project description

Python library to simplify kubernetes scripting. Minimal test coverage.

Full Documentation Here

TODO: The current plan is to rebuild this around <https://github.com/kubernetes-incubator/client-python>.

Quickstart

Import Kubelib and config:

import kubelib
kube = kubelib.KubeConfig(context='dev-seb', namespace='myspace')

List all namespaces:

for ns in kubelib.Namespace(kube).get_list():
        print(ns.metadata.name)

List all resource controllers:

for ns in kubelib.ReplicationController(kube).get_list():
    print(ns.metadata.name)

(you get the idea)

Get a specific pod:

pod = kubelib.Pod(kube).get(podname)
print(pod.toJSON())

Upgrading Kubernetes

Upgrade kubernetes based on a directory of yaml files:

import kubelib
kube = kubelib.KubeConfig(context='dev-seb', namespace='myspace')
kube.apply_path("./kubernetes", recursive=True)

This will look at every yaml file and act based on the “Kind” field. Deployments are replaced, replication controllers are deleted and re-created. Other “Kind” resources are created if a resource with that “Kind” and “Name” is not already present.

Command Line Utilities

This package provides a few command line utilities, the most helpful (to me) is see_limits which displays the resource limits for all pods and namespaces within a context.


Initial package setup borrowed from https://github.com/kennethreitz/samplemod

A reasonable approach to getting sphinx output into github pages from https://daler.github.io/sphinxdoc-test/includeme.html

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

kubelib-0.3.0.tar.gz (27.6 kB view details)

Uploaded Source

File details

Details for the file kubelib-0.3.0.tar.gz.

File metadata

  • Download URL: kubelib-0.3.0.tar.gz
  • Upload date:
  • Size: 27.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for kubelib-0.3.0.tar.gz
Algorithm Hash digest
SHA256 554577fc711f85b970416d154ed9db261273c206ba183c60af0dfd3f653fb814
MD5 4bb0a1bf1585deb6cd21ff1174060e81
BLAKE2b-256 96d5c1a04d8b4d834202037cfa2f6ac2c59937f4c68e86890d676158dfd004e1

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