Skip to main content
Before installing a Kubernetes cluster with kubeadm, you need a few Linux nodes that will become the cluster machines. For a basic kubeadm demo we typically use three nodes: one control-plane and two workers. Instead of buying extra hardware, this guide shows how to create those nodes as virtual machines on a Windows laptop using a hypervisor and an automation tool. This tutorial uses:
  • VirtualBox as the hypervisor (free, cross-platform).
  • Vagrant to automate creating multiple VMs from a single Vagrantfile.
Note: On Apple Silicon (M1/M2/M3/M4) VirtualBox may not work reliably. If you are on macOS with Apple Silicon, consider using Multipass or follow macOS-specific instructions. Prerequisites:
  • Windows laptop with administrative rights
  • VirtualBox installed (see below)
  • Vagrant installed (see below)
  • Git (optional, to clone the example repository)
  • Internet access so Vagrant can download box images

Install VirtualBox (Windows)

Download and install VirtualBox from the official site: Select the Windows hosts installer for this demo, run the installer, and follow the prompts. During installation, you may see a network-related warning that VirtualBox will make temporary network changes — accept it so the installer can create the required virtual network interfaces.
A screenshot of the VirtualBox downloads webpage. It shows platform package links (Windows, macOS, Linux, Solaris) on the left and the Extension Pack license text with an "Accept and download" button on the right.
Run the installer and accept the network changes when prompted.
A screenshot showing an Oracle VirtualBox warning dialog about "Network Interfaces" (asking to proceed with installation) centered over a webpage listing VirtualBox platform packages and the Extension Pack download.
After installation you can open VirtualBox and manually create VMs (New → select an ISO, OS type, etc.). Creating three VMs manually is time consuming, so we’ll automate this with Vagrant.
A screenshot of Oracle VirtualBox’s "Create Virtual Machine" dialog, showing fields for name, folder, ISO image and the OS type set to Microsoft Windows (Windows 11 64-bit). The VirtualBox download/extension pack webpage is visible in the background.
If you are on macOS with Apple Silicon, use Multipass or macOS-specific instructions instead of VirtualBox to avoid compatibility issues.

Install Vagrant (Windows)

Download the Vagrant installer for Windows from the official site and run the MSI: After installation, restart your machine if prompted. Verify the installation:
Expected output (example):
Vagrant uses a Vagrantfile to automate VM creation. This guide uses a pre-built Vagrantfile (in the example repo below) that creates one control-plane VM and two worker VMs with fixed IPs for the cluster.
A screenshot of a GitHub repository page (kodekloudhub / certified-kubernetes-administrator-course) showing the file tree and a README titled "Installing Kubernetes the kubeadm way on VirtualBox."

Clone the repository and use the VirtualBox Vagrant configuration

Clone the example repository (replace with your desired repo URL if different):
Change into the VirtualBox Vagrant configuration directory:
Make sure VirtualBox is available before starting Vagrant (not strictly required, but helpful). Start up the VMs:
Vagrant will provision three VMs automatically (controlplane, node01, node02) using the VirtualBox provider. Typical output lines include:
A successful build finishes with a message such as:
If provisioning fails or you need to start over:
To check VM status:
Example output:

Connect to the VMs

SSH into any VM created by Vagrant. Example — control-plane:
You should see the Linux welcome message:
Open extra terminal tabs and connect to the worker nodes:
Rename terminal tabs or label them so you know which session corresponds to which VM.

Verify network interfaces and IP addresses

On each VM, list network interfaces and IPs:
Example (controlplane):
In this Vagrant configuration the VMs use a second interface (enp0s8) with addresses in the 192.168.86.0/24 network. The typical mapping is: You will also see enp0s3 with 10.0.2.15 on each VM — a NAT interface VirtualBox creates for internet access. For cluster communications and NodePort access we rely on the bridged/enp0s8 network, not the NAT interface.

Helpful Vagrantfile excerpts

The Vagrantfile configures BUILD_MODE, number of worker nodes, and helper functions. The following excerpts illustrate key configuration and helper logic. Network and build-mode configuration (Ruby):
OS detection and bridge adapter selection helpers:
Small helpers to detect VM state:
(You do not need to edit these excerpts — they illustrate how the Vagrantfile determines network adapters and node counts.)

Tear down the environment

When you are done and want to free resources, destroy the VMs created by Vagrant in the current directory:
This will stop and delete all VMs created by the Vagrantfile.

Next steps: kubeadm and Kubernetes bootstrap

With the three VMs provisioned and reachable via SSH, you can proceed to:
  1. Install Docker or containerd on all nodes.
  2. Install kubeadm, kubelet, and kubectl.
  3. Initialize the control-plane with kubeadm init.
  4. Join worker nodes with kubeadm join ....
Use the VM IP addresses listed above (192.168.86.32, 192.168.86.33, 192.168.86.34) for the cluster control-plane and worker node communications, and to access NodePort services from your host browser.

Troubleshooting tips

  • If vagrant up fails, inspect the Vagrant logs and provider output, then run vagrant destroy -f and try again.
  • If network bridged mode fails because your network does not provide free IPs, set BUILD_MODE = "NAT" in the Vagrantfile and adjust NAT IP ranges.
  • For VirtualBox networking issues on Windows, ensure Hyper-V is disabled (Hyper-V can conflict with VirtualBox networking).
  • If SSH is unavailable, verify the VM boot logs in VirtualBox and that the Vagrant box image download completed successfully.
With these VMs created and reachable, you’re ready to install and bootstrap Kubernetes using kubeadm.

Watch Video