To easily install Prometheus and Grafana to have observability in a cluster this repository comes with helm charts.
First create monitoring namespace and switch into the namespace.
kubectl apply -f namespace.yaml
kubens monitoringhelm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
helm repo updatehelm install prometheus prometheus-community/prometheus \
--set alertmanager.enabled=false \
--set configmapReload.alertmanager.enabled=false \
--set server.ingress.enabled=false \
--set "server.persistentVolume.accessModes={ReadWriteOnce}" \
--set server.persistentVolume.size=512Gi \
--set server.persistentVolume.storageClass=azurefile-premium-retain \
--set pushgateway.enabled=false --namespace monitoring \
--set server.resources.limits.memory=4096Mi \
--set server.resources.requests.memory=4096MiWe do not expose raw Prometheus to the outside, but the UI is available by using port forwarding.
kubectl port-forward service/prometheus-server 9090:httpFirst time login "admin:admin" please log in and changes this at once the installation has completed.
helm upgrade --install grafana grafana --namespace monitoring --set ingress.domain=<DOMAIN>If the ingress controller don't have the prometheus annotations... patch it.
kubectl patch pod ingress-nginx-ingress-controller --patch "$(cat ingress-patch.yaml)"