k9s is a command-line interface (CLI) that helps you manage your Kubernetes clusters quickly and easily. It provides a visual and interactive way to browse, navigate, and manipulate your cluster resources, saving you time and effort compared to using kubectl commands.
Prerequisites:
Kubernetes cluster: You'll need an existing Kubernetes cluster to manage with k9s. If you don't have one, consider using tools like
minikube
(for local development) or a cloud-hosted service like EKS, GKE or AKS to set one up.256-color terminal: k9s utilizes a rich interface, so make sure your terminal supports 256 colors. Check your terminal settings, and if needed, export the
TERM
environment variable:export TERM=xterm-256color
.Text editor: Choose your preferred text editor, as k9s might open it for resource editing. Set the
EDITOR
orKUBE_EDITOR
environment variable:export EDITOR=nano
orexport KUBE_EDITOR=vim
.
Installation:
Visit the k9s releases page (https://github.com/derailed/k9s/releases) to find supported binary for your Linux distribution.
Download binary by running the following command:
curl -LO https://github.com/derailed/k9s/releases/download/v0.31.7/k9s_Linux_amd64.tar.gz
Extract binary it using the following command:
tar xvzf k9s_Linux_amd64.tar.gz
Make the binary executable: Once downloaded, change the file permissions to make it executable:
chmod +x k9s
Move to a suitable location (optional): You can move the
k9s
binary to a directory included in your system'sPATH
environment variable so you can run it from anywhere. For example, move it to/usr/local/bin
:sudo mv k9s /usr/local/bin
(requires administrative privileges).sudo mv k9s /usr/local/bin/
Verify k9s version:
k9s version
Sample output of k9s version:
Run k9s:
- Connect to a cluster: Open a terminal and run
k9s
to get started. If you have multiple clusters, use the-a
flag to specify the one you want to connect to:k9s -a my-cluster-name
.
Additional notes:
Consider using a terminal multiplexer like
tmux
orscreen
to keep multiple k9s windows open simultaneously, especially for managing complex clusters.If you encounter issues, check the k9s GitHub repository (https://github.com/derailed/k9s) for known issues and solutions.