<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Devops With Somesh]]></title><description><![CDATA[This blog is created to help beginners learn complex topics easily, and can get the idea of how real-world DevOps operations happen. I will share my learnings t]]></description><link>https://devops-with-somesh.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Sat, 12 Sep 2026 06:43:45 GMT</lastBuildDate><atom:link href="https://devops-with-somesh.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Building a Lightweight Kubernetes Cluster with K3s and UTM VMs (MacOS)]]></title><description><![CDATA[Setting up a Kubernetes Cluster might seem intimidating, especially if you're new to infrastructure and using macOS. But don't worry!
I will walk you through every step of how I created a Kubernetes Cluster using K3s and UTM Virtual Machines, all on ...]]></description><link>https://devops-with-somesh.hashnode.dev/building-a-lightweight-kubernetes-cluster-with-k3s-and-utm-vms-macos</link><guid isPermaLink="true">https://devops-with-somesh.hashnode.dev/building-a-lightweight-kubernetes-cluster-with-k3s-and-utm-vms-macos</guid><category><![CDATA[Kubernetes]]></category><category><![CDATA[Homelab]]></category><category><![CDATA[Devops]]></category><category><![CDATA[Devops articles]]></category><category><![CDATA[k3s]]></category><category><![CDATA[utm]]></category><category><![CDATA[Linux]]></category><category><![CDATA[linux for beginners]]></category><category><![CDATA[Ubuntu]]></category><dc:creator><![CDATA[Somesh Panigrahi]]></dc:creator><pubDate>Wed, 30 Jul 2025 05:41:38 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/stock/unsplash/cckf4TsHAuw/upload/5f9d4dcdcc6e546343c82d363fdd6150.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Setting up a Kubernetes Cluster might seem intimidating, especially if you're new to infrastructure and using macOS. But don't worry!</p>
<p>I will walk you through every step of how I created a Kubernetes Cluster using K3s and UTM Virtual Machines, all on my Mac</p>
<p>Whether you are a beginner to DevOps or someone who is trying to simulate a real infrastructure for testing, this setup will be the most feasible for you. Before we begin, I'd like to provide an overview of UTM and K3s, as well as the reasons why we need them.</p>
<h3 id="heading-why-do-we-need-to-use-utm">Why do we need to use UTM?</h3>
<ol>
<li><p>UTM is free and open source, which means it can be easily used for building a home lab</p>
</li>
<li><p>It is specifically designed for macOS with a straightforward GUI for beginners to use. Yes!. Just install and Boom!!!</p>
</li>
<li><p>No Special permission is needed to use UTM because it runs on “Apple's Hypervisor virtualization framework,” which, in simple terms, means UTM runs in user space. Therefore, it does not need to add/write kernel extensions.</p>
</li>
<li><p>Under the hood, UTM uses QEMU, a very old and powerful virtualization engine that supports different CPU architectures like ARM and x86_64.</p>
</li>
</ol>
<h3 id="heading-now-you-all-have-heard-of-k8s-but-what-is-k3s">Now you all have heard of k8s, but what is k3s?</h3>
<p>“K3s” is a lightweight and minimal version of Kubernetes (K8s), which is designed to use very little CPU and memory. It simplifies or removes complicated components like etcd (for storage) and uses the default lightweight SQLite for storing cluster info. As it comes with a single binary, it makes k3s very easy to install and upgrade.</p>
<p>So, for testing and creating a homelab, K3s will be our partner.</p>
<p>Assuming you have installed UTM on a Mac, the next step is to download an OS image, which we will use to create VMs. In my case, I have used the Ubuntu image (Ubuntu 24.04.2 LTS). You can download the iso from <a target="_blank" href="https://ubuntu.com/download/server/arm">here</a>.</p>
<p>After this, the steps are:</p>
<h2 id="heading-step-1">STEP 1:</h2>
<p>When you open the UTM app, you will see something like this:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753611689049/c19aa8fc-e553-4bf2-ab86-08bf736d89da.png" alt /></p>
<p>Note: Ignore the Nodes created. Initially, the node list will be empty, and you have to create.</p>
<ul>
<li><p>Click on “Create a New Virtual Machine” and then on “Virtualize”.</p>
</li>
<li><p>Then click on “Linux”</p>
</li>
<li><p>Then get the ISO (downloaded before) and click on next</p>
</li>
<li><p>Set the CPU cores (2 is enough for Ubuntu)</p>
</li>
<li><p>Set the memory to around 4 GB</p>
</li>
<li><p>Set the size of the drive to around 64 GB</p>
</li>
<li><p>Click on save</p>
</li>
</ul>
<h2 id="heading-step-2">STEP 2:</h2>
<ul>
<li><p>Run the newly created instance, which will install the Linux</p>
</li>
<li><p>A very important step after installing is to close the VM and remove the “Ubuntu ISO” from the CD/DVD</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753626457960/bcb5b908-22cb-452c-a0ed-c8425c838b39.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Click on “clear” and it will remove the linkage</li>
</ul>
<h2 id="heading-step-3-installing-k3s-on-master-node">STEP 3 (Installing k3s on master node):</h2>
<ul>
<li><p>For simplicity, download two VMs and name one machine “master-node” and the other “worker-node-1”.</p>
</li>
<li><p>Run the “master-node” VM and open the terminal.</p>
</li>
<li><p>Firstly, to update each package installed, type “sudo apt update”. This updates each package, ensuring every package/module is the latest.</p>
</li>
<li><p>Enter “sudo ufw disable”. This turns off the uncomplicated firewall</p>
</li>
<li><p>Use “curl -sfL <a target="_blank" href="https://get.k3s.io">https://get.k3s.io</a> | INSTALL_K3S_EXEC="--flannel-backend=none --disable-network-policy" sh -”.</p>
</li>
</ul>
<p>Note: I have decided not to use “flannel” as it is the default CNI, and this will not provide us with the flexibility to learn networking in depth. We will use “Calico” as the CNI to attach the worker nodes later</p>
<ul>
<li><p>To link/attach other VMs as a worker node, we need the K3s Token.</p>
</li>
<li><p>type “sudo cat /var/lib/rancher/k3s/server/node-token”. This is the path where the token is stored, and the “cat” command is used to list the content</p>
</li>
<li><p>now type “ip a | grep inet”. It will give us the <strong>IP address</strong> of the master node.</p>
</li>
<li><p>Log in/ssh to the worker node created.</p>
</li>
<li><p>Here, also turn off the firewall by using “sudo ufw disable”</p>
</li>
<li><p>Open the terminal and paste this: curl -sfL <a target="_blank" href="https://get.k3s.io">https://get.k3s.io</a> | K3S_URL=https://&lt;MASTER_IP&gt;:6443 K3S_TOKEN=&lt;TOKEN&gt; sh -”. (The K3s server/ master node needs 6443 to be accessible by other worker nodes/agents.)</p>
</li>
<li><p>After the K3s gets installed in the worker node, go back to the master node and type “sudo kubectl get nodes”</p>
</li>
<li><p>You will see “worker-node” but the status will be “Not Ready” because there is no CNI installed</p>
</li>
</ul>
<h2 id="heading-step-4-installing-calico">STEP 4: (Installing Calico)</h2>
<ul>
<li><p>Go to Master Node and paste this in the terminal: “ kubectl apply -f <a target="_blank" href="https://raw.githubusercontent.com/projectcalico/calico/v3.30.2/manifests/calico.yaml">https://raw.githubusercontent.com/projectcalico/calico/v3.30.2/manifests/calico.yaml</a>”</p>
</li>
<li><p>If you type “sudo kubectl get pods” you will see this:</p>
</li>
<li><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753803325752/465d42bc-2a5b-4fdd-85cd-ae2e438e3575.png" alt="Ignore the helm-install pods" /></p>
<p>  Now, if you do “sudo kubectl get nodes -o wide”, you see this:</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753803520968/93d4278d-afaf-4f59-8e2c-995192fea778.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Now paste this in the terminal: “sudo vim /etc/cni/net.d/10-calico.conflist”.</p>
</li>
<li><p>add the ip-forewarding setting: "container_settings": { "allow_ip_forwarding": true }</p>
</li>
<li><p>Save and close the file using “wq!”.</p>
</li>
<li><p>If you now type “ sudo cat /etc/cni/net.d/10-calico.conflist”, you see the ip-forewarding is now set to true</p>
</li>
<li><p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1753806325383/8b44783f-89c3-4244-ad99-c534f11ae4d9.png" alt class="image--center mx-auto" /></p>
<p>  Congrats!!!. Calico is installed and the nodes are connected :)</p>
</li>
</ul>
<p>In conclusion, setting up a lightweight Kubernetes cluster using K3s and UTM virtual machines on macOS is an accessible and efficient way to simulate real infrastructure for testing and learning purposes. By leveraging UTM's user-friendly interface and K3s's minimal resource requirements, even beginners can create a functional Kubernetes environment. This setup not only provides a practical learning experience but also offers flexibility in exploring different networking configurations, such as using Calico as the CNI. With these tools, you can effectively build and manage a home lab, enhancing your understanding of Kubernetes and its components.</p>
]]></content:encoded></item></channel></rss>