Install k9s on Linux

Install k9s on Linux

·

2 min read

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 or KUBE_EDITOR environment variable: export EDITOR=nano or export KUBE_EDITOR=vim.

Installation:

  1. Visit the k9s releases page (https://github.com/derailed/k9s/releases) to find supported binary for your Linux distribution.

  2. Download binary by running the following command:

     curl -LO https://github.com/derailed/k9s/releases/download/v0.31.7/k9s_Linux_amd64.tar.gz
    
  3. Extract binary it using the following command:

     tar xvzf k9s_Linux_amd64.tar.gz
    
  4. Make the binary executable: Once downloaded, change the file permissions to make it executable:

     chmod +x k9s
    
  5. Move to a suitable location (optional): You can move the k9s binary to a directory included in your system's PATH 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/
    
  6. Verify k9s version:

     k9s version
    

    Sample output of k9s version:

Run k9s:

  1. 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 or screen 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.