Prerequisites

This section will cover the setting up of VM clusters necessary to follow the lab.

Getting started

The very first thing that we require before we start is 4 Virtual or Physical machines either one should work.

For now, I will be using UTM to virtualize all 4 machines on my MacOS. Feel free to follow through. For windows, it is much easier to initialize using WSL. Here’s a really awesome tutorial for that Running Multiple Distros on Windows WSL FHD1 by Timothy Unkert2.

First steps should be to download and install UTM3. After that, go ahead and download any linux distro of your choice4, but I do recommend starting out with debian5 as we are going to have a headless6 setup and debian is the industry standard for linux subsystems.

Downloads

If you are on Silicon Mac (M-series), make sure to download the ARM64 version https://cdimage.debian.org/debian-cd/current/arm64/iso-cd/


Here’s what it should look like setup-utm-blank

Requirements

NameDescriptionCPURAMStorage
jumpboxAdministration host1512MB10GB
serverKubernetes server12GB20GB
node-0Kubernetes worker node12GB20GB
node-1Kubernetes worker node12GB20GB

After you have the downloaded ISO, follow these steps from the UTM screen or you can also follow this video and use these steps if something is unclear.

Steps to install Linux Debian VM on UTM

  1. Create a new virtual machine
  2. Virtualize
  3. Linux
  4. Memory = 512 MB
  5. CPU cores = 1
  6. Disable display output
  7. Boot from ISO Image, Set the PATH to where your debian iso file
  8. Storage = 10 Gib
  9. Select a folder to share between this VM and MacOS
    • Optional: I like to create a new folder in Documents dir shared-utm
  10. Name = jumpbox and check Open VM Settings
  11. In the VM settings, set the Notes = Administration host
  12. See Devices section on the left, and remove Serial
    • Verify you don’t have Display as well, even though we removed it earlier during installation
  13. Save
  14. Click on Play
  15. Hit Enter until you’re on the hostname screen
  16. hostname = jumpbox
  17. Hit Enter, when asked about domain name
  18. Enter jumpbox for everything after that until partitioning method
  19. Select use entire disk for partition
    • Don’t worry, this just means it uses the entire 10 Gib defined above.
  20. Hit Enter until Write Changes to disk, select Yes and enter
  21. Hit Enter, until you’re on Software selection, select Debian Desktop Environment
  22. When you are at Finish Installation, click continue
    • It will reboot on to the same screen we started on. Stop the machine at this point
  23. Click on edit, and then go to Drives > USB Drives, Hit Clear
  24. Run the machine, and you should be in GRUB, Hit Enter
  25. Enter login = jumpbox
  26. Enter password = jumpbox
  27. Run sudo whoami
    • Verify that it returns jumpbox is not in the sudoers file.
  28. Run su
  29. Run /usr/sbin/usermod -aG sudo jumpbox
    • This command registers the default user ie: jumpbox as root user
  30. Run sudo shutdown now
  31. Run the machine again, and Enter sudo whoami
    • Verify it returns root
  32. You’re in!

We now have a system with default user jumpbox with root privileges. If you followed all these steps correctly, you should see this when you boot up setup-utm-debian Repeat all the steps for server, node-0, node-1 from the Requirements section. After you are done with the installation for all 4 VMs, you can safely delete the ISO file we downloaded at the very start.

Verify the installation

After these steps, go ahead and spin up your machines one by one and run this command and check if the output is similar to what is shown below (your version might differ, as in the lab7 the debian version is 12, while mine is 13 aka. trixie)

cat /etc/os-release

setup-utm-pretty-print

Conclusion

You can shutdown your machine with this command

# poweroff
/sbin/poweroff

ERROR

This should result in Access Denied

To get by this wall, enter this command

# root command
sudo shutdown now

This will prompt you to enter your password, In our case, password was jumpbox.

Now, if you run the previous command again. It should work.

IMPORTANT

You might have noticed, I wrote root command in the comments above. This is because sudo command gives us admin privilege in Linux. I will not cover Linux commands in this section, but they are really useful in learning K8s.

sudo works here just because during installation we gave the default user the root privileges needed. We would have wrote su instead if we didn’t do that step.


And that should be it, we are done with the most important thing. And remember,

“If it works, it works.” lol


Optional: Run VM through native terminal

Technically, you could get by with this approach, but in a production setting, oftentimes it is required to ssh8 into systems and work directly with terminal.

To replicate this, UTM has a useful feature we could use, that is utmctl. We could use this tool to run our VMs directly from Mac terminal.

ABSTRACT

This doesn’t mean you would be able to interact directly with Linux through Mac terminal like WSL2. You would still need to have UTM running in background. But, I still recommend this approach because it gives you hands on experience with how to work around with terminals. Personally, I like to have it running in background and have it set up so that it doesn’t show up in dock, but instead, in menu bar. You would notice, that you could also start it using the menu bar icon, but I like to do it through this tool.

Here are the steps if you still prefer to stick around:

  1. Install sudo

    Run su in the terminal and enter your password. Run apt update && apt install sudo

  2. Enable SSH

    Run apt update && apt install sudo

  3. Repeat the above steps for all VMs
    • We still have to be in su mode in order to access full sudo features because we haven’t configured the user to be a root user by default.
    • You could do it online if you want, but this isn’t strictly necessary for this lab.
  4. Enable utmctl for Mac terminal

    Open the Mac terminal and run sudo ln -sf /Applications/UTM.app/Contents/MacOS/utmctl /usr/local/bin/utmctl

    • This creates a symbolic link so the utmctl executable inside the UTM app bundle becomes available globally from your Mac terminal.

With this command, you would be able to run your systems directly from your terminal. You still have to login and interact via GUI for those VMs.

# machine-name = jumpbox, server, node-0, node-1
utmctl start machine-name

You can further verify this by running utmctl list. It will list all our VMs and the status for the machine-name should be started.


Visual Installation for utmctl

You could also use this really awesome youtube tutorial by Kobi Bell or this blog by Ryan himmelwright, if you prefer text.




Footnotes

  1. https://youtu.be/LGIXaVPS690?si=Fg8rv1mScBCMX5gC ↩

  2. https://www.youtube.com/@TimothyUnkert ↩

  3. https://mac.getutm.app ↩

  4. https://mac.getutm.app/gallery/ ↩

  5. https://www.debian.org ↩

  6. https://wiki.archlinux.org/title/Headless ↩

  7. https://github.com/kelseyhightower/kubernetes-the-hard-way/blob/master/docs/01-prerequisites.md ↩

  8. https://www.reddit.com/r/learnprogramming/comments/1lr71qp/can_someone_please_explain_ssh_to_me/ ↩