Running the Calico rkt tutorials on CoreOS Container Linux using Vagrant and VirtualBox

This is a Quick Start guide that uses Vagrant and VirtualBox to create a two-node Calico cluster that can be used to run through the tutorial for Calico in a pure rkt environment.

Environment setup

This section contains the requirements and steps required to ensure your local environment is correctly configured.

1. Install dependencies

You will need to install the following software:

2. Clone this project

Clone the calico project into a suitable location on your local host.

git clone https://github.com/projectcalico/calico.git

3. Startup and SSH

Change into the directory for this guide:

cd calico/v2.0/getting-started/rkt/installation/vagrant-coreos

To start the cluster, run:

vagrant up

To connect to your servers:

  • Linux/Mac OS X
    • run vagrant ssh <hostname>
  • Windows
    • Follow instructions from https://github.com/nickryand/vagrant-multi-putty
    • run vagrant putty <hostname>

4. Verify environment

You should now have two CoreOS Container Linux servers. The servers are named calico-01 and calico-02 and have IP addresses 172.18.18.101 and 172.18.18.102.

At this point, it’s worth checking that your servers can ping each other.

From calico-01

ping 172.18.18.102

From calico-02

ping 172.18.18.101

If you see ping failures, the likely culprit is a problem with the VirtualBox network between the VMs. You should check that each host is connected to the same virtual network adapter in VirtualBox and rebooting the host may also help. Remember to shut down the VMs with vagrant halt before you reboot.

You should also verify each host can access etcd. The following will return an error if etcd is not available.

curl -L http://172.18.18.101:2379/version

Check that rkt is running on both hosts by running

sudo rkt list

Verify that calicoctl (the Calico CLI) is installed by running

calicoctl version

5. Start the Calico service

Start the Calico service on both hosts

sudo rkt run --stage1-path=/usr/share/rkt/stage1-fly.aci \
  --set-env=ETCD_ENDPOINTS=http://172.18.18.101:2379 \
  --insecure-options=image \
  --volume=birdctl,kind=host,source=/var/run/calico,readOnly=false \
  --mount=volume=birdctl,target=/var/run/calico \
  --volume=mods,kind=host,source=/lib/modules,readOnly=false  \
  --mount=volume=mods,target=/lib/modules \
  --volume=logs,kind=host,source=/var/log/calico,readOnly=false \
  --mount=volume=logs,target=/var/log/calico \
  --set-env=IP=autodetect \
  --net=host \
  quay.io/calico/node:v1.0.2 &

This will create a calico/node rkt container.

You can check that it’s running using sudo rkt list.

$ sudo rkt list
UUID      APP	IMAGE NAME                  STATE   CREATED         STARTED         NETWORKS
b52bba11  node  quay.io/calico/node:v1.0.2  running 10 seconds ago  10 seconds ago

Try out Calico networking

Now that you have a basic two node CoreOS Container Linux cluster setup, see the Basic Network Isolation guide for an example of managing Calico policy with your rkt containers.