POST

In this article we’ll see how simple it is to install Kubernetes onto some Ubuntu hosts using Pharos.

Pharos is a Certified Kubernetes with all batteries included. It is powered by the latest upstream version of Kubernetes kernel and include tools for cluster lifecycle management.

You will need at least one master (ideally 3) and at least one worker. For our simple demonstration we create three masters and worker using instances and images shown below: -

  • Master machine: 2 cores, 8Gi RAM, 80Gi root volume
  • Master image: Ubuntu-Bionic

  • Worker machine: 30 cores, 124Gi RAM, 800Gi root volume
  • Worker image: Ubuntu-Bionic

Installing pharos

Typically on a bastion instance in the cluster, where you have access to the compute instances, install pharos like this: -

$ curl -s https://get.k8spharos.dev | bash
$ chpharos install latest --use
$ source /usr/local/share/chpharos/chpharos.sh

Cluster topology

You provide the instance details and their roles in a a YAML file called cluster.yml (or cluster.yaml). You must be able to ssh to the instances you’ve created - and you define ssh criteria in the cluster definition. In it, identify your machines, the ssh key and the machine types.

A typical 3 master 1 worker cluster with the name “im-demo” and the label “purpose:application” on the worker instance looks like this: -

Name: im-demo
hosts:
- address: 192.168.253.40
  user: alan
  ssh_key_path: ~/.ssh/abc
  role: master
- address: 192.168.253.41
  user: alan
  ssh_key_path: ~/.ssh/abc
  role: master
- address: 192.168.253.42
  user: alan
  ssh_key_path: ~/.ssh/abc
  role: master
- address: 192.168.253.43
  user: alan
  ssh_key_path: ~/.ssh/abc
  role: worker
  labels:
    purpose: application

Installing Kubernetes

Now use pharos to create the cluster.

A simple 3-node master and single worker node shouldn’t take more than 8-10 minutes: -

$ pharos up -y -c cluster.yaml
[...]
==> Cluster has been crafted! (took 7 minutes 8 seconds)
    To configure kubectl for connecting to the cluster, use:
      pharos kubeconfig -c cluster.yaml -n im-demo > kubeconfig
      export KUBECONFIG=./kubeconfig

And, as instructed, you can craft a kubeconfig file with the command illustrated at the end of the installation and use that with kubectl: -

$ pharos kubeconfig -c cluster.yaml -n im-demo > kubeconfig
$ export KUBECONFIG=./kubeconfig
$ kubectl get no
NAME           STATUS   ROLES    AGE     VERSION
k8s-master-1   Ready    master   6m53s   v1.17.4
k8s-master-2   Ready    master   5m59s   v1.17.4
k8s-master-3   Ready    master   5m28s   v1.17.4
k8s-worker-1   Ready    worker   4m46s   v1.17.4
latest posts
by year
by category
Blog
Containers
Software design
Automation
IaC
Docking
Fragment network
Kubernetes
Web
Ansible
Python
Squonk