Harbormaster is a tool to bootstrap Kubernetes on Bare Metal. It creates a boot image which provisions a Cobbler server which in turn provisions Kubernetes via PXE.
- Docker
- A minimum of 3 servers on the same network
- Full control over DHCP/PXE for that network
- A way to attach a boot image to your servers.
The overall steps are as follows
- Build the Docker Image
- Configure settings via environment variables
- Run the Docker Image
- Use the resulting boot image via a USB key or IPMI to provision Harbormaster
- Harbormaster uses PXE to provision any machine on its network as a Kubernetes cluster member
Build the image using the included Docker file.
docker build -t harbormaster .
This tool takes settings via environment variables, please see the Dockerfile for reference.
There are many environment variables, so an envfile is prefered, an example file containing commonly modified variables is provided in ./networksettings
COBBLER_IP=192.168.100.100
ENABLE_PROXY=true
NETWORK_GATEWAY=192.168.100.2
NETWORK_DOMAIN=harbor0.group.company.com
NETWORK_BOOTP_START=192.168.100.5
NETWORK_BOOTP_END=192.168.100.254
NETWORK_NETMASK=255.255.255.0
NETWORK_SUBNET=192.168.100.0
NETWORK_UPSTREAMDNS=10.248.2.1
NETWORK_DNS_REVERSE=192.168.100
Run the container with your settings by issuing the following command:
docker run --env-file=./networksettings -v ~/harbormaster-output/:/output/ -v ~/harbormaster-build/:/build/ -it --privileged --rm harbormaster
This will download and process a few gigabytes worth of files. The process can take a few hours depending on your connection speed.
Once finished, there will be temporary files saved into ~/harbormaster-build/
to speed up future builds. In ~/harbormaster-output/
, there will be the boot image:
ls -1sh ~/harbormaster-output/
total 24576000
24576000 harbormaster.img
The image can be written to a USB drive, converted to a virtual disk, or mounted via IPMI.
In unix-like operating systems, make sure you correctly identify your USB device, then issue something like the following:
dd if=~/harbormaster-output/harbormaster.img of=/dev/USB_DEVICE bs=5m
If you want to test the image on a virtual machine, you can use Virtualbox:
VBoxManage convertfromraw harbormaster.img harbormaster.vmdk --format VMDK
You can now attach the image as a second hard drive to a VM to provision Harbormaster.
Many IPMI implementations allow you to mount the resulting image as a USB drive. It may also work mounted as a remote hard drive.
Once attached to a server and set as the primary boot device, the image will provision a Cobbler server named harbormaster.
Once provisioning is finished, you can now build out your Kubernetes cluster.
Provision your Kubernetes cluster by booting machines via PXE. It is best if you turn on one machine and wait for it to finish, this first machine will automatically be provisioned as a Master.
All machines after that will be provisioned as Nodes.
Configure kubectl
to talk to your master by issuing the following commands:
kubecl config set....