Setting up a Kubernetes Cluster using CoreOS on VMWare Fusion

Kubernetes Logo

I recently wanted to set up a local Kubernetes cluster for development on my Mac. I tried many howtos in various state of staleness and brokenness. The official Vagrant setup didn’t even work for me on OS X until yesterday.

While I was happy that the Vagrant setup was working again, my preferred development environment was on CoreOS via VMWare Fusion. The following is what worked for me. I’ve put together information from the Kubernetes “CoreOS Multinode Cluster” guide and the CoreOS “Running CoreOS on VMware” documentation.

Getting the latest CoreOS VMWare image

First, get the latest VMWare image for the CoreOS channel that you want. E.g. for the beta channel:

curl -LO http://beta.release.core-os.net/amd64-usr/current/coreos_production_vmware_ova.ova

Creating a virtual machine for the Kubernetes master

Open the downloaded file using VMWare Fusion. VMWare will create a .vmwarevm from the .ova. Give your virtual machine a name, e.g. “Kubernetes Master”.

We’ll use Cloud-Config to customise this CoreOS instance upon boot, turning it into our Kubernetes cluster master. Download the master.yaml file from the Kubernetes CoreOS getting started guide

Then create an .iso that VMWare can use as a config drive for the virtual machine.

mkdir -p /tmp/new-drive/openstack/latest/
cp master.yaml /tmp/new-drive/openstack/latest/user_data
hdiutil makehybrid -iso -joliet -joliet-volume-name "config-2" \ 
  -joliet -o master.iso /tmp/new-drive

You can get the virtual machine to access the .iso by going to the VM’s Settings, then CD/DVD (IDE).

Creating a Kubernetes minion virtual machine

Open the downloaded .ova file again using VMWare Fusion. Give your virtual machine a name, e.g. “Kubernetes Node 1″.

Download the node.yaml file from the Kubernetes CoreOS getting started guide. Edit the file and replace all instances of with the IP address of the master node. Then create a node config-drive.

mkdir -p /tmp/new-drive/openstack/latest/
cp node.yaml /tmp/new-drive/openstack/latest/user_data
hdiutil makehybrid -iso -joliet -joliet-volume-name "config-2" \ 
  -joliet -o node.iso /tmp/new-drive

Boot your Kubernetes node image using node.iso as a config drive. You can create multiple nodes and they will connect to the master.

Testing it out

Once you have both the master and minion up, you can use kubectl to check on the cluster.

kubectl -s <master-ip-address>:8080 get nodes
comments powered by Disqus