Find file History
gvenzl Merge pull request #79 from AmedeeBulle/dev-1-11
Update for K8s 1.11 from Developer channel
Latest commit eb4983d Dec 7, 2018

Vagrantfile to setup a Kubernetes Cluster on Oracle Linux 7

This Vagrantfile will provision a Kubernetes cluster with one master and n worker nodes (2 by default).


  1. Install Oracle VM VirtualBox
  2. Install Vagrant
  3. Sign in to Oracle Container Registry and accept the Oracle Standard Terms and Restrictions for the Container Services Business Area.

Quick start

  1. Clone this repository git clone
  2. Change into the vagrant-boxes/Kubernetes folder
  3. Run vagrant up master; vagrant ssh master
  4. Within the master guest, run as root: (*)
    You will be asked to log in to the Oracle Container Registry
  5. Run vagrant up worker1; vagrant ssh worker1
  6. Within the worker1 guest, run as root: (*)
    You will be asked to log in to the Oracle Container Registry
  7. 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

(*) If you have a password-less local container registry skip steps 4 and 6 (see Local Registry).

About the Vagrantfile

The VMs communicate via a private network:

  • Master node: / master.vagrant.vm
  • Worker node i: 192.168.99.(100+i) / worker_i_.vagrant.vm

The Vagrant provisioning script pre-loads Kubernetes and satisfies the pre-requisites. Unless you have a password-less Local Registry it does not run as this requires authentication to the Oracle Container Registry. This is done by the and helper scripts.


The Vagrantfile can be used as-is; there are a couple of parameters you can set to tailor the installation to your needs.

How to configure

There are several ways to set parameters:

  1. Update the Vagrantfile. This is straightforward; the downside is that you will loose changes when you update this repository.
  2. Use environment variables. Might be difficult to remember the parameters used when the box was instantiated.
  3. Use the .env/.env.local files (requires vagrant-env plugin). Configure your cluster by editing the .env file; or better copy .env to .env.local and edit the latter one, it won't be overridden when you update this repository and it won't mark your git tree as changed (you won't accidentally commit your local configuration!)

Parameters are considered in the following order (first one wins):

  1. Environment variables
  2. .env.local (if vagrant-env plugin is installed)
  3. .env (if vagrant-env plugin is installed)
  4. Vagrantfile definitions

Cluster parameters

  • NB_WORKERS (default: 2): the number of worker nodes to provision.
  • Yum channel parameters. The following 2 parameters can be used to enable the Preview and/or Developer channels. These channels are disabled by default to install the latest supported version of the Docker Engine and Kubernetes.
    • USE_PREVIEW (default: false): when true, Vagrant provisioning script will enable the Oracle Linux 7 Preview channel.
    • USE_DEV (default: false): when true, Vagrant provisioning script will enable the Oracle Linux 7 Developer channel.
      See also Installing the Developer release of Kubernetes.
  • MANAGE_FROM_HOST (default: false): when true, Vagrant will bind port 6443 from the master node to the host. This allows you to manage the cluster from the host itself using the generated admin.conf file (assuming kubectl is installed on the host).
  • BIND_PROXY (default: true): when true, Vagrant will bind the Kubernetes Proxy port from the master node to the host. Useful to access the Dashboard or any other application from outside the cluster. It is an easier alternative to ssh tunnel.
  • MEMORY (default: 2048): all VMs are provisioned with 2GB memory. This can be slightly reduced if memory is a concern.

Registry Mirror

If you are using an Oracle Container Registry Mirror you can use the following two parameters:

  • KUBE_REPO: registry hostname
  • KUBE_PREFIX: image prefix for Kubernetes container images

Example: to use the Oracle Container Registry mirror in Frankfurt, define

KUBE_PREFIX = "/kubernetes"

Local Registry

You can also setup a Local Registry. In addition to the KUBE_REPO and KUBE_PREFIX parameters you can also define:

  • KUBE_LOGIN (default: undefined/true): set to false if your registry does not require authentication.
  • KUBE_SSL (default: undefined/true): set to false if your registry does not use SSL.

Example: you have a local repository on, without authentication and SSL is not configured; this registry has been populated with: --to --version 1.9.1

You will then define in tour Vagrantfile:

KUBE_PREFIX = "/kubernetes"
KUBE_LOGIN = false
KUBE_SSL = false

Note: if you have a password-less registry (KUBE_LOGIN = false) the Vagrant provisioning script will also run the / scripts. In other words, your Kubernetes cluster will be fully operational after a vagrant up!

See also the Container Registry Vagrantfile to run a local registry in Vagrant.

Installing the Developer release of Kubernetes

To install the latest Developer release of Kubernetes you need to enable the Developer channel and amend the KUBE_PREFIX:

USE_DEV = true
KUBE_PREFIX = "/kubernetes_developer"

Optional plugins

You might want to install the following Vagrant plugins:

  • vagrant-env: loads environment variables from .env files;
  • vagrant-hosts: maintains /etc/hosts for the guest VMs;
  • vagrant-proxyconf: set proxies in the guest VMs if you need to access Internet through proxy. See plugin documentation for the configuration.


Please provide feedback of any kind via Github issues on this repository.