Part 3: Create VMs
3.1 Choose Your Network Layout
3.1.1 Select Subnets
My FreeBSD hypervisor has a 192.168.0.0/24 address on its physical network interface. I’m going to use a VLAN in 10.0.0.0/8 for the cluster and its pods and services. You can use another block, but you will have to adjust commands throughout the tutorial.
- 10.0.0.1/32 – VLAN gateway on bridge interface
- 10.0.0.2/32 – Virtual IP for Kubernetes API endpoint
- 10.0.10.0/24 – VM block
- 10.0.10.1[1-3] – K3s servers
- 10.0.10.2[1-3] – K3s agents (nodes)
- 10.1.0.0/16 – pod network
- 10.2.0.0/16 – service network
3.1.2 Pick a
.local Zone for DNS
This zone just needs to resolve locally on the FreeBSD host. I’m going with
k3s.local because I’m too lazy to think of a clever pun right now.
3.2 Create the Linux VMs
3.2.1 Initialize CBSD
If you haven’t run CBSD on your FreeBSD host before, you will need to set it up. You can use this seed file. Edit it first to set
node_name to your FreeBSD host’s name and to change
nodeippool if you are using a private network other than
3.2.2 Create VMs
instance.jconf VM template file and update
ci_nameserver_address fields as needed. If you want to set a password for the
ubuntu user in case you want to log in on the console via VNC, you can assign it to
cw_user_pw_user, but note this is a plain-text field.
When you run
cbsd bcreate, if CBSD does not have a copy of the installation ISO image, it will prompt you asking to download it. After the first time, it will re-use the local image.