The default Grafana instance installed on an OpenShift platform is read-only and cannot be used to create custom dashboards. Hence, users have to install a separate Grafana to use a customized dashboard to show/analyze their application metrics.
On amd64-based OpenShift, there is a community operator available on OperatorHub, which is provided without support guarantee. The same operator is not available on OperatorHub for s390x-based OpenShift Container Platform (OCP).
FUJITSU Enterprise Postgres (FEP) runs on OCP on both amd64 and s390x. FEPExporter exports data from FEPCluster to Prometheus. We needed a solution that works for both platforms: using Prometheus as the data source to display statistics on Grafana dashboards.
The procedure below shows users how to deploy Grafana on RedHat OpenShift architecture platform using a Helm Chart. The procedure includes configuration of the connection from Grafana to the OpenShift platform Prometheus data source.
To install Grafana using this procedure, the following are required:
Note: This procedure provides guidelines and tips for the installation process, and is not intended to replace product manuals. For updates and changes, please refer to the product manuals.
You will need a bastion server that is able to communicate with your OpenShift environment. If your OCP is on s390x, you must have an s390x-based bastion server as well. Similarly, for amd64-based OCP, you will need an amd64-based bastion server.
All commands will be run on the bastion server to install the required components on OCP.
A similar, intuitive process can be performed for any other platform.
Skip this part if Helm 3 is already installed on your bastion server.
$ curl -L https://mirror.openshift.com/pub/openshift-v4/clients/helm/latest/helm-linux-s390x -o /usr/local/bin/helm
$ chmod +x /usr/local/bin/helm
$ helm version
Obtain a copy of values.yaml from https://github.com/grafana/helm-charts/tree/main/charts/grafana and modify the following parts of the file.
repository: ibmcom/grafana-s390x
tag: 7.5.7
repository: grafana/grafana
tag: 7.5.11
adminUser: admin
adminPassword: admin-pwd
admin:
existingSecret: name-of-secret
userKey: admin-user
passwordKey: admin-pwd
oc create namespace <my-grafana-ns>
oc -n <my-grafana-ns> create sa <my-grafana-sa>
oc -n <my-grafana-ns> adm policy add-cluster-role-to-user view -z <my-grafana-sa>
oc -n <my-grafana-ns> serviceaccounts get-token <my-grafana-sa>
datasources: datasources.yaml: apiVersion: 1 datasources: - name: Prometheus-ds type: Prometheus url: "https://thanos-querier.openshift-monitoring.svc.cluster.local:9091" basicAuth: false withCredentials: false isDefault: true version: 1 editable: true jsonData: tlsSkipVerify: true timeInterval: "5s" httpHeaderName1: "Authorization" secureJsonData: httpHeaderValue1: "Bearer <value-of-obtained-token>"
oc get ns <my-grafana-ns> -o yaml | grep " annotations" -A6 annotations: openshift.io/description: Here grafana is installed using helm openshift.io/display-name: Grafana Using Helm openshift.io/requester: kube:admin openshift.io/sa.scc.mcs: s0:c30,c0 openshift.io/sa.scc.supplemental-groups: 1000870000/10000 openshift.io/sa.scc.uid-range: 1000870000/10000
securityContext: runAsUser: 1000870000 runAsGroup: 1000870000 fsGroup: 1000870000
After updating values.yaml, follow the steps below on the bastion server to install and check Grafana in the namespace.
The updated values.yaml must be stored in the current directory:
helm upgrade –install -n <my-grafana-ns> my-grafana grafana/grafana -f values.yaml
oc get pods -n <my-grafana-ns> NAME READY STATUS RESTARTS AGE my-grafana-556bf6f7b4-9vztq 1/1 Running 0 24h
Users can create a route entry for the link to Grafana from the OpenShift console. You may have to add an entry in your host file pointing to OpenShift console IP for this URL to reach the route.
Using the URL specified in the route, you will be able to go to Grafana screen. Login using the username and password you specified in values.yaml. For the initial login, you will be prompted to change the admin password.
Once logged in, you can click the gear icon on the left side of the Grafana screen. On this page, you will see the data source you specified in value.yaml. Click on Save & Test button at bottom of screen to confirm that the data source is working.
Now you can import or create your dashboard in this Grafana. You can download a sample copy from here.
Read our most recent articles regarding all aspects of PostgreSQL and FUJITSU Enterprise Postgres.