This is good way to run a multi-node cluster quickly in a single host for dev/testing. It can be enhanced with small VBox volumes and an additional VBox host network to implement core infrastructure parts like gluster and ingress. It can be left running, vagrant suspend/resume can freeze/thaw the whole cluster in a few seconds if you want to work on something else and don't want it holding resources (like on a laptop).
Here is the recipe, adapted from the official instructions here:
- Install VirtualBox
- Install Vagrant
- Check vagrant: "vagrant box list"
- Install kubectl
- curl -O https://storage.googleapis.com/kubernetes-release/release/v1.5.2/bin/linux/amd64/kubectl
- install in /usr/local/bin or your favorite spot in your PATH
- git clone https://github.com/coreos/coreos-kubernetes.git
- cd multinode/vagrant
- vagrant box add http://alpha.release.core-os.net/amd64-usr/current/coreos_production_virtualbox.json
- will download CoreOS for virtualbox
- cp config.rb.sample to config.rb and edit:
- Pick the channel and node sizes and counts according to your laptop resources (primarily memory), here's one example:
$update_channel="alpha"
$controller_count=1
$controller_vm_memory=512
$worker_count=2
$worker_vm_memory=1024
$etcd_count=1
$etcd_vm_memory=512
- Pick the channel and node sizes and counts according to your laptop resources (primarily memory), here's one example:
- Good to check your networking for collisions on unrouted address ranges that you'll encounter at work, home, etc.
- The default VM network specs are in the Vagrantfile: 172.17.4/24
vagrant up --provider virtualbox
export KUBECONFIG="${KUBECONFIG}:$(pwd)/kubeconfig"
Alt: Add the config to any existing ~/.kube/config if you are working with multiple clusters and or namespaces (kubectl set-cluster, kubectl set-context, etc.)
Should be operational, some useful commands (use in the multinode/vagrant path)
vagrant ssh c1 (or the other names) to get into coreos
vagrant status
vagrant suspend/resume
Once in a while net doesn't come back, and kubectl says:
The connection to the server 172.17.4.101:443 was refused - did you specify the right host or port?
In this case you can vagrant halt, vagrant up
vagrant destroy (obliterates)
- Just vagrant up and restart afresh
Enjoy,
D