Setting up Prometheus and Grafana


Prometheus is a monitoring solution. It helps you store the time series data, like metrics of an application. You can view these metrices using Grafana that presents the information to you in graphical dashboard. 

This section guides you on deploying Prometheus and Grafana. It also discusses how you can configure Prometheus to store Adeptia Connect metrices. 

Deploying Prometheus and Grafana

Before you begin to deploy Prometheus and Grafana, make sure that you have met the following prerequisites.

Prerequisites

  • Kubernetes 1.16+
  • Helm 3+

To deploy Prometheus and Grafana, you need to follow the steps as given below.

  1. Run the following command to add the Prometheus and Grafana helm chart from the Prometheus helm repository.

    helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
  2. Update the Helm repository by running the following command.

    helm repo update
  3. Run the helm install command as shown below to deploy Prometheus and Grafana.

    helm install <NAME OF THE RELEASE> prometheus-community/kube-prometheus-stack -n <NAMESPACE>

Creating Service Monitor yaml file

After you have deployed Prometheus, you need to create a service monitor file. You can create the service monitor file by using the following content.

apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  labels:
    app: portal
    app.kubernetes.io/instance: portal
    app.kubernetes.io/part-of: portal
  name: portal
  namespace: adeptia-ga
spec:
  endpoints:
  - port: https
    path: /prometheus
    scheme: https
    tlsConfig:
      caFile: "/adeptia-cert/ca_file"
      certFile: "/adeptia-cert/cert_file"
      insecureSkipVerify: true
      keyFile: "/adeptia-cert/key_file"
  namespaceSelector:
    matchNames:
    - adeptia-ga
  selector:
    matchLabels:
      app.kubernetes.io/instance: portal
      app.kubernetes.io/name: portal
If you do not want to validate the SSL keys of Adeptia Connect application, set the value of insecureSkipVerify in the file to true

Run the following command.

kubectl apply -f servicemonitor.yaml -n <application namespace> 


Next, you need to configure Grafana to view the application metrices.