Skip to content
main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
bin
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

  • List services, secrets and other resources in namespace.

  • See pod logs.

  • Describe pods.

    • Get YAML and JSON descriptions.

    • Get labels.

  • Execute command in a pod.

  • View configmaps 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.8.1 used for development.

    • Windows or Linux.

  • Clone/download this repo.

  • Install prereqs:

    • pip install -r requirements.txt

    • 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:

    • refresh pod list: <ctrl-r>

    • tab: switch windows and refresh resource 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:/kubeterminal kubeterminal.bin
docker rm -fv kubeterminal

Or use script: get_latest_linux_binary.sh

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 Kubernetes with self-signed certificate.

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

About

Kubectl helper tool.

Resources

License

Stars

Watchers

Forks

Packages

No packages published