Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Vagrantfile Cleanup vagrant folder structure (#437) Jun 19, 2018
cluster.yml Add network LB to vagrant/centos example (#1061) Feb 11, 2019

Pharos Cluster with Vagrant & CentOS hosts

Pharos Cluster Vagrant setup for local testing using Vagrant and CentOS hosts.


  • Kontena Pharos toolchain installed locally
  • Vagrant toolchain installed
  • Copy of Vagrantfile and cluster.yml in this directory available locally

Install the latest version of Pharos CLI tool

$ chpharos install --use latest


$ vagrant up
$ pharos up
$ pharos kubeconfig > kubeconfig
$ export KUBECONFIG=kubeconfig
$ kubectl get nodes

Now you cluster is ready to take in your workloads.


Let's take a look what each of the steps actually does.

$ vagrant up

This will ensure that the virtual machines managed by Vagrant are up-and-running.

$ pharos up

This invokes Pharos CLI tool to setup and configure the Kubernetes cluster according to given cluster.yml file.

$ pharos kubeconfig > kubeconfig

This downloads the configuration file used for accessing the cluster for administrative purposes. This is somewhat analogous to having root access, so keep it safe.

$ export KUBECONFIG=kubeconfig

Sets up the downloaded access configuration to be used by kubectl and other such tools.

$ kubectl get nodes

Lists the nodes taking part in the cluster.

Network LB

In this example we'll also deploy the Kontena Network Loadbalancer addon. It allows easy experimentation with LoadBalancer type services on Kubernetes.

In this example the nodes are allocated with addresses. Kontena Network LB will be configured with address pool

To test out, let's create first a Deployment for Nginx:

$ kubectl run nginx --image=nginx

Then we need to expose that with a LoadBalancer type Service:

$ kubectl expose deployment nginx --port=80 --type=LoadBalancer

That will make the Network LB to select a free address from the configured pool and make the service available on that address:

$ kubectl get svc
NAME         TYPE           CLUSTER-IP      EXTERNAL-IP       PORT(S)        AGE
kubernetes   ClusterIP      <none>            443/TCP        4m46s
nginx        LoadBalancer   80:30464/TCP   11s

We can use the service address directly to access our Nginx deployment:

$ curl
<!DOCTYPE html>
<title>Welcome to nginx!</title>
    body {
        width: 35em;
        margin: 0 auto;
        font-family: Tahoma, Verdana, Arial, sans-serif;
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>

<p>For online documentation and support please refer to
<a href=""></a>.<br/>
Commercial support is available at
<a href=""></a>.</p>

<p><em>Thank you for using nginx.</em></p>


Complete teardown:

$ vagrant destroy

This will destroy the VMs and all state related to them.

You can’t perform that action at this time.