Sign In

Curriculum 2: Installing Kubectl

Prerequisites

10 min · 15 XP

Prerequisites for Installing kubectl

Before installing kubectl, make sure your system is ready. This lesson covers what you need in place first.

Operating System Requirements

kubectl runs on all major operating systems:

  • macOS 10.15 (Catalina) or later
  • Linux -- any modern distribution (Ubuntu, Fedora, Debian, CentOS, Arch)
  • Windows 10 or later

kubectl is a single binary with no heavy dependencies, so it works on most machines without issues.

Terminal Basics

kubectl is a command-line tool, so you need to be comfortable with a terminal. Here are the essentials:

  • macOS: Use Terminal.app (built in) or iTerm2
  • Linux: Use your distribution's default terminal emulator
  • Windows: Use PowerShell, Windows Terminal, or WSL (Windows Subsystem for Linux)

You should know how to:

# Navigate directories
cd ~/projects

# List files
ls -la

# Check if a command is available
which kubectl

If you have never used a terminal before, spend a few minutes learning basic navigation commands first. Everything in this course happens in the terminal.

Understanding PATH

When you type kubectl in your terminal, your operating system searches a list of directories to find the binary. This list is called your PATH.

# View your current PATH
echo $PATH

The output shows directories separated by colons. When you install kubectl, the binary must end up in one of these directories, or you need to add its location to your PATH.

Common PATH directories:

OSCommon Paths
macOS/usr/local/bin, /opt/homebrew/bin
Linux/usr/local/bin, /usr/bin
WindowsC:\Windows\system32, user-specific paths

If you install kubectl but get a "command not found" error, the binary is likely not in your PATH.

Package Managers

The easiest way to install kubectl is through a package manager. These tools download, install, and update software for you.

macOS -- Homebrew

# Install Homebrew if you do not have it
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Verify Homebrew is working
brew --version

Linux -- apt (Debian/Ubuntu)

# apt is built into Debian-based distributions
sudo apt update

Windows -- Chocolatey

# Install Chocolatey (run PowerShell as Administrator)
Set-ExecutionPolicy Bypass -Scope Process -Force
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

# Verify
choco --version

You do not need to use a package manager. You can also download the kubectl binary directly, which we will cover in the next lesson.

Key Takeaways

  • kubectl works on macOS, Linux, and Windows
  • You need basic terminal skills to use kubectl effectively
  • The PATH environment variable determines where your system looks for commands
  • Package managers like Homebrew, apt, and Chocolatey make installation easier
  • If you get "command not found," check your PATH first