Install K3s on Ubuntu 22.04 using K3D and Docker – Learning Kubernetes


    Spinning up a Kubernetes cluster for learning, labbing, PoCs, and development should not be difficult. Using just a few simple tools, we can spin up a fully functional Kubernetes cluster running on a single Ubuntu virtual machine using a lightweight Kubernetes distribution called K3s from Rancher. A commandline utility called K3D can be used to spin up K3s inside Docker containers. We can then spin up a real-world workload such as Portainer to run on top of the newly formed Kubernernetes cluster.

    Subscribe to the channel:

    My blog:


    Social Media:

    Introduction – 0:00
    Overview of installation environment with Ubuntu 22.04 LTS – 0:40
    Checking Docker version – 1:00
    Downloading and installing kubectl – 1:10
    Installing the K3D utility – 1:20
    Creating a test cluster using K3D – 1:49
    Stepping through the K3D cluster creation command – 2:00
    K3D spins up the Kubernetes cluster using K3s – 3:12
    Using kubectl to interact with the Kubernetes cluster – 3:30
    Talking through installing Portainer in the K3s cluster – 4:14
    Running the command to install Portainer in the cluster – 4:35
    Browsing to the NodePort to test the Portainer installation – 4:50
    Concluding thoughts around K3s K3D and learning Kubernetes – 5:10

    If you would like to see this post in blog format, check out the written step-by-step instructions to install K3s on Ubuntu with K3D in Docker here:



    Previous articleDocker Networks DNS and How Containers Find Each Other
    Next articleAzure DevOps Top Interview Questions and Answers 2020| Azure DevOps Engineer|Azure DevOps Interview


    1. [[email protected] ~]$ k3d cluster create testcluster –api-port 6443

      INFO[0000] Prep: Network

      INFO[0000] Created network 'k3d-testcluster'

      INFO[0000] Created image volume k3d-testcluster-images

      INFO[0000] Starting new tools node…

      ERRO[0000] Failed to run tools container for cluster 'testcluster'

      INFO[0001] Creating node 'k3d-testcluster-server-0'

      INFO[0001] Creating LoadBalancer 'k3d-testcluster-serverlb'

      INFO[0001] Using the k3d-tools node to gather environment information

      INFO[0001] Starting new tools node…

      ERRO[0001] Failed to run tools container for cluster 'testcluster'

      ERRO[0001] failed to gather environment information used for cluster creation: failed to run k3d-tools node for cluster 'testcluster': failed to create node 'k3d-testcluster-tools': runtime failed to create node 'k3d-testcluster-tools': failed to create container for node 'k3d-testcluster-tools': docker failed to create container 'k3d-testcluster-tools': Error response from daemon: invalid IP address in add-host: "host-gateway"

      ERRO[0001] Failed to create cluster >>> Rolling Back

      INFO[0001] Deleting cluster 'testcluster'

      INFO[0001] Deleting cluster network 'k3d-testcluster'

      INFO[0001] Deleting 2 attached volumes…

      WARN[0001] Failed to delete volume 'k3d-testcluster-images' of cluster 'testcluster': failed to find volume 'k3d-testcluster-images': Error: No such volume: k3d-testcluster-images -> Try to delete it manually

      FATA[0001] Cluster creation FAILED, all changes have been rolled back!

      Please help

    2. Awesome video, thanks Brandon. The more videos I watch about kubernetes and such the more I'm starting to understand it but the big thing that's still missing for me is the real world use cases. I understand it's for managing redundant or distrubted workloads, but haven't really seen a good overview of it actually being used. Do you happen to have any instances you're running that you may be able to share?