Linux serverNETWORK ADMINISTRATIONSredhat

Build a Kubernetes Home Lab from Scratch step-by-step!

Building a Kubernetes Home Lab environment from scratch might seem like a daunting task. However, it is actually pretty straightforward with the right tools in place. In this video, we are going to use Kubeadm to initialize a Kubernetes cluster from scratch in our home lab environment. Using Kubeadm takes some of the heavy lifting out of the underlying complexities of Kubernetes. We look at how to build the Kubernetes home lab cluster from scratch step-by-step. Join me in the adventure!

Subscribe to the channel: https://www.youtube.com/channel/UCrxcWtpd1IGHG9RbD_9380A?sub_confirmation=1

My blog: https://www.virtualizationhowto.com

_____________________________________________________

Social Media: https://twitter.com/vspinmaster
LinkedIn: https://www.linkedin.com/in/brandon-lee-vht/
Github: https://github.com/brandonleegit

Introduction – 0:00
Talking about the lab environment and virtual machines needed – 0:53
How to leverage virtual machine snapshots in your home lab when learning Kubernetes – 2:13
Disabling virtual machine swap – 3:22
The actual commands to disable swap – 3:50
Installing Docker – 4:13
Installing CURL – 4:25
Adding the repository key for Kubernetes – 4:30
Adding the actual Kubernetes repository – 4:45
Running apt update – 4:55
Installing kubeadm, kubelet, kubectl, and Kubernetes – 5:02
Explaining why we are only running commands on the Kubernetes master node – 5:16
Running the kubeadm init command – 6:00
kubeadm init command finishes successfully and have the kubeadm join command – 6:20
The worker nodes are now caught up with the master node – 6:58
We still have the special join command to copy and paste into our worker nodes – 7:20
Notice the output of workers. They have successfully joined the Kubernetes cluster – 7:45
Kubectl commands are failing. This is because we haven’t copied our kubeconfig to our HOME directory – 7:54
Nodes are in the not ready state. This is because we haven’t deployed container networking – 8:30
We are going to deploy Calico for container networking – 8:45
After container networking we check the STATE of our Kubernetes nodes – 9:16
Wrapping up and thoughts on building a Kubernetes Home Lab from Scratch – 9:45

If you would like to read a full write up of how to build your Kubernetes Home Lab from scratch using virtual machines, read my blog post found here:

– https://www.virtualizationhowto.com/2021/06/kubernetes-home-lab-setup-step-by-step/

source

by VirtualizationHowto

redhat openstack

44 thoughts on “Build a Kubernetes Home Lab from Scratch step-by-step!

  • noob here, will this be enough to work an environment for the K8s admin exam. Thinking on using three VMs on azure tought.

  • I did copy the configuration files but it still says connection refused when I run kubectl get nodes.
    Also the second node does not connect to control plane with key. Timeout error.

  • is it me or is his voice and face not synced right

  • Maybe I'm just unlucky, but I encounter a persistent problem after adding the 2 worker nodes. The control plane will display the master node, but after adding the 2 workers, executing "kubectl get nodes" will result in a connection (:6443) error. I attempt to "export KUBECONFIG=/etc/kubernetes/admin.conf" again along with copying the admin.conf and assigning permissions. The first "kubectl get nodes" is successful, but after that it errors again. I think the master node is failing. Any suggestions?

  • Just awesome 👏
    I’m K8s certified (CKA & CKAD) but I can still tell you that you tough me something. Straight to the point and clear. Keep doing this nice work. I’ve joined your YouTube community.

  • Installing K8s as a container instead of a VM won’t help save some time or Do you recommend better to install it on a VM? Good video

  • This tutorial was quick and to the point. Was exactly what I needed to get over an issue I had when I was installing my k8s. Thank you!

  • Installation is failling, please let me know how to install in right manner

  • Amazing and complete tutorial for a beginner. Short, concise, and it makes sense. But it would be good to explain like what calico does.

  • I have followed the same steps exactly (1 node only) but my kube-system pods crash resulting to rendering the one node cluster off
    Something with calico pod starts the issue but I cannot identify the error.
    I have looked on the configuration of containerd, dockerd, and logs but I have made zero progress so far.
    Anyone has faced similar issues ?
    connection refused to the server <IP>:6443, – did you specify the right host or port?

  • I am using virtual box I have 4gb ram in my computer
    What adapters are you using in your vms ?

  • Why did you run your commands using sudo when you were already root?

  • Sadly this doesn't works in local environment (hypervisor KVM) I tried following your video here are the issues I faced.

    1. Docker isn't supported so had to go in seperate guide.
    2. Faced issues with iptable which i had to search manually to fix
    3. faced issue with kubeadam init where it's giving error that unable to create service account. ( Was not able to fix this)

    An updated video would be really helpful where the VMs doesn't have a public IP and it's totally done in internal network

  • thanks for the tutorial, just a quick question: why are you running commands as sudo when you are already root?

  • Thanks for showing us how to do it from scratch.
    I suggest not cutting the terminal output part to make the video short!

  • Great totorial ..
    I'm looking for one thing
    I have a pc, which I don't want to install it as a node .. could one install only kubectl on it and just give commands to cluster
    something like docker context .. where I just need docker-client and I'm switching contexts .. is that possible ?

  • How is creating a cluster with machines of different CPU architectures?

  • Hey. man
    Thanks a lot for this video
    I was stuck a bit with deploying k8s cluster in my home lab, but all videos I've watched before was something like "K8s and minikube in 1 hour"
    So now I've managed with deploying cluster on my CentOS 7 VMs and Proxmox as hypervisor

  • Can you please put me on track how you have managed to copy and paste the JOIN command in the worker machines? If I am running in my local 3 different VMs in Virtual Box to simulate the ControlPlane and worker nodes, how you can communicate the copy-paste between them? I totaly got lost here. Thank you.

  • Thanks. This video sums it up very well. Thank you. One question though. Do you know if it's possible to add a node to cluster created with Docker Desktop?

  • How did you split your screen into three. I tried this several times to no avail. You said you would guide every step of the way. That's my problem with self learning, one small problem and you are stuck.

  • Would the process be the same if I have my VMs as EC2s in AWS?

  • Nice! 😀 Now my cluster works fine on my PC. I had some trouble with the calico-part. I guess they have changed their name to tigera, or maybe the whole project changed?

  • 1. 3:48 why u need to run sudo if u already root?
    2. could u install as non root user

  • calico doesnt install (calico pods are stuck at pending and nodes are stuck at NotReady). Do you know any other methods to install calico, especially newer versions (compatible with new Kubernetes)? I would really appreciate the help, been stuck for a week almost.

  • Can this be applied to standard machines. I have 3 mini lenovo desktops that I want to cluster together?

  • So can i Install Kubernetes on different machines in KVM and just run a cluster on different architectures or do I have to differentiate between x86 on one side and Arm on the other ?

  • The initial kubeadm init fails on Ubuntu 20.04.4 with something like:
    ubuntu@kmaster:~/Desktop$ sudo kubeadm init
    [init] Using Kubernetes version: v1.26.1
    [preflight] Running pre-flight checks
    error execution phase preflight: [preflight] Some fatal errors occurred:
    [ERROR CRI]: container runtime is not running: output: time="2023-02-23T10:10:0605:00" level=fatal msg="validate service connection: CRI v1 runtime API is not implemented for endpoint "unix:///var/run/containerd/containerd.sock": rpc error: code = Unimplemented desc = unknown service runtime.v1.RuntimeService"
    , error: exit status 1
    [preflight] If you know what you are doing, you can make a check non-fatal with `–ignore-preflight-errors=…`
    To see the stack trace of this error execute with –v=5 or higher

    -> The fix is explained here: https://forum.linuxfoundation.org/discussion/862825/kubeadm-init-error-cri-v1-runtime-api-is-not-implemented

  • Awesome video man! thanks. I was taking a course on K8 but It only went over how to setup using premade K8 tools on teh cloud. This is much beter and now I know how to create a local cluster and commit to master, as well ss implement from scratch on cloud (or at least I have an idea on where to start from). Stellar video man!

  • Would you rather virtualize some nodes to run kubernetes on (as you show in your video), or make a bare-metal kubernetes installation of a single controller node, considering you'd only have a single spare PC to run your kubernetes home cluster?

  • What version of Ubuntu you are using because I did a lot of troubleshooting and I still have the same issue with running "kubeadm init" ?

  • Great video! Can you please make a tutorial on how to create multiple K8s clusters on a single server?

  • Is there any way that this could be achieved with no virtualisation, fully installed only on one OS?
    My machine does not support virtualisation, and cannot find any BIOS updates

  • Great video sir -hope you share your all of your commands on that subject ☺️

  • did you use bridged networking or NAT for your VMs? I am thinking for ingress bridged would be easier? Thanks

Comments are closed.