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.
-
Python 3.
-
Python 3.7.2 and 3.6.8 used for development.
-
Windows or Linux.
-
cmder console used in Windows 10.
-
-
-
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 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 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.
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
Or use script: get_latest_linux_binary.sh
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
-
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 :-)