How To Install K9s on Ubuntu 22.04 LTS
In this tutorial, we will show you how to install K9s on Ubuntu 22.04 LTS. K9s is an open-source, terminal-based user interface that revolutionizes the way you interact with Kubernetes clusters. Designed to enhance productivity and efficiency, K9s offers a plethora of features that elevate your Kubernetes experience. Real-time tracking of resources, handling both standard and custom resources, monitoring metrics, executing management commands, and extensive customizability are just a few highlights that make K9s a must-have tool in your Kubernetes arsenal.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of the K9s Kubernetes CLI on Ubuntu 22.04. You can follow the same instructions for Ubuntu 22.04 and any other Debian-based distribution like Linux Mint, Elementary OS, Pop!_OS, and more as well.
Prerequisites
- A server running one of the following operating systems: Ubuntu 22.04, 20.04, and any other Debian-based distribution like Linux Mint.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for K9s.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install K9s on Ubuntu 22.04 LTS Jammy Jellyfish
Step 1. Keeping your system up-to-date is crucial for ensuring smooth operation and addressing potential vulnerabilities. Begin by running the following commands to update the package lists and upgrade installed packages:
sudo apt update sudo apt upgrade
Regularly updating your system packages is a best practice that should not be overlooked.
Step 2. Installing Kubectl.
Run the following command below to install kubectl:
sudo snap install kubectl --classic
Step 3. Installing K9s on Ubuntu 22.04.
There are two methods for installing k9s, giving you the flexibility to choose what suits you best.
- Method 1: Using Snap Package Manager
One of the easiest ways to install K9s on Ubuntu 22.04 LTS is through the Snap package manager. Snap is a popular package management system that simplifies the installation and updates of various applications, including K9s. To install K9s using Snap, follow these steps:
If Snap is not already installed on your system, install it by running:
sudo apt install snapd
Install K9s using the snap install command:
sudo snap install k9s
Verify the installation by running the following command:
k9s --version
- Method 2: Manual Installation from GitHub Repository
For advanced users who want to build K9s from the source code, you can follow these steps to compile and install K9s on your Ubuntu 22.04 LTS system:
mkdir ~/k9s-installation cd ~/k9s-installation curl -LO https://github.com/derailed/k9s/releases/download/v0.32.4/k9s_Linux_amd64.tar.gz tar xf k9s_Linux_amd64.tar.gz sudo mv k9s /usr/local/bin
Verify k9s installation:
k9s version
Step 4. Basic Usage of k9s.
Now that k9s is successfully installed, let’s dive into its basic usage and explore its intuitive interface.
- Launching k9s
Simply type k9s
in your terminal and hit Enter.
- Connecting to a Kubernetes Cluster
Upon launching k9s, it will prompt you to select a context. Use the arrow keys to navigate and hit Enter to connect.
- Navigating the k9s Interface
Once connected, you’ll be greeted by k9s’ dashboard. Here’s how to make the most of it:
- Main Dashboard Overview: The dashboard provides an overview of key resources.
- Resource Exploration: Use arrow keys to navigate through pods, deployments, services, and more.
- Shortcut Magic: Employ shortcuts like
:
to filter,/
to search, andCtrl+A
for selecting all resources.
Step 5. Example Commands with k9s.
Let’s explore some real-world commands using k9s.
- Example 1: Retrieving Pod Information
k9s get pods
- Example 2: Describing a Specific Pod
k9s describe pod <pod_name>
- Example 3: Port-Forwarding for Local Access
k9s port-forward <pod_name> <local_port>:<remote_port>
- Example 4: Executing a Command within a Pod
k9s exec -it <pod_name> -- <command>
Congratulations! You have successfully installed K9s. Thanks for using this tutorial for installing the K9s Kubernetes CLI on the Ubuntu system. For additional help or useful information, we recommend you check the official K9s website.