Deploying Metric Insights on OpenShift v3

OpenShift is Red Hat's version of Kubernetes. It is a viable option for container orchestration, especially if your organization already has a Red Hat subscription.

Deploying to OpenShift requires a deployment configuration file and docker images for each of the Metric Insights services. Let's walk through the process below.

Deployment process:

  1. Understanding Application Architecture
  2. Prerequisites
    1. Storage Class for Persistent Volumes
  3. Obtain Docker Registry Credentials
  4. Сreate Secret for Docker Registry
  5. Create Secrets for Each Metric Insights Service
  6. Create Configuration File and Deployment of Metric Insights Application
  7. Create Routes
  8. Access Metric Insights Application in Browser

For non-orchestrated environments, see the help article on using Simple Installer.

1. Understanding Application Architecture

Below is an architectural diagram of Metric Insights deployed in Kubernetes Namespace. A namespace is a virtual cluster that consists of several Nodes (servers). The nodes host Pods which is essentially a Container. Metric Insights consists of services that run inside their own container, rooted to a shared file system for persistence. 

The deployment scheme consists of the following services deployed in individual pods (1 service per pod):

Required services:

  1. Web Master  
  2. Data Analyzer    
  3. Data Processor  
  4. Seed   
  5. Monitoring

Optional services:

  1. Web Slave
  2. Remote Data Processor 1  
  3. Remote Data Processor 2

 Additional items of note:

  • A minimum of 3 Nodes are required for automatic failover
  • MySQL is required to host the Metric Insights application database, and it should run on a remote server
  • Persistent storage is required for the shared file system
2. Prerequisites

The following is required to deploy to OpenShift:

  • Access to the OpenShift Dashboard (Web UI)
  • OpenShift Container Platform command line interface (CLI)
  • Remote database server to host the application database (e.g., MySQL 8)
  • Persistent shared storage (e.g., NFS)
  • OpenShift Project for Metric Insights application:
    to create new project in OpenShift Dashboard click on Create Project (1) → fill text boxes (2) → click Create

2.1. Storage Class for Persistent Volumes

Openshift deployment supports only NFS type for the application file system, which is shared across pods as persistent volumes.

For NFS server hosted on Linux, please configure the mounted share as follows:

  • In /etc/exports, set the mounted share to /opt/mi with the following options:
    • rw,fsid=1,crossmnt,no_subtree_check,no_root_squash,async)

3. Obtain Docker Registry Credentials

Contact Metric Insights Support for access to the official Metric Insights Docker Registry. Credentials are needed to pull docker images for each Metric Insights service.

  • Note, the Metric Insights Docker Registry address (  is specified in the deployment configuration file.

4. Сreate Secret for Docker Registry

Before deploying to OpenShift, Docker Registry credentials must be registered as a Secret for K8 to reference. Metric Insights uses a secret labeled docker-registry to authenticate against a docker registry to pull docker images.

  • Note, a Secret is an object for storing and managing sensitive information like passwords and OAuth tokens. See Kubernetes/OpenShift Secrets for more.

Create a Secret for Docker Registry credentials using the OpenShift Dashboard:

  • Select the Metric Insights project:
  • Navigate to ResourcesSecrets:
  • Click on Create Secret button:
  • Edit fields with the following values and click on Create button:

5. Create Secrets for Each Metric Insights Service

Metric Insights provides template files (environment variables) to create secrets for each service:

  • web.env
  • dataprocessor.env
  • seed.env
  • mysql.secret
  • data_analyzer.env
  • monitoring.env

Templates for each are available in the installer directory: MetricInsights-Installer-v6.x.x-Full/utils/orchestration/kubernetes/secrets/

  1. Copy each template file from the installer directory to your working directory
  2. The template files are saved with the extension .j2 (e.g., web.env.j2). Rename each file by removing the .j2 extension.
  3. Open each file in an editor and update all fields. Ensure passwords are consistent between files.
    • You can encode passwords of our choice or create random passwords.
      • To encode, run echo -n '<password>' | base64
      • To generate a random password, run openssl rand -base64 8 | tr -d /=+ | cut -c -11
  4. Create the secrets for each service with Secret Type: Generic Secret by uploading each file to the form (1) or copy-paste content to the appropriate field (2).
    Here's an example for data-analyzer.env:

Example for dataprocessor.env:

Example for monitoring.env:

Example for mysql.secret:

Example for seed.env:

Example for web.env:

Note, you can also generate secret files and the application deployment manifest using the installer wizard option.

Secret files are saved to a separate folder, which must be created before running the installer wizard:

$ ./ kubernetes --wizard

Installer wizard example:

6. Create Configuration File and Deployment of Metric Insights Application

To create a deployment configuration file (also called a manifest), use the Metric Insights installer to generate a yaml file. Here's an example where we are setting the following values:

  • Kubernetes Type = openshift
  • Storage Type = NFS
  • NFS server address =
  • Private Docker Registry

If the remote DB server has the same timezone as MI app: 

./ kubernetes --type openshift --storage-class nfs --nfs-server-address <> --ingress-controller-type nginx --hostname <MI-hostname> --dp-hostname <dataprocessor_hostname> --registry <registry-url> --timezone <MI app timezone> -o <manifest filename>.yml

If the remote DB server has a different timezone than MI app:

./ kubernetes --type openshift --storage-class nfs --nfs-server-address <> --ingress-controller-type nginx --hostname <MI-hostname> --dp-hostname <dataprocessor_hostname> --registry <registry-url> --timezone <MI app timezone> --mysql-timezone <remote databaseserver timezone> -o <manifest filename>.yml

The key here is using the -o option for the output file and then specifying a file name with a *.yml extension (yaml file).

See ./ kubernetes -h for more options.

Next, apply the OpenShift manifest in the OpenShift Web Console using the newly created deployment configuration file:

Click the Add to Project dropdown menu (1) then select Import YAML / JSON (2):

Use Browse to upload the manifest file (1), or copy the file content directly to appropriate fields (2), then click on Create button (3):

Next, click the Continue button:

Click the Create button:

Confirm Creation by clicking on Create Anyway:

A confirmation message should appear confirming the deployment after which we can click on Close:

To deploy/update Metric Insights from the command line, rather than through the OpenShift Web Console:

$ oc apply -f application.yml unchanged 

$ oc process -f manifest.yml | oc apply -f - 
service/metricinsights-web unchanged 
deployment.apps/metricinsights-web-master unchanged 
deployment.apps/metricinsights-web-slave unchanged 
service/metricinsights-seed unchanged 
deployment.apps/metricinsights-seed unchanged 
service/metricinsights-dataprocessor unchanged 
deployment.apps/metricinsights-dataprocessor unchanged 
service/metricinsights-data-analyzer unchanged 
deployment.apps/metricinsights-data-analyzer unchanged 
service/metricinsights-monitoring unchanged 
deployment.apps/metricinsights-monitoring unchanged 
persistentvolume/metricinsights-default-data configured 
persistentvolumeclaim/metricinsights-default-data unchanged

7. Create Routes

Once Metric Insights is deployed, we need to create routes for MetricInsights Application and Monitoring Tool

Go to Application → Routes → Create Route

Example for creating Web Route:

Example for Metric Insights Web UI Route:

Note: Be sure to apply valid SSL certificate files for the appropriate hostname.

Example for Metric Insights Monitoring Route:

8. Access Metric Insights Application in a Browser

After creating the routes, we can access the Metric Insights application in a browser.
Navigate to the Routes menu and click on the appropriate link:

Each link should open the Metric Insights application and monitoring page in a new browser tab: