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 Fedora 41
DevOps

Install kubectl on Fedora 41: Complete Guide (2026)

Install kubectl on Fedora 41 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 Fedora 41. Tested and verified.

Prerequisites

  • Fedora 41 installed and updated
  • Root or sudo access
  • Internet connection

Step 1: Update System

sudo dnf update -y

Step 2: Add Official Repository

kubectl should be installed from the official Kubernetes package repository so you get the latest stable version and security updates.

# Create the Kubernetes repository definition
# This overwrites any existing configuration in /etc/yum.repos.d/kubernetes.repo
cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://pkgs.k8s.io/core:/stable:/v1.36/rpm/
enabled=1
gpgcheck=1
gpgkey=https://pkgs.k8s.io/core:/stable:/v1.36/rpm/repodata/repomd.xml.key
EOF

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 baseurl and gpgkey lines, then re-run dnf update.

Step 3: Install kubectl

sudo dnf install -y kubectl

dnf reads the gpgkey URL from the repo file and imports/trusts the signing key automatically during install.

Step 4: Verify Installation

kubectl version --client

Expected output should show the installed client version.

Step 5: Enable Shell Completion

kubectl is a standalone CLI binary β€” it has no daemon and nothing to enable or start with systemd. 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 dnf 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 dnf install reports a GPG key retrieval or signature error, confirm the repo file has the correct key URL and re-import the key manually:

cat /etc/yum.repos.d/kubernetes.repo
sudo rpm --import https://pkgs.k8s.io/core:/stable:/v1.36/rpm/repodata/repomd.xml.key
sudo dnf install -y kubectl

Package Not Found

If dnf reports Failed to synchronize cache for repo 'kubernetes' or No match for argument: kubectl, clear the cache, refresh metadata, and confirm the package is visible:

sudo dnf clean all
sudo dnf makecache
dnf repolist
dnf list kubectl --showduplicates

If kubernetes.repo is missing, redo Step 2.

Uninstall

sudo dnf 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 #Fedora 41 #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