Six tools to Simplify Kubernetes Journey - Day 3?-?Kubernetes Terminal Dashboard k9s
Prashant Lakhera
Lead System Engineer @ Salesforce | Ex-Redhat, GenAI, Author of 3 books, Blogger, YouTuber,kubestronaut, MLOps, AWS Bedrock, Hugging Face
What is k9s?
As per official documentation?K9s?is a terminal-based UI to interact with your Kubernetes clusters. K9s is an open-source project and is written in GO language. The way it works, it continuously monitors your Kubernetes cluster for any changes and provides a shortcut command to interact with Kubernetes resources.
Installing
Installation of K9s is pretty straightforward, and binaries for various distribution are available on the?release page.
# Download the binaries(In this use case Linux)
wget https://github.com/derailed/k9s/releases/download/v0.24.15/k9s_Darwin_x86_64.tar.gz
# Move it to the desired path
sudo cp k9s /usr/local/bin
#Change the permission
sudo chmod +x /usr/local/bin/k9s
Start using k9s
To start using k9s, execute the k9s command on your console. It will use the standard kubeconfig file(~/.kube/config) same as kubectl.?
k9s
As you can see, this is showing the default pod running in the default namespace. This is equivalent of
kubectl get pod
kubectl get pod
kubectl get pod -A
Note:?This dashboard refreshes itself every 2 sec. To modify the default configuration, modify the k9s configuration file.
K9s configuration file
~/.k9s/config.yml
For e.g., To modify the default k9s refresh interval, edit the config file and change the refreshRate to the desired value.
cat ~/.k9s/config.yml
k9s
refreshRate: 2:
Note:?In case if you want to rollback to the previous version, type ctrl+l.
Now select the configmap and then press u to get the list of resources that use it.
:svc - Services(equivalent kubectl command: kubectl get svc
:ns - namespaces(equivalent kubectl command: kubectl get ns)
:ing - ingress(equivalent kubectl command: kubectl get ingress))
0: for the entire lifecycle of the po
1: last 1 min
2: last 5 min
3: last 15 min
4: last 30 min
5: last 1 hourd
领英推荐
helm repo list or helm list
Alternative Tools
The other alternative solutions are
I have used Lens in the past and liked it. It has a friendly UI; we can easily switch between multiple contexts and clusters; the only drawback is that it slows the system.?
Wrapping Up
K9s comes with a lot of handy features and shortcuts, which is easy to work with. I love this tool as I now don't need to type the lengthy kubectl command. It also supports features like custom?plugins?and?benchmark(using Hey), which I still need to explore. If you like any feature or believe a K9s feature is missing in the blog, please post in the comment section.