Skip to content
Kubectl helper tool.
Python Shell Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
application
images
kubectl
.gitignore
CHANGES.adoc
Dockerfile
LICENSE
README.adoc
create_linux_exe.sh
kubeterminal.py

README.adoc

KubeTerminal

KubeTerminal is helper tool for Kubernetes. The idea is provide a simple and quick tool to get the basics out of Kubernetes environment.

KubeTerminal is complementing, not replacing, existing kubectl and shell.

Features include (and more planned):

  • Uses the shell and kubectl-command.

  • List pods in namespace and/or node.

  • See pod logs.

  • Describe pods.

    • Get YAML and JSON descriptions.

    • Get labels.

  • Execute command in a pod.

  • View congigmaps and secrets.

    • Decode base64 values.

    • Use openssl to view secret values that are TLS certificates.

  • Option for single executable, for easy installation.

  • Colors, if terminal supports them.

KubeTerminal_05

Installation and usage

  • Python 3.

    • Python 3.7.2 and 3.6.8 used for development.

    • Windows or Linux.

  • Clone/download this repo.

  • Install prereqs:

    • pip install prompt-toolkit

    • pip install ascii_graph

    • pip install pyperclip

  • Install and configure kubectl.

    • Install openssl in order to view certificates.

  • Login to Kubernetes cluster before using KubeTerminal.

  • Start KubeTerminal:

    • python3.7 kubeterminal.py

  • Basic commands:

    • help: <ctrl-h>

    • refresh pod list: <ctrl-r>

    • tab: switch windows and refresh pod list

    • use tab to go to Pods-window and:

      • line up/down to select pod

      • describe pod: <ctrl-d>

      • show logs: <ctrl-l>

Executable binary

Executable binary is used to provide easy way to distribute KubeTerminal to servers without Internet connection. PyInstaller can be to create the executable

Binary is created on system where you want to use the binary. For Windows binary, create the binary in Windows, for Linux, create the binary in Linux, and so on.

Docker

DockerHub has image kazhar/kubeterminal and it includes Linux executable:

Use following commands to copy the executable to local machine:

docker create -it --name kubeterminal kazhar/kubeterminal bash
docker cp kubeterminal:/root/dist/kubeterminal kubeterminal.bin
docker rm -fv kubeterminal

Create binary

Use the following commands create binary in the platform you are using:

  • Install PyInstaller

    • pip install pyinstaller

  • Create single file executable:

    • pyinstaller --onefile kubeterminal.py

  • Binary file is located:

    • dist/kubeterminal

    • if building on Windows, file has .exe suffix.

Or, to create Linux executable using Docker:

  • Execute script:

    • create_linux_exe.sh

  • The executable is copied current directory.

  • Executable name:

    • kubeterminal.bin

Screenshots

KubeTerminal_01
KubeTerminal_02
KubeTerminal_03

Background

I’m working with Kubernetes quite a lot and I found that there a few basic commands that I use very, very often. For example:

  • kubectl get pods

  • kubectl logs <pod name>

  • kubectl describe pod <pod name>

Writing these commands take time, and when in hurry, that time is noticeable.

I accidentally found Kubebox and immediately tried it. But authentication failed when using IBM Cloud Private and self-signed certificate.

BTW, IBM Cloud Private is the main Kubernetes environment that I’m using there’s free Community Edition available at Docker Hub, you should try it :-).

Kubebox idea haunted until I remembered the existence of Python Prompt Toolkit and remembered that it can be used to create full-screen terminal application.

I decided to make my own Kubebox, and I named it KubeTerminal :-)

You can’t perform that action at this time.