Table of Contents

Installing Grafana and Loki

Products: FastReport Corporate Server

Grafana is an analytics and interactive visualization component for monitoring cluster state. It is an optional component for deploying a report server, but it can be useful for tracking server state.

Loki is a log aggregator that is used in conjunction with Grafana.

Create a namespace for monitoring components

kubectl create namespace monitoring

Update charts for installing monitoring components

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

Install Loki

helm upgrade \
  --install loki loki/loki \
  --namespace=monitoring \
  --set persistence.enabled=true \
  --set persistence.storageClassName=hcloud-volumes

helm upgrade \
  --install promtail loki/promtail \
  --namespace=monitoring \
  --set loki.serviceName=loki.monitoring

Install Grafana

Don't forget to set theSERVER_DOMAIN_NAME variable.

export SERVER_DOMAIN_NAME="<server domain name>"

helm upgrade \
  --install grafana stable/grafana \
  --namespace=monitoring \
  --set persistence.enabled=true \
  --set persistence.storageClassName=hcloud-volumes \
  --set 'grafana\.ini'.server.serve_from_sub_path=true \
  --set 'grafana\.ini'.server.root_url=https://$SERVER_DOMAIN_NAME/grafana/ \
  --set 'grafana\.ini'.server.domain=$SERVER_DOMAIN_NAME \
  --set readinessProbe.httpGet.path=/grafana/api/health \
  --set livenessProbe.httpGet.path=/grafana/api/health \

Obtain a Grafana password

kubectl get secret --namespace monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo

admin
********

Add ingress

This configuration block allows Grafana to be placed on the same network interface as the report server and accessed via a link of the form: https://my.server-server.com/grafana

cat <<EOF | kubectl apply -f -
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: fastreport.cloud-grafana
  namespace: monitoring
  annotations:
    kubernetes.io/ingress.class: "nginx"    
    ingress.kubernetes.io/ssl-redirect: "true"
spec:  
  tls:
  - hosts:
    - $SERVER_DOMAIN_NAME
    secretName: fr-corporate-tls
  rules:
  - host: $SERVER_DOMAIN_NAME
    http:
      paths:      
      - path: /grafana
        backend:
          serviceName: grafana
          servicePort: 80
EOF

To complete Grafana’s configuration, you need to go to its page, authorize, and add a link to Loki http://loki.monitoring:3100