Deploy Containerum on Kubernetes cluster

Easily deploy and manage applications in Kubernetes

Kubernetes is an open source project created by Google that helps to automate the process of managing and deploying multi-container applications. A lot of applications are built using different containers for servers, databases, front ends, web services and so on. The same goes for microservices as well, drawing on different APIs or databases for each service to connect them together. Kubernetes helps to implement such application architectures.

Kubernetes handles a lot of the detail for container-based applications such as storage, networking, applications scaling and deploying new versions without downtime. There are a lot of helpful tools that can help you work with the Kubernetes system. 

In this article, before installing Containerum, we will look at an overview of a few Kubernetes tools and how to set up and use them to run your application in a cluster. We will assume that you run Linux OS, for other OS you can view their corresponding documentation sites.

  • Minikube
  • Kubectl 
  • Helm
  • Containerum 

Minikube 

Minikube is a single-node Kubernetes cluster designed for testing and development purposes. It's free, available on Linux, OSX, and Windows, easy to set up and a good tool to explore Kubernetes features. 

Install Minikube

Before you begin you must enable  AMD-v or VT-x virtualization in BIOS. Also, you need appropriate hypervisor installed for your OS. For Linux install VB or KVM. After that just run:

curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.28.2/minikube-linux-amd64

Make it executable:

chmod +x minikube

Move Minikube executable inside the bin directory:

sudo mv minikube /usr/local/bin/

Check if Minikube is installed:

minikube version

You should see minikube version: v0.28.2.

Kubectl

Kubectl is a command-line tool that helps you with managing and deploying Kubernetes applications and it makes much easier to autocomplete commands, flags, and objects. Checkout Kubectl Cheat Sheet for all of the available commands.

Install Kubectl

One of the requirements is to use Kubectl version no bigger than one minor version of Kubernetes(e.g v1.3 should work with v1.2, 1.3 and 1.4). To install Kubectl binary from native package manager run next commands.

sudo apt-get update && sudo apt-get install -y apt-transport-https


curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -


sudo touch /etc/apt/sources.list.d/kubernetes.list


echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list


sudo apt-get update


sudo apt-get install -y kubectl

For different OS types check the official Kubectl documentation.

Helm

Helm is Open Source Kubernetes package manager that helps you install, create, and upgrade applications. You can think of Helm as apt or homebrew for Kubernetes. Helm Charts – such as Postgresql, Nginx, Alpine or MySQL – allow developers to quickly get a working environment for their application.

Install Helm

1. Download the latest version from releases.

2. Unpack it:

tar -zxvf helm-v2.0.0-linux-amd64.tgz

3. Move helm binary to the desired directory:

mv linux-amd64/helm /usr/local/bin/helm

To check if the helm is installed run:

helm help

You should get a list with available helm commands.

Containerum 

One more awesome Open Source tool that comes to the rescue. Containerum is a platform for full management of Kubernetes clusters. It consists of several components:

  • api-gateway that provides routing for Containerum components.
  • user-manager for managing users for Containerum.
  • resource for managing of namespaces, deployments etc.
  • permissions manage user access to enable teamwork.
  • kube-api set of Containerum APIs.
  • auth for authorization.
  • mail - mail server.
  • ui - Containerum UI.
  • solutions is a service for launching pre-built application configurations.
  • volume-manager is a storage manager.
  • nodeMetrics is Prometheus service for monitoring.
  • chkit is Containerum CLI.

PostgreSQL and MongoDB are required for storing data about resources, users etc. In this chart, you can check how all of the Containerum components are connected.


As you can see Containerum offers a web interface and a CLI tool. Also, you can try Containerum online with test environment provided.

Install Containerum and connect all tools together

First, check if your Kubernetes cluster is running:

kubectl version

You should see information about Client and Server version e.g:

Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.2", GitCommit:"bb9ffb1654d4a729bb4cec18ff088eacc153c239", GitTreeState:"clean", BuildDate:"2018-08-07T23:17:28Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}

Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-26T16:44:10Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}

 and get more information about cluster:

 kubectl cluster-info

It will display the addresses of the master and services.

Setup nginx-ingress

Ingress allow inbound connections to connect to cluster services. You can configure ingress to give services URLs, SSL, load balance, and much more.

To add nginx-ingress controller from the official Kubernetes repository run:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/mandatory.yaml

After installation, you should create an ingress service for connecting with Containerum ingress. Create ingress-svc.yaml with minimal configuration:

apiVersion: v1

kind: Service

metadata:

name: ingress-nginx

namespace: ingress-nginx

spec:

ports:

- name: http

port: 80

targetPort: 80

protocol: TCP

- name: https

port: 443

targetPort: 443

protocol: TCP

selector:

app.kubernetes.io/name: ingress-nginx

externalIPs:

- 10.122.22.23 #your external ip goes here

Instead of externalIps, you can specify NodePort where NodePort service will open a port to all of the Nodes on the cluster and forward all of the traffic to the services.

Then apply it:

kubectl apply -f ingress-svc.yaml

Next, we will install Containerum with Helm so Helm run command must be executed

 helm init

After that run:

helm repo add containerum https://charts.containerum.io

helm repo update

helm install containerum/containerum

You can add --version parameter to install Containerum and specify a version.

Check if ingress is setup:

kubectl get ingress

You should see Containerum UI and API setup:

Next, check that all of the Containerum services are running:

kubectl get pod

Sometimes it takes a few minutes for all services to be available and you can see ContainerCreating status.

Wait until all of the pods are up and running.

Great, Containerum is setup and running. Next, we will start Containerum UI from where you can start and deploy your project. Inside /etc/hosts add new host:

10.122.22.23 local.containerum.io api.local.containerum.io

Or if you setup nginx-ingress with NodePort open UI IP address.

Next open http://local.containerum.io. You should see the login page.

Use default username(same on the picture above) and password: verystrongpassword.

After login, you can see Projects, Volumes, Support, and Solutions sections from where you can start your application. In the Tour section, you can get more information about how to use the Containerum UI. You can explore and check pre-built solutions like Magento, MongoDB, Redis, PostgreSQL etc. If you have some suggestions or found any bugs while testing the platform you can report them in the official GitHub repository. For further information or specific configurations as setup SMTP server, add external IP's check the official documentation .