When studying for the CKAD (Certified Kubernetes Application Developer) exam, I practiced using the Killer Coda CKAD scenarios and the Killer Shell Exam Simulator. The exam simulator sets up a remote Linux XFCE desktop environment with a browser and terminal.
When practicing various Kubernetes commands, I used minikube and colima to set up Kubernetes with Docker. However, this isn’t the same experience as navigating a desktop with a specific resolution, set of tools, and slightly different keyboard shortcuts. To get the same experience, without being limited to a few exam simulator sessions, I looked into VirtualBox and Vagrant. VirtualBox is a virtualization system, and Apple Silicon chips became supported by VirtualBox in September 2024.
VirtualBox 7.1
Here are the steps I took to run a Debian desktop environment in VirtualBox:
- Download version 7.1+ of VirtualBox for
macOS / Apple Silicon hosts
- Download an ARM64 ISO for the Debian GNU/Linux distribution
- Install VirtualBox
- Start VirtualBox
- Drop the Debian
.iso
file onto VirtualBox- You can “skip the unattended installation”
- Set the hard disk size, base memory, and number of processors
- Adjust the amount of storage in the settings for the virtual machine
- Go to Settings > Display for the virtual machine and change the “Scale Factor” from 100% to 200% (or larger)
- Go to Settings > Network and change “Attached to” from NAT to Bridged Adapter, the Adapter Type to “Intel PRO/1000 MT Desktop (82540EM),” and the Promiscuous Mode to “Allow All.” The network settings must be fixed if the network mirrors do not work correctly during the installation process.
- Start the virtual machine and follow the usual steps for a Debian installation
For Kubernetes, you can install kubectl and minikube via apt-get:
- https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#install-using-native-package-management
- https://minikube.sigs.k8s.io/docs/start/?arch=%2Flinux%2Farm64%2Fstable%2Fdebian+package
# kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl"
chmod u+x ./kubectl
# minikube
curl -LO https://github.com/kubernetes/minikube/releases/latest/download/minikube_latest_arm64.deb
sudo dpkg -i minikube_latest_arm64.deb
# test the installation
minikube start
kubectl get po -A
You may need to unset the following VirtualBox global setting because it could cause issues with spinning up a virtual machine on Apple Silicon:
VBoxManage setextradata global "VBoxInternal/Devices/pcbios/0/Config/DebugLevel"
Vagrant
Many of the above steps are manual and can be done through the VirtualBox interface. You can use Vagrant to automate the steps. Vagrant makes it simpler to reproduce a working virtual machine environment.
Install Vagrant using Homebrew:
brew tap hashicorp/tap
brew install hashicorp/tap/hashicorp-vagrant
For the manual steps above to change the storage and network settings, this is how you would automate the configuration with Vagrant:
config.vm.provider "virtualbox" do |vb|
# ...
vb.customize ["storagectl", :id, "--name", "VirtIO Controller", "--hostiocache", "on"]
vb.customize ["modifyvm", :id, "--nictype1", "82540EM"]
end
DNS resolution can be provisioned with this:
config.vm.provision "shell", inline: <<-SHELL
echo 'DNS=8.8.8.8' >> /etc/systemd/resolved.conf
systemctl restart systemd-resolved
SHELL