Deploy Epiphany Cluster

From Gejoreuy
Revision as of 13:04, 11 March 2020 by Gejor (talk | contribs) (→‎Troubleshooting)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Source

This page generated from : https://github.com/epiphany-platform/epiphany

Overview

Epiphany at its core is a full automation of Kubernetes and Docker plus additional builtin services/components like :

  • Kafka or RabbitMQ for high speed messaging/events
  • Prometheus and Alertmanager for monitoring with Graphana for visualization
  • Elasticsearch and Kibana for centralized logging
  • HAProxy for loadbalancing
  • Postgress for storage
  • KeyCloak for authentication

Epiphany can run on as few as one node (laptop, desktop, server) but the real value comes from running 3 or more nodes for scale and HA. Nodes can be added or removed at will depending on data in the manifest. Everything is data driven so simply changing the manifest data and running the automation will modify the environment.

We currently use Terraform and Ansible for our automation orchestration. All automation is idempotent so you can run it as many times as you wish and it will maintain the same state unless you change the data. If someone makes a "snow flake" change to the environment (you should never do this) then simply running the automation again will put the environment back to the desired state.

Preparation

1. Prepare Local Machine

Local machine, can be Windows 10 as used in this case.
In this local machine, install following dependencies :

2. Prepare Cluster Machines

Cluster machine for epiphany must be build on Linux Ubuntu. Single machine or multiple machines.
In each machine, there must be user 'operations'. This user must be root and can be run sudo without password.

Step by Step

1. Pull Epicli Docker Image to Our Local Machine
In this case, we use local machine Windows 10 with Windows PowerShell.

  Syntac     :   PS C:\Users\idiksub> docker pull epiphanyplatform/epicli:[TAG]
  Example    :   PS C:\Users\idiksub> docker pull epiphanyplatform/epicli:0.5.1

2. Run Epicli Docker Image

  Syntac     :   PS C:\Users\idiksub> docker run -it -v LOCAL_DIR:/shared --rm epiphanyplatform/epicli:TAG
  Example 1  :   PS C:\Users\idiksub> docker run -it -v C:\Users\idiksub\Desktop\"ABB 2"\Project\Epiphany:/shared --rm epiphanyplatform/epicli:0.5.1
  Example 2  :   PS C:\Users\idiksub> docker run -it -v C:\Users\idiksub\Desktop\"ABB 2"\Project\Epiphany:/shared --rm komang/epicli:0.5.1

3. Test & Understand How Epicli Work

  bash-5.0# epicli --help

4. Generate Cluster Definition

We can generate cluster with minimum definition :

  Syntac     :  bash-5.0# epicli init -p [type] -n [cluster_name]
  Example    :  bash-5.0# epicli init -p any -n demomin

Or we also can generate cluster with full definition :

  Syntac     :  bash-5.0# epicli init -p [type] -n [cluster_name] --full
  Example    :  bash-5.0# epicli init -p any -n demofull --full

In this step, we'll get yml file as the cluster configuration.
We need to modify some values ((like our AWS secrets, directory path for SSH keys).
Once we are done with the yaml file, we can apply it.

5. Apply YAML File

  Syntac     :  bash-5.0# epicli apply -f [file_name]
  Example    :  bash-5.0# epicli apply -f demomin.yaml

Troubleshooting

Perl Package Not Installed

If we found error like below screenshoot where the message said "perl package is not installed" and "dpkg: error processing package libdpkg-perl", then we need to insatll the perl package manually into the cluster VM.
This troubleshooting can be done for another packages which can't be installed.

  root@gejoreuy:~# mv /etc/apt/sources.list.bak /etc/apt/sources.list
  root@gejoreuy:~# apt-get update -y
  root@gejoreuy:~# apt-get dist-upgrade
  root@gejoreuy:~# apt-get install -y libdpkg-perl

20200220-perl-package-not-installed.png


Create Epirepo Repository Taking Long Time / Stuck

  https://github.com/epiphany-platform/epiphany/pull/967/commits/df92f1f1e83d5b62e72aa2bc34448a9177aa3808


Kubectl Connection Error

Sometimes, in some of epiphany version, we got this error after deploying the epiphany : "The connection to the server localhost:8080 was refused - did you specify the right host or port?" like below screenshoot.

20200225-kubectl-connection-error.png

This is because there is no config file in .kube directory. To fix it, just copy admin file from root to the user path.

  operations@gejoreuy:~# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config 
  operations@gejoreuy:~# sudo chown $(id -u):$(id -g) $HOME/.kube/config


Access Kubernetes Master

Run the proxy and then set the tunnel port in Putty which run the kubernetes-master node.

  [operations@komang-azdemomin-kubernetes-master-vm-0 ~]$ kubectl proxy --address 0.0.0.0
  Starting to serve on [::]:8001

Then just open from browser this link : http://

  http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/


Get Kubernetes Dashboard Token

  [operations@komang-azdemomin-kubernetes-master-vm-0 ~]$ kubectl get secrets -A
  [operations@komang-azdemomin-kubernetes-master-vm-0 ~]$ kubectl describe secret -n kube-system admin-token-qsxws