kpet

Command line tool to explore the Kubernetes API using Python expressions


License
MIT
Install
pip install kpet==0.0.2

Documentation

Kubernetes Python Exploration Tool

Command line tool to explore the Kubernetes API using Python expressions

PyPi Code style: black

Motivation

Explore the Kubernetes API by using «k8s tailored» REST client while supporting Python expressions for formatting and filterting data.

Install

pip install kpet

Usage examples

Show the current kubernetes context configuration (detected from your KUBECONFIG file)

kpet show

List all the API endpoints

kpet get

Get the kubernetes API server version

kpet get version

Get the list of nodes

kpet get api/v1/nodes

Get the PodIP for all pods, check the special symbols for other symbols.

kpet get api/v1/pods -f "{name} is using IP {_s.podIP}"

Print the name for all running pods

kpet get api/v1/pods -f"{name}" -s "_s.phase=='Running'"

Print the name for all nodes which are Ready

kpet get api/v1/nodes -f"{name}" -s "[c for c in _s['conditions'] if c.type=='Ready' and c.status=='True']"