UbuntuUbuntu Based

How To Install K9s on Ubuntu 22.04 LTS

Install K9s on Ubuntu 22.04

In this tutorial, we will show you how to install K9s on Ubuntu 22.04 LTS. In the intricate landscape of Kubernetes management, a reliable tool can be your guiding light. Enter k9s—a versatile, command-line tool that simplifies navigating, managing, and troubleshooting Kubernetes clusters.

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 the root user. We recommend acting as a non-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. First, make sure that all your system packages are up-to-date by running the following apt commands in the terminal.

sudo apt update
sudo apt upgrade

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
sudo snap install k9s
  • Method 2: Manual Installation from GitHub Repository
mkdir ~/k9s-installation
cd ~/k9s-installation
curl -LO https://github.com/derailed/k9s/releases/download/v0.27.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.

  1. Launching k9s

Simply type k9s in your terminal and hit Enter.

Install K9s on Ubuntu 22.04 LTS Jammy Jellyfish

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

  1. 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, and Ctrl+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.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button