How to Build an Awesome Kubernetes Cluster using Proxmox Virtual Environment
HTML-код
- Опубликовано: 28 май 2024
- Proxmox Virtual Environment is an awesome virtualization solution. Kubernetes is an awesome containerization solution. So why not combine those great technologies? In this video, you'll see the entire process of setting up your very own Kubernetes cluster from scratch, with Proxmox shown as the platform. By the end of this video, you'll have your own cluster ready to go!
Join this channel to get access to perks:
learnlinux.link/join
Official blog post for this video ➜ learnlinux.link/pve-k8s-blog
Support LearnLinuxTV (commission earned):
- Get your own cloud server with Akamai Connected Cloud ➜ learnlinux.link/akamai
- Support me on Patreon and get early access to new content! ➜ learnlinux.link/patron
- Check out my latest book, Mastering Ubuntu Server 4th Edition ➜ ubuntuserverbook.com
- Affiliate store for Linux compatible hardware/accessories ➜ learnlinux.link/amazon
- Check out the Tiny Pilot KVM for your Homelab ➜ learnlinux.link/tinypilot
Individual sections:
00:00 - How to support LearnLinuxTV
00:47 - Intro and overview of our project
03:02 - My new book, Mastering Ubuntu Server 4th Edition (not sponsored, quick mention)
04:44 - What do you need in order to get started?
07:32 - Spinning up some Ubuntu instances on Proxmox using a template
13:26 - Misc tweaks and adjustments before setting up the cluster
15:21 - Adding a static IP to our Ubuntu instance
21:15 - Installing a container runtime (containerd)
25:35 - Disabling swap
26:35 - Enabling bridging in /etc/sysctl.conf
27:22 - Enabling br_netfilter
29:04 - Installing the Kubernetes repository and required packages
33:19 - Creating a template for kubernetes nodes
36:45 - Setting CPU and other options before creating our cluster
40:00 - Initializing the Kubernetes cluster
44:14 - Adding an overlay network to our cluster
45:11 - Joining nodes to our cluster
49:03 - Launching an nginx container within a Kubernetes cluster
52:15 - Exposing the container to the outside network via a nodeport service
Other Proxmox episodes:
Class 01 - Getting Started: linux.video/pve1
Class 02 - Installation Process: linux.video/pve2
Class 03 - Web Console Overview: linux.video/pve3
Class 04 - Containers vs Virtual Machines: linux.video/pve4
Class 05 - Launching a Virtual Machine: linux.video/pve5
Class 06 - Setting up Virtual Machine Templates: linux.video/pve6
Class 07 - Creating Containers: linux.video/pve7
Class 08 - Setting up Container Templates: linux.video/pve8
Class 09 - User Management: linux.video/pve9
Class 10 - Backups and Snapshots: linux.video/pve10
Class 11 - Integrated Firewall: linux.video/pve11
Class 12 - Command-line Interface: linux.video/pve12
Class 13 - Networking: linux.video/pve13
Class 14 - Shared storage: linux.video/pve14
Class 15 - Clustering: linux.video/pve15
Class 16 - High availability: This video
Bonus video 1 - Launching a Windows VM: linux.video/pve-win
Bonus video 2 - Getting started with Proxmox Backup Server: linux.video/pbs
Bonus video 3 - Proxmox VE - How to build an Ubuntu 22.04 Template (Updated Method): linux.video/pve-2204
Bonus video 4 - Build a Kubernetes Cluster on Proxmox: This video
Recommended evergreen videos:
- How to create a bootable flash drive for installing Linux ➜ linux.video/flash-usb
- Understanding Linux permissions ➜ linux.video/perms
- OpenSSH Guide ➜ linux.video/ssh
- LVM Deep-dive ➜ linux.video/lvm
- How to better secure OpenSSH ➜ linux.video/secure-ssh
LearnLinuxTV Links:
- Main site ➜ www.learnlinux.tv
- Community ➜ community.learnlinux.tv
About the host
- Personal blog ➜ www.jaylacroix.com
- Twitter ➜ learnlinux.link/twitter
FAQ
- Which distro do I use? ➜ learnlinux.link/mydistro
- My recording gear (commissions earned) ➜ learnlinux.link/recording-stuff
Disclaimer: LearnLinuxTV provides technical content on RUclips that will hopefully be helpful to you and teach you something new. However, this content is provided without any warranty (expressed or implied). LearnLinuxTV is not responsible for any damages that may arise from any use of this content. The viewer is expected to follow best judgement and to make his/her/their best decisions while working with production or non-production systems and hardware.
#Proxmox #K8s #Homelab - Наука
Thank you for this straight-forward, easy to understand tutorial! I have tried setting up many Kubernetes clusters on my own following online documentation and It has never worked correctly for me. Now that I have watched your tutorial, I realize there were so many mis-steps I was making.
I love how you even go over the painful steps that are obvious to intermediate users just looking for a leg up, but not for beginners.
Wonderful teaching methods. I absolutely love to see it.
This series is golden. I wish I could contribute more, my budget is too tight this month, but I felt bad watching the series without giving something more than a like back. Fantastic job
That was plenty and appreciated. Thank you so much!
At around 46:00, when you are adding the first node to the cluster, I think the reason why it didn't work was because you used the join command for the control-plane instead of the worker node. It didn't appear to be because the time was too long. When you regenerated the join, it provided the correct join for a worker node.
You are absolutely right, it also caught my eye when I viewed the video for a second time and saw that there are two commands for adding nodes to the cluster, one for control-plane nodes and one for worker nodes. The one in this video initially takes the control-plane node command in stead of the worker node command.
Always appreciate the clear and detailed explanations in your videos and the nicely judged pace. Thank you for all of them.
The timing is impeccable! I’ve just began my CKA journey and was about to roll a lab out to my proxmox. Can’t wait to see this
This is exactly the kind of detailed walkthrough I've been hoping for, thank you!
I absolutely love your style of presentation. Always enjoyable to watch and a huge inspiration for me! 💪
Jay, thank you so much for this timely tutorial! I have been trying to find a tutorial on how setup Kubernetes in Proxmox for the past couple weeks. And now you released this big guy, which is just as great as the rest of Proxmox related and other videos. Thanks!
Me toi Jay is a beast
I like these types of Creators. The ones you can actually learn something and at the same time have fun. Jay, TechnoTim, Jeff Geerling, NetworkChuck, and Others inspired me to start my own HomeLab and get into System Administration. Now I can't wait to expand my little HomeLab to an even larger scale!
@31:16 - your. echo "deb .... command is not in the build doc" or am I missing something?
Awesome timing! We were just discussing k8s at work last week, and the need to start prep work to set up a development lab at the office to support new projects coming in Jan. Great walkthrough. Noticed a few typo's on the blog (missing the echo "deb..... command, the pod.yml has some extraneous Chapter 18 25, and in service-nodeport.yaml missing the the indent the last line) but easy enough to sort through. Can't wait for more k8s magic!
Thanks for all you do!
took me a few days of frustration but finally got a working 3-node kubernetes cluster using Hyper-V instead of proxmox lol...thank you Jay!
Hey Jay, thanks for the awesome content. However I noticed there is a command missing on your blog post (after curl gpg) for installing the repository.
Awesome peaceful and positive energy ! I enjoyed your video, was such a quick way to overview Kubernetes.
I've literally been thinking about doing this for the past month. Thank you very much :)
Glad I could help!
Thanks mate. This was a really good guide. It helped me build my setup. I also followed your other tutorial about creating templates. Thanks again.
Last week I tore down my bare metal kubernetes cluster and installed proxmox on the amd64 nodes. I set up two VMs on each, one for control pane and one for worker. I also wiped the arm64 nodes.
I used talos for each VM and amd64 node. It’s quite handy.
I'd love to see a follow up to add a load balancer and additional control plane nodes
Wow, this is an amazing video. Followed it step by step and am very very contended. THank you Jay
This is EXACTLY the series I have been waiting for. Thanks so much for content.
The zoom jump cuts are strong with this one.... I understand that this is meant to retain viewer interest. However, I find it can be distracting and a detriment. I suspect I'm in the minority. The information content itself is great. Thank you!
This was a master class. Thank you Jay.
This data Is gold!
You are the best Jay!
Jay can’t thank you enough for this video. Brilliant
good stuff. K8S is the future and I'm really excited learning it. Thanks Jay
Thank you very much for your offered training.
Cannot wait for the next instalment to the series on Kubernetes
So many thanks for these videos !!! That works so fine.
Helped me a lot, minor suggestions:
Since the worker node becomes a template, 901 would be a more logical ID.
Setting the time zone for the template would have taken care of another tedious to do
In the Blog post make sure that copy paste does not inlude additional line breaks.
Eventually you may want to fix the sudo typo (instead of suod chown)
There seems to be a long command missing in the process of the GPG rings...
Extremely well explained
thanks for the demo and info, have a great day
Thanks for this. It was really helpful.
Thank you for this wonderful content.
Step 2 would be to get MetalLB and a PVC provisioner ;) Most would recommend Longhorn but actually I'd like to suggest something else. The Piraeus Operator uses DRBD9 and is much faster, especially on 1Gig connections as reads always happen locally if possible. Longhorn just tanks when having to write a lot and will eventually fall behind in replication. Also don't use the NFS Ganesha server provisioner unless you absolutely have to. It's a chore and highly unmaintained. If you do, be sure to build the image to run it from my MR. That's at least a little more up to date
WHoaaa nice. I just get an assignment for this and you have the video for it. Thank you so much.
First I was against the template cloud instnace, but after following your tutorial, I can;'t believe I wasn't doing this earlier on
Hi Jay,
Great walkthrough, thank you. One thing to note is that there's currently an issue when running kubeadm init after installing v1.26 of kubeadm, kubectl and kubelet. For some reason when using that version kubelet fails to start. A workaround is to specify v1.25.5-00 when installing those components via apt.
Just updated and I've found that issue too
This is great man thank you!
Great stuff, nice run through getting a cluster up and running. The reason your 1st attempt didn't work was because you copied the "--control-plane" option which means that certificates and keys from the first node have to be copied over before it can also become a controller.
I realized that afterwards, and forgot I left that in. But thank you so much for noticing though, comments like those are very helpful 😃
Dude, you are awesome! Thank you a lot!
Nice sharing a lot of knowledge here
Awesome explanations! Do you plan in any time soon to release a video with loadbalancer setup for k8s cluster too ? And maybe a nextcloud server in the k8s cluster? Would be great for sure! 🤝♥️
Great video! Keep up the great work!
Thanks!
great tutorial !!
Thanks a lot for this, Jay. Very helpful. On a side note, I was sitting here getting completely triggered by your pronunciation of sudo and lib. After thinking about it, your way actually seems more correct. My entire Linux career has been a lie 😂
Great demo Jay. Can you cover ingress in a future video?
Great tutorial and fantastic content! Thank you!
As usual, your videos are fantastic from the fact that you are a great teacher. If I have to be picky, in this video audio is a bit out of sync. ;) . Also, in the blog you forgot to add a command to update k8s packages. Would you consider doing a video on Ansible -AWX at levels 200-300?
Idk if it is desynchronized audio and video streams. He has a cadence and delivery that can seem delayed or belated .
Thanks!
thx for the video
Hello Jay, what about the database and a second ctrl-node? is there a possibility for a video (for the integraded db shared on different nodes, not with an extra host with my-sql)
DHCP with DynDNS updates make the early parts so much easier. As soon as I give my temlate clone a hostname and boot it, it gets a DNS entry. I still did give them static assignments too.
The issue wasn't that the token expired, but you tried to add the other nodes as control planes. This only works if you copied the right CA certificates first. You should've used the 2nd join command which didn't include the --control-plane argument
Very nice. :D Thanks. :D
The step to modify netplan requires nano, which is not part of ubuntu-22.04-minimal-cloudimg-amd64.img (used in the recommended/prior video) 'sudo apt install -y nano' works, just noting it here for folks who might get confused (and for any notes on a future version of this video).
Hi Jay, this Kubernetes video is straight-forward & to the point. I was wondering if you have pointers on how to perform your steps but using Oracle VirtualBox. If I have 3 Ubuntu 22.04 VMs on VirtualBox with similar specs to your VMs & use /etc/hosts to network them. Is this a good starting point?
Awesome. The only comment I have is that you forgat to add the command to link the kubernetes repositories in the blogpost writeup. Other than that, continue the great work!
Great video ❤! I'd like to know if anyone has opinion on MaaS + K8 vs PVE + K8. Which one is better for production based on your experience?
Thanks a lot for this valuable tutorial. However, part of it needs to be fixed or updated as I have faced various errors on the way still this helped me to set up my first Kubernetes cluster!!
today a dream came true, thank you ahaha :)
To see the IP address in the k8s-ctrlr and k8s-node will be available after qemu-guest-agent "start" and "enable".
Hi Jay, thanks for this usefull guide! It's awesome for a noob like me that are learning!
Is it possible to manage and view the K8s cluster with an interface like for example OpenLens or something similar? Can it possibly be installed on a dedicated VM or in a Docker container?
Thank you!!
Thanks for the video. Love your content. However, the blog post does not match the commands in the video at the point where you need to add the repos for apt. It does not work. Gives me errors that the key is not matching and that the release has no release file. At this point, I am not able to install the kube utils with apt install. Tried using SNAP but that didn't work either. Could you update your blog and video to get us back up to current workings?
Hi There! Love your channel! Any plans to do a Gentoo install. I have been trying to install it on an Asus VivoBook 1TB NVME set up and can’t get it to boot because it gives an error saying it “block device is invalid”. Makes me think there is a specialized driver that need to be loaded by initramfs before loading the kernel. Very weird… Thanks!
please start a playlist from there :D
thanks for the nice tutorial. On the written version, you are missing the step to add the k8s repo, it jumps from adding the gpg key to installing the kubeadm... packages
Very nice tutorial. I will definitely give it another go after running into some issues in the past. Any idea if the same steps (with some minor changes) work on Debian as well?
Can confirm that it works for the most part. The only real difference is that the version of containerd was slightly different (1.4), so the option for systemd cgroup is slightly different, problem is that there is one that looks like it, but it has to be the one that is in the runc.options section.
Thanks again for the awesome video
I have a question - what's the advantage of going the route you're describing, as opposed to just installing microk8s from the distribution and calling it a day?
you get vanilla k8s vs an opinionated/OEM based version of Kubernetes - both have their pros and cons
The blog post doesn't include the command to add the repositories....
Just so you know the blog post is missing the step to add the k8s repository. You have the step to get the key but do not actually add the repo.
Hi Jay, I bought your book first edition. Is it possible to update to the newest 22.04 version?
Jay, why not k3s favour of kubernetes, espacially for home/lab environment? People say K3S requires much less resources.
same question here 😉
Hello, I would like to have a TrueNas course. I really enjoyed this Proxmox course, especially for its didactic and methodical nature, and the way of explaining and organizing the topics and each of the relevant aspects. While I've heard your recommendations about other channels that deal with TrueNas, they clearly don't deal with it in the same way or as extensively as you do. Thank you very much.
The main issue with covering TrueNAS is that it's BSD and not Linux. But now we have TrueNAS Scale, so there's no reason not to consider covering it. I'll definitely consider that and it does sound like a great idea!
@@LearnLinuxTV You're awesome. Thank you very much. I'm waiting for my paid to support you.
Is this guide now OBE? The xenial keyring is no longer signed and the kubeadm/kubectl/kubelet install commands suggest installing as snaps. Thoughts?
Have you added Ingress to this setup so that you can access the cluster from outside from your network? Setting this up in AWS is simple you just add LB. What about home network? Have you used Nginx deployed in proxmox as well or maybe metallb?
any chance you do a proxmox with ceph hyper-converged tutorial?
Is it possible to run all config of the nodes and controller usin Ansible or Terraform?
Do you have anything that talks about storage and persistent volumes in Kubernetes? I followed this and have a working cluster, but some of the things I want to run like redis require persistent volumes, and I'm struggling to figure out the secret sauce.
Jay, thanks for all your videos and your book. I have learnt a lot from you.
But one question:
Why do you double the amount of work up until the point where you make a template of the worker node?
The steps are identical for the worker node and the control node up until that point, so the template can be used to generate all four nodes.
I have actually recreated the control node from this template and it works perfectly.
Me too!!! This is by far the best kubernetes setup around. All others can be a little unreliable. Can't get k3sup to work for anything.
I remain unclear whether the Proxmox VMs are paravirtualized and if the k8s cluster can then use the full power of the underlying hardware. Can you elaborate on that?
The blog article is missing the steps for adding the repository
Once I start being a System Admin for Ubuntu Servers, I would like to order your book then
I followed the tutorial and works great between the host machine and the cluster. However if I try to curl the URL (subnet:30080) from another Proxmox VM on the same subnet it is very slow, around 1.5minutes. curl from the host machine or any of the nodes takes less than 1s. Does anyone know what could this be? Thanks in advance
how about using talos VMs? it does the same thing, way quicker and easier to manage
Would be really dope if u made a discord
Unfortunately it's not working anymore :( Got stuck at initializing the cluster, which results in "[ERROR CRI]: container runtime is not running". Seems like there are some issues with the current versions. Just a heads-up for everyone following this tutorial! I am 50 minutes in and kinda need to restart from the beginning.
Not the fault of Jay, good tutorial in general! But to everyone trying this in Mar 2023: You might need to look for another guide.
Also be aware that some commands are just in the video and NOT in the linked blog article!
There is a typo in the pod.yml section on the blog right after metadata:
I'm stuck with this message, I'm a complete novice that wants to learn...
`starting serial terminal on interface serial0`
Can we get a link to where you got that shirt from?
Thanks for a great video!!!
I did, however, run into a problem, where I could not create my cluster. As it turns out, the issue lies with an incompatibility between kubernetes version 1.26 and containerd version 1.5.9. The error would look like: "command failed err=failed to run Kubelet: validate service connection : CRI v1 runtime API is not implemented for endpoint...."
The fix is quite easy: downgrade to kuberenetes 1.25 (sudo apt remove --purge kubelet && sudo apt install -y kubeadm kubelet=1.25.5-00) or to manually upgrade containerd to 1.6.0
Take a look at question "failed to run Kubelet: validate service connection: CRI v1 runtime API is not implemented for endpoint" on ServerFault.
thank you!
@@kmedleiss of course!
thank you so much for mentioning the same.
Instead of vm, can I deploy it on lxc?
Can anybody direct me to the latest repository that will be pulling the kubernetes packages from, the command is no longer on the video blog notes and I copied what was shown in the video but I get errors that the repository does not have Release file
Can k8s be setup on LXC instead of KVM nodes?
I don't see why not. I'm about to set one up.
Could the same kubernetes cluster be depolyed on LXC containers instead of VMs? Still using Ubuntu Server 22?
Have the same question
only issue I had is default install did not include nano so had to sudo apt install nano to get that editor installed lol
This is a fantastic introduction, but i'm confused as to why you would want multiple k8s nodes on the same vm server? isn't the point fault tolerance and resource distribution? I assumed that it would be best practices to have a single k8s node per physical server, disable HA for those particular VMs (because k8s does HA internally)... keeping HA on for the controller because I don't think the controller is fault tolerant if i'm not mistaken. I admit I'm a total noob with this stuff, but Id like to know more.
As far as I know, distributing the workload on a single physical machine with virtual machines is a valid approach. Like that you have virtual redundancy and scalability. If you want physical redundancy, you could replicate the virtual cluster on a second, third, and so on, physical machine. With this setup, you can distribute the application workload over multiple clusters on physical machines. So if one cluster should fail, you still have additional clusters which will handle the workload of the failed cluster. This multi cluster architecture would also enable running your services on hybrid cloud, multi-cloud, and other infrastructure models.
i usually run k8s on openstack which usually i run on proxmox
While watchin this guy. I 'm thinking "dr sheldon cooper fun with flags"
hahaha spot on.
Hello I try to install argocd? and tried the installation but gave many errors