Installing Grafana with ingress
If you are deploying Prometheus and Grafana in Kubernetes, easiest way would be to use helm charts. But when you are deploying the helm chart, You will need to provide custom parameters mainly for storage configuration and service configuration to expose Grafana UI to outsiders.
In this blog I will share the artifacts I used in the AWS EKS. But if someone wants to change it to use in any other platform or a custom installation, just change the ingress annotations and you will be good.
For the basic installation I used eks workshop[1] to start with. Here everything is provided in command line. Instead I used yaml files and used the file with -f option of the helm command. My sample helm command would be like below.
helm install --name promethues stable/prometheus -f prometheus.yaml --namespace prometheus
My prometheus.yaml will be like below. Here I haven’t changed anything from eks workshop other than taking everything to yaml file. But if you intend to change something you can do so by adding more content to this yaml according to the structure of prometheus values.yaml[2].
alertmanager: persistentVolume: storageClass: "gp2" server: persistentVolume: storageClass: "gp2"
Tricky part would be to adding ingress to Grafana installation. I obviously followed the same path. I just customized values according to values.yaml of Grafana Helm chart[3].
Here some important notes are ingress.enabled should set to true. And then ingress.path should set to “/*” support Grafana UI. Other annotations set here are to support ALB ingress controller and to enable SSL to ALB.
And you can customize any other thing following format of the values.yaml of the chart.
persistence: storageClassName: "gp2" adminPassword: "EKS!sAWSome" ingress: enabled: true path: /* annotations: alb.ingress.kubernetes.io/scheme: internet-facing kubernetes.io/ingress.class: alb alb.ingress.kubernetes.io/certificate-arn: arn:aws:iam::xxxxxxxxx:server-certificate/aws alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS":443}]' alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}' external-dns.alpha.kubernetes.io/hostname: grafana.xxxx.xxx.xxx service: annotations: alb.ingress.kubernetes.io/target-type: ip datasources: datasources.yaml: apiVersion: 1 datasources: - name: Prometheus type: prometheus url: http://prometheus-server.prometheus.svc.cluster.local access: proxy isDefault: true
Hope this helps!!!.
Comments
Post a Comment