How To Set up k3d on AlmaLinux 9

This guide intends to teach you to Set up k3d on AlmaLinux 9.

k3d is a small program made for running a K3s cluster in Docker. K3s is a lightweight, CNCF-certified Kubernetes distribution and Sandbox project. Designed for low-resource environments, K3s is distributed as a single binary that uses under 512MB of RAM. 

k3d uses a Docker image built from the K3s repository to spin up multiple K3s nodes in Docker containers on any machine with Docker installed. That way, a single physical (or virtual) machine (let’s call it Docker Host) can run multiple K3s clusters, with multiple server and agent nodes each, simultaneously.

Steps To Set up k3d on AlmaLinux 9

To complete this guide, you must log in to your server as a non-root user with sudo privileges. To do this, you can follow our guide on Initial Server Setup with AlmaLinux 9.

K3d whole depends on docker. So you need to have Docker installed on your server. To do this, you can follow our guide on Install and Use Docker on AlmaLinux 9.

Install kubectl on AlmaLinux 9

At this point, you need to kubectl package to interact with the cluster we will be creating. To do this, run the commands below:

# curl -LO "$(curl -L -s" 
# sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl

Then, verify your kubectl installation by checking its version:

kubectl version --output=yaml
  buildDate: "2023-03-15T13:40:17Z"
  compiler: gc
  gitCommit: 9e644106593f3f4aa98f8a84b23db5fa378900bd
  gitTreeState: clean
  gitVersion: v1.26.3
  goVersion: go1.19.7
  major: "1"
  minor: "26"
  platform: linux/amd64
kustomizeVersion: v4.5.7

Enable ip_tables module on AlmaLinux 9

K3d comes with traefik and it will need iptables to enable some routing. Now you need to use the command below to enable the ip_tables module:

# sudo modprobe ip_tables
# echo 'ip_tables' | sudo tee -a /etc/modules

Install k3d on AlmaLinux 9

At this point, you can use the following command to download and install k3d on your server:

wget -q -O - | bash
Preparing to install k3d into /usr/local/bin
k3d installed into /usr/local/bin/k3d

How To Use k3d

At this point, we want to show you to create a single-node cluster with k3d. To do this, you can use the following command. You can choose your desired name.

k3d cluster create orcacluster

You’ll see the following output as it creates your cluster:

INFO[0000] Prep: Network
INFO[0000] Created network 'k3d-orcacluster'
INFO[0000] Created image volume k3d-orcacluster-images
INFO[0000] Starting new tools node...
INFO[0001] Creating node 'k3d-orcacluster-server-0'
INFO[0001] Pulling image ''
INFO[0002] Pulling image ''
INFO[0003] Starting Node 'k3d-orcacluster-tools'
INFO[0008] Creating LoadBalancer 'k3d-orcacluster-serverlb'
INFO[0009] Pulling image ''
INFO[0013] Using the k3d-tools node to gather environment information
INFO[0013] HostIP: using network gateway address
INFO[0013] Starting cluster 'orcacluster'
INFO[0013] Starting servers...
INFO[0013] Starting Node 'k3d-orcacluster-server-0'
INFO[0021] All agents already running.
INFO[0021] Starting helpers...
INFO[0021] Starting Node 'k3d-orcacluster-serverlb'
INFO[0028] Injecting records for hostAliases (incl. host.k3d.internal) and for 2 network members into CoreDNS configmap...
INFO[0030] Cluster 'orcacluster' created successfully!
INFO[0030] You can now use it like this:
kubectl cluster-info

It will automatically create a KubeConfig file at “~/.kube/config” and hence you can immediately begin interacting with your cluster via the “kubectl” command. So let us check our cluster information:

kubectl cluster-info
Kubernetes control plane is running at
CoreDNS is running at
Metrics-server is running at

Also, you can view the pods by using the command below:

kubectl get pods -n kube-system
NAME                                      READY   STATUS      RESTARTS   AGE
coredns-597584b69b-654kg                  1/1     Running     0          4m33s
local-path-provisioner-79f67d76f8-pzlp8   1/1     Running     0          4m33s
helm-install-traefik-crd-bhqhh            0/1     Completed   0          4m33s
metrics-server-5f9f776df5-vtszz           1/1     Running     0          4m33s
helm-install-traefik-55rrs                0/1     Completed   2          4m33s
svclb-traefik-188963af-jhzbm              2/2     Running     0          3m57s
traefik-66c46d954f-k25gc                  1/1     Running     0          3m57s

At this point, you are ready to deploy your applications to test them locally or do your various playful escapades with them.


At this point, you have learned to Set up k3d on AlmaLinux 9.

Hope you enjoy it. You may be interested in these articles:

Install and Use SQLite on AlmaLinux 9

Install and Use Podman on AlmaLinux 9

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!