Skip to main content
πŸŽ“ Claude Code Masterclass Learn AI-assisted development on Udemy β€” plus the companion book on Leanpub & Amazon. Start Learning
Install kubectl on Debian 12
DevOps

Install kubectl on Debian 12: Complete Guide (2026)

Install kubectl on Debian 12 in 2026. Official repository setup, package installation, post-install configuration, and troubleshooting.

LB
Luca Berton
Β· 1 min read

Here is how to install kubectl on Debian 12. Tested and verified.

Prerequisites

  • Debian 12 installed and updated
  • Root or sudo access
  • Internet connection

Step 1: Update System

sudo apt update && sudo apt upgrade -y

Step 2: Add Official Repository

kubectl should be installed from the official Kubernetes apt repository so you get the latest stable version and security updates, rather than whatever (older) version ships in Debian’s own repos.

# Install packages needed to use the Kubernetes apt repository
sudo apt update
sudo apt install -y apt-transport-https ca-certificates curl gnupg

# Create the keyrings directory (present by default on Debian 12+)
sudo mkdir -p -m 755 /etc/apt/keyrings

# Download the Kubernetes signing key
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.36/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
sudo chmod 644 /etc/apt/keyrings/kubernetes-apt-keyring.gpg

# Add the Kubernetes apt repository (this overwrites any existing kubernetes.list)
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.36/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo chmod 644 /etc/apt/sources.list.d/kubernetes.list

v1.36 selects the Kubernetes 1.36 package repository, the current stable minor version at the time of writing. To track a different minor version, replace v1.36 in both the key URL and the sources.list.d entry, then re-run apt update.

Step 3: Install kubectl

sudo apt update
sudo apt install -y kubectl

Step 4: Verify Installation

kubectl version --client

Expected output should show the installed client version.

Step 5: Enable Shell Completion

kubectl is a CLI binary, not a background service β€” there is no daemon to start or enable. Instead, set up Bash completion so you get tab-completion for commands, flags, and resource names.

# Install bash-completion if it isn't already present
sudo apt install -y bash-completion

# Enable kubectl completion for the current user
echo 'source <(kubectl completion bash)' >> ~/.bashrc
echo 'alias k=kubectl' >> ~/.bashrc
echo 'complete -o default -F __start_kubectl k' >> ~/.bashrc
source ~/.bashrc

Troubleshooting

GPG Key Import Failed

If apt update reports NO_PUBKEY or a signature verification error for the Kubernetes repository, the keyring file is likely missing or empty. Recreate it and retry:

ls -l /etc/apt/keyrings/kubernetes-apt-keyring.gpg
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.36/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
sudo apt update

Package Not Found

If apt install kubectl reports Unable to locate package, confirm the repository file exists and was refreshed, then check which versions are visible:

cat /etc/apt/sources.list.d/kubernetes.list
sudo apt update
apt list --all-versions kubectl

If kubernetes.list is missing or empty, redo Step 2.

Uninstall

sudo apt remove -y kubectl

About the Author

I am Luca Berton, AI and Cloud Advisor. Book a consultation to get help with your infrastructure setup.

#kubectl #Debian 12 #Installation #Linux #DevOps
Share:
Kubernetes & Containerization

Need help with Kubernetes & Containerization?

Master Kubernetes and container orchestration with hands-on workshops and architecture consulting.

Learn more about Kubernetes & Containerization

Want to operate this yourself, in production?

Take the free AI Platform Engineer Readiness Scorecard to see which skills transfer β€” then build a production-shaped AI platform in the 4-week Bootcamp.

Take the Scorecard β†’
Luca Berton β€” The Production AI Expert, Docker Captain

Luca Berton

The Production AI Expert Β· Docker Captain Β· KubeCon Speaker

15+ years in enterprise infrastructure. Author of 8 technical books, creator of Ansible Pilot (1M+ YouTube views, 648K site users). Former Red Hat engineer. Speaker at KubeCon EU 2026 and Red Hat Summit 2026.

Free 30-min Production AI consultation

Book Now