Deploying a Kubernetes cluster with Vagrant on Virtual Box

Oracle has just included Kubernetes support for its VirtualBox Vagrant GitHub repository. With that it’s now easier than ever to get a Kubernetes cluster up and running inside VMs. If you have not come across Vagrant yet, it’s a great tool by HashiCorp for “Development Environments Made Easy“.

tl;dr

  1. Install VirtualBox
  2. Install Vagrant
  3. Clone the GitHub repository git clone https://github.com/oracle/vagrant-boxes
  4. Change into the vagrant-boxes/Kubernetes folder
  5. Run vagrant up master; vagrant ssh master
  6. Within the master guest, run as root: /vagrant/scripts/kubeadm-setup-master.sh
    You will be asked to log in to the Oracle Container Registry
  7. Run vagrant up worker1; vagrant ssh worker1
  8. Within the worker1 guest, run as root: /vagrant/scripts/kubeadm-setup-worker.sh
    You will be asked to log in to the Oracle Container Registry
  9. Repeat the last 2 steps for worker2

Your cluster is ready!
Within the master guest you can check the status of the cluster, as the vagrant user, e.g.:

kubectl cluster-info
kubectl get nodes
kubectl get pods --namespace=kube-system

Continue reading “Deploying a Kubernetes cluster with Vagrant on Virtual Box”