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 <>.


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():

List all resource controllers:

for ns in kubelib.ReplicationController(kube).get_list():

(you get the idea)

Get a specific pod:

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

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

A reasonable approach to getting sphinx output into github pages from

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for kubelib, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size kubelib-0.3.0.tar.gz (27.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page