Deploying Calico and Kubernetes on Container Linux by CoreOS using Vagrant and VirtualBox

These instructions allow you to set up a Kubernetes cluster with Calico networking using Vagrant and the Calico CNI plugin. This guide does not setup TLS between Kubernetes components.

1. Deploy cluster using Vagrant

1.1 Install dependencies

1.2 Download the source files

curl -O
curl -O
curl -O

1.3 Startup and SSH


vagrant up

Note: This will deploy a Kubernetes master and two Kubernetes nodes. To run more nodes, modify the value num_instances in the Vagrantfile before running vagrant up.

To connect to your servers

  • Linux/Mac OS X
    • run vagrant ssh <hostname>
  • Windows
    • Follow instructions from
    • run vagrant putty <hostname>

1.4 Verify environment

You should now have three CoreOS Container Linux servers:

Hostname IP

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

From k8s-master


From k8s-node-01


From k8s-node-02


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

And finally check that Docker is running on both hosts by running

docker ps

2. Configuring the Cluster and kubectl

Let’s configure kubectl so you can access the cluster from your local machine. Make sure you have kubectl installed locally. The version you choose depends on your host OS.

For Mac:

chmod +x ./kubectl

For Linux:

chmod +x ./kubectl

Then, tell kubectl to use the Vagrant cluster we just created.

kubectl config set-cluster vagrant-cluster --server=
kubectl config set-context vagrant-system --cluster=vagrant-cluster
kubectl config use-context vagrant-system

3. Install Addons

Install Calico

Calico can be installed on Kubernetes using Kubernetes resources (DaemonSets, etc).

The Calico self-hosted installation consists of three objects in the kube-system Namespace:

  • A ConfigMap which contains the Calico configuration.
  • A DaemonSet which installs the calico/node pod and CNI plugin.
  • A ReplicaSet which installs the calico/kube-policy-controller pod.

Install the Calico manifest:

kubectl apply -f

You should see the pods start in the kube-system Namespace:

$ kubectl get pods --namespace=kube-system
NAME                             READY     STATUS    RESTARTS   AGE
calico-node-1f4ih                2/2       Running   0          1m
calico-node-hor7x                2/2       Running   0          1m
calico-node-si5br                2/2       Running   0          1m
calico-policy-controller-so4gl   1/1       Running   0          1m
  info: 1 completed object(s) was(were) not shown in pods list. Pass --show-all to see all objects.

Install DNS

To install KubeDNS, use the provided manifest. This enables Kubernetes Service discovery.

kubectl apply -f

Next Steps

You should now have a fully functioning Kubernetes cluster using Calico for networking. You’re ready to use your cluster.

We recommend you try using Calico for Kubernetes NetworkPolicy.