Help build the future of open source observability software Open positions

Check out the open source projects we support Downloads

We cannot remember your choice unless you click the consent notice at the bottom.

How to deploy Grafana Enterprise Metrics on Red Hat OpenShift

How to deploy Grafana Enterprise Metrics on Red Hat OpenShift

2022-08-04 4 min

Here at Grafana Labs, we’re always looking for ways to provide our customers with a choice of platforms where they can run Grafana Enterprise Metrics (GEM). As part of that mission, we’re pleased to announce that we’ve added Red Hat OpenShift 4.x support to GEM.

GEM, as you may know, is a leading enterprise metrics solution. It has a unique approach to collecting metrics, storage, and administrative control that allows companies to run it securely at scale and significantly lower their operation costs. GEM is powered by the Grafana Mimir open source project for cloud native metric aggregation, and built by the maintainers of the project. 

Red Hat OpenShift is one of the leading on-premises enterprise Kubernetes solutions that can also run in various cloud environments. We recently added Red Hat OpenShift 4.x support to Grafana Enterprise Logs. Now, customers who have standardized on OpenShift or are leveraging it either in a cloud provider or on-premises can use Grafana Enterprise Metrics.  

By combining Red Hat OpenShift and GEM, Grafana Labs is providing an opportunity to leverage both for your Enterprise Metrics solution. It ensures metrics are collected and can be used to obtain information using PromQL, a super powerful and flexible query language. As a result, you’ll be able to resolve issues in a timely manner and analyze metrics that you can build just using the metrics collected and PromQL.

Setting this up is easy, so let’s get started.

How to deploy Grafana Enterprise Metrics on OpenShift

In the example below, we’re going to deploy GEM on OpenShift using a default configuration. We’re also assuming you have a valid GEM license and that it uses Minio for the buckets, as opposed to AWS, Google, or Azure. 

A few things to note before we begin: To support OpenShift, make sure you are using version 3.0.0 or above of the GEM Helm Chart. Also, OpenShift refers to “projects,” which work like namespaces.

Unlike other Kubernetes solutions, OpenShift uses Security Context Constraints (SCC) instead of Pod Security Policy (PSP). In order to provide the flexibility to use either security model with GEM, the Helm Chart allows you to specify your security model.

Step 1: Create a project where GEM will be deployed oc new-project ${PROJECT_NAME}

Step 2: Add the Grafana Helm charts repository

helm repo add grafana https://grafana.github.io/helm-charts
helm repo update

Step 3: Deploy the chart to your OpenShift cluster

In this example, ocp-gem is the name of the cluster when the license was created and is also used as the release name ( ${GEM_CLUSTER_NAME} ) in the helm command below.

helm install ${GEM_CLUSTER_NAME} \
grafana/mimir-distributed \
--set 'enterprise.enabled=true' \
--set 'rbac.create=true' \
--set 'rbac.type=scc' \
--set-file 'license.contents=./license.jwt' \
--namespace ${PROJECT_NAME}

These three properties will enable the enterprise version GEM, enable RBAC, and set the security policy to Security Context Constraints (SCC):

--set 'enterprise.enabled=true'
--set 'rbac.create=true' 
--set 'rbac.type=scc' 

Note: If –set enterprise.enabled=true is not set to true, the OSS version of Grafana Mimir will be installed.

Step 4: Check the status of the Pod that is running the tokengen job.

Once it’s completed, check that job’s logs for the new admin token:

oc logs ${TOKEN_GEN_POD_NAME} -n ${PROJECT_NAME}

After a couple of minutes you should see the following by running: oc get pods -n ${PROJECT_NAME}

The running GEM pods and completed token job pod in Red Hat OpenShift.
The running GEM pods and completed token job pod.

Below is the OpenShift UI representation of the running pods and completed token job.

Screenshot of running GEM pods and completed token job pod in the Red Hat OpenShift UI.
The running GEM pods and completed token job pod as seen in the Red Hat OpenShift UI.

If you are deploying GEM to use it in production, Grafana Enterprise support can help you configure it to match your needs. By default, Minio is used as block storage for testing purposes, and memcache, which is recommended for production, is off. To change these settings, edit the values.yaml file and set minio.enabled.false, then enable memcache for each one of the 5 memcached used as shown below:

memcachedExporter:
  # -- Whether memcached metrics should be exported
  enabled: true

chunks-cache:
  # -- Specifies whether memcached based chunks-cache should be enabled
  enabled: true

index-cache:
  # -- Specifies whether memcached based index-cache should be enabled
  enabled: true

metadata-cache:
  # -- Specifies whether memcached based metadata-cache should be enabled
  enabled: true

results-cache:
  # -- Specifies whether memcached based results-cache should be enabled
  enabled: true

And now you’re ready to go! Everything else you would normally do to configure GEM (such as defining your buckets) can be handled as usual. You can then deploy GEM regardless of where you run OpenShift — on-premises, AWS, GCP, Azure, etc.

If you’re interested in trying out Grafana Enterprise Metrics, please contact us!