Managing an Ubuntu Based Kubernetes Cluster With Different CLI Tools
How to manage a Kubernetes cluster with a small list of CLI tools
Continuing the subject of my previous article in which I described Setting Up a Kubernetes 1.23 Cluster using kubeadm on 3 Ubuntu Severs, today I would like to present a small list of useful tools for managing this cluster.
K9s
K9s is a terminal based UI to interact with your Kubernetes clusters. The aim of this project is to make it easier to navigate, observe, and manage your deployed applications in the wild. K9s continually watches Kubernetes for changes and offers subsequent commands to interact with your observed resources.
K9s is my most used tool for managing, maintaining, expanding and debugging Kubernetes clusters. It is very easy to understand and to handle.
Installation
First of all, you need to install Linuxbrew:
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then, you need to follow the instructions of the output in your terminal. After this, we can easily install K9s via the brew command:
$ brew install derailed/k9s/k9s
Use
$ k9s
With K9s you can scan services, pods, ingress’ and so on of your Kubernetes cluster very easily. New changes are shown immediately.
Kubescape
Kubescape is a K8s open-source tool providing a multi-cloud K8s single pane of glass, including risk analysis, security compliance, RBAC visualizer and image vulnerabilities scanning. Kubescape scans K8s clusters, YAML files, and HELM charts, detecting misconfigurations according to multiple frameworks […]
Installation
$ curl -s https://raw.githubusercontent.com/armosec/kubescape/master/install.sh | /bin/bash
Use
$ kubescape scan --submit --enable-host-scan --verbose
I use kubescape to check my settings again with an automated tool. Often I forget to set CPU or Memory limits, a liveness or readiness probe, or network policies. The tool gives a lot of hints on how to improve the cluster health and security.
Kubectl autocomplete
Autocompletion is very valuable for increasing your work speed when using the command line. Here, kubectl comes in handy.
Installation
$ source <(kubectl completion bash)
$ echo "source <(kubectl completion bash)" >> ~/.bashrc
Kubetree
A kubectl plugin to explore ownership relationships between Kubernetes objects through
ownersReferences
on the objects.The
kubectl lineage
plugin is very similar tokubectl tree
, but it understands logical relationships between some API objects without needing ownerReferences.
Installation
With Linuxbrew there is no support for kubectl plugins. So you need to install krew per original installtion guide.
Use
$ kubectl tree {{resource-type}} {{resource-name}}$ kubectl tree deployment prometheus-operator -n monitoring
$ kubectl tree service prometheus-operator -n monitoring
$ kubectl tree deployment prometheus-operator -n monitoring
I use kubetree very often to list all dependencies and relationships of a resource type like deployments or services.
Do you need more tools?
There are so many Kubernetes tools out there that are very helpful. Here is another list with a huge selection of other tools:
Conclusion
This is a small list of tools I use every day to manage Kubernetes clusters of my customers. I hope you found a tool you did not know about and that can help you to work more effectively in future. Thanks for reading.
Follow me on Medium, or Twitter, or subscribe here on Medium to read more about DevOps, Agile & Development Principles, Angular and other useful stuff. Happy Coding! :)