Skip to content

Commit

Permalink
🔧(k8s) configure grafana to enable its ingress
Browse files Browse the repository at this point in the history
In the helm chart managing the prometheus stack, it is possible to
enable the grafana ingress in order to access its admin and visualize
all the metrics. Some variables are added to configure this part.
  • Loading branch information
lunika committed Nov 29, 2022
1 parent ccecd16 commit 6f110c0
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 7 deletions.
2 changes: 1 addition & 1 deletion k8s/base/jibri-hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# metric, which takes into account all jibri pods in the namespace (those
# managed by the deployment + the orphaned pods that are busy)

apiVersion: autoscaling/v2beta2
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: jibri-hpa
Expand Down
2 changes: 1 addition & 1 deletion k8s/base/jitsi-meet-front-hpa.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: autoscaling/v2beta2
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: jitsi-meet-front-hpa
Expand Down
2 changes: 1 addition & 1 deletion k8s/base/jvb-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ spec:
# Sidecar container that exports stats for Prometheus
# Values are scraped by ./jvb-podmonitor.yml
- name: exporter
image: systemli/prometheus-jitsi-meet-exporter:1.2.0
image: systemli/prometheus-jitsi-meet-exporter:1.2.1
imagePullPolicy: IfNotPresent
livenessProbe:
failureThreshold: 5
Expand Down
2 changes: 1 addition & 1 deletion k8s/base/jvb-hpa.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: autoscaling/v2beta2
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: jvb-hpa
Expand Down
31 changes: 28 additions & 3 deletions terraform/prometheus.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ resource "helm_release" "kube-prometheus-stack" {
}

# Add Jitsi-Meet dashboards to Grafana
# Dashboards are fetched from https://github.com/systemli/prometheus-jitsi-meet-exporter/tree/1.2.0/dashboards
# Dashboards are fetched from https://github.com/systemli/prometheus-jitsi-meet-exporter/tree/1.2.1/dashboards
# Values are merged with https://github.com/grafana/helm-charts/blob/main/charts/grafana/values.yaml
set {
name = "grafana.dashboardProviders.dashboardproviders\\.yaml.apiVersion"
Expand All @@ -53,7 +53,7 @@ resource "helm_release" "kube-prometheus-stack" {

set {
name = "grafana.dashboards.jitsi.jitsi-meet.url"
value = "https://raw.githubusercontent.com/systemli/prometheus-jitsi-meet-exporter/1.2.0/dashboards/jitsi-meet.json"
value = "https://raw.githubusercontent.com/systemli/prometheus-jitsi-meet-exporter/1.2.1/dashboards/jitsi-meet.json"
}

set {
Expand All @@ -63,7 +63,32 @@ resource "helm_release" "kube-prometheus-stack" {

set {
name = "grafana.dashboards.jitsi.jitsi-meet-system.url"
value = "https://raw.githubusercontent.com/systemli/prometheus-jitsi-meet-exporter/1.2.0/dashboards/jitsi-meet-system.json"
value = "https://raw.githubusercontent.com/systemli/prometheus-jitsi-meet-exporter/1.2.1/dashboards/jitsi-meet-system.json"
}

set {
name = "grafana.ingress.enabled"
value = lookup(var.k8s_grafana_ingress_enabled, terraform.workspace, false)
}

set {
name = "grafana.ingress.ingressClassName"
value = "nginx"
}

set {
name = "grafana.ingress.hosts[0]"
value = lookup(var.k8s_grafana_ingress_host, terraform.workspace, "monitoring.example.com")
}

set {
name = "grafana.ingress.annotations.cert-manager\\.io/issuer"
value = "letsencrypt-jitsi-issuer"
}

set_sensitive {
name = "grafana.adminPassword"
value = lookup(var.k8s_grafana_admin_passord, terraform.workspace, "ThisIsNotASecurePassword")
}

set {
Expand Down
26 changes: 26 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,30 @@ variable "k8s_ingress_nginx_version" {
default = {
preprod = "3.39.0"
}
}

variable "k8s_grafana_ingress_enabled" {
type = map(bool)
description = "enable ingress for grafana UI"

default = {
}
}

variable "k8s_grafana_ingress_host" {
type = map(string)
description = "host to reach grafana admin"

default = {
preprod="grafana.preprod.exemple.com"
}
}

variable "k8s_grafana_admin_passord" {
type = map(string)
description = "grafana admin password"

default = {
preprod="this is an invalid password"
}
}

0 comments on commit 6f110c0

Please sign in to comment.