This guide provides a shell script to automatically install the latest version of K9s, a terminal UI for managing Kubernetes clusters.
🚀 What This Script Does
Updates system packages
Installs required dependencies (wget, tar)
Fetches the latest K9s release version from GitHub
Downloads and installs the K9s binary
Cleans up leftover files
Verifies the installation
#!/bin/bash
# Update packages and install necessary dependencies
sudo yum update -y
sudo yum install -y wget tar
# Fetch the latest K9s version
K9S_VERSION=$(curl -s https://api.github.com/repos/derailed/k9s/releases/latest | grep tag_name | cut -d '"' -f 4)
# Download the latest K9s release
wget https://github.com/derailed/k9s/releases/download/${K9S_VERSION}/k9s_Linux_amd64.tar.gz
# Check if the download was successful
if [ $? -ne 0 ]; then
echo "Failed to download K9s. Please check the version number and URL."
exit 1
fi
# Extract the tarball and move the binary to /usr/local/bin
tar -xzf k9s_Linux_amd64.tar.gz
sudo mv k9s /usr/local/bin/
# Clean up
rm k9s_Linux_amd64.tar.gz
# Verify installation
k9s version
🧩 Usage Instructions
- Save the script to a file
nano install_k9s.sh
Paste the script and save.
- Make the script executable
chmod +x install_k9s.sh
- Run the script
sh install_k9s.sh
✅ Verify Installation
Run the following command:
## k9s version
You should see the installed version printed.
Top comments (0)