From 31db753d1a05312912ee4468ffc4a89d62f4f453 Mon Sep 17 00:00:00 2001 From: Dominik Chilla Date: Sun, 2 Oct 2022 19:54:36 +0000 Subject: [PATCH] loki/prom-stack values --- README.md | 70 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index b8dc8f7..2fa0d2b 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,9 @@ * [Deploying a LE-certificate with ingress](#cert-manager-ingress) * [Deploying a LE-certificate by CRD](#cert-manager-crd) * [Troubleshooting](#cert-manager-troubleshooting) -* [Cluster monitoring with Prometheus/Grafana](#prometheus-grafana) -* [Log correlation with Loki-stack/Grafana](#loki-stack) +* [Cluster monitoring](#cluster-monitoring) + * [Log correlation with Loki-stack](#loki-stack) + * [Metrics with Prometheus-stack + Grafana](#prometheus-grafana) * [HELM charts](#helm) * [Create a chart](#helm-create) * [Install local chart without packaging](#helm-install-without-packaging) @@ -559,43 +560,62 @@ After successfull setup perform a TLS-test: * https://testssl.sh/ (`apt install testssl.sh`) * https://www.ssllabs.com/ssltest/index.html -# Cluster monitoring with Prometheus/Grafana +# Cluster monitoring +Create namespace for monitoring ``` -helm repo add prometheus-community https://prometheus-community.github.io/helm-charts -helm repo update -kubectl create ns prom-stack - -# download values file for prometheus helm chart and replace any occurence of %MASTER_NODE_IPV4_ADDR% with IPv4 address of your cluster master node -wget https://gitea.zwackl.de/dominik/k3s/raw/branch/master/prometheus-values.yaml - -helm install --namespace prom-stack -f prometheus-values.yaml prom-stack prometheus-community/kube-prometheus-stack - -# access web ui at http://localhost:8080 OR configure an ingress instance -kubectl -n prom port-forward service/prom-stack-grafana 8080:80 +kubectl create ns monitoring ``` -# Log correlation with Loki-stack/Grafana +## Log correlation with Loki-stack Docs: https://github.com/grafana/helm-charts/tree/main/charts/loki-stack ``` helm repo add grafana https://grafana.github.io/helm-charts helm repo update -kubectl create ns loki-stack -helm upgrade --install loki --namespace=loki-stack grafana/loki-stack --set grafana.enabled=true +``` +Download values file for loki-stack helm chart and replace any macros with corresponding values: +* %PVC_STORAGECLASS% -> your storageclass for persistent storage +* %PVC_STORAGE_SIZE% -> size of persistent storage, e.g. 4Gi +``` +wget https://gitea.zwackl.de/dominik/k3s/raw/branch/master/loki-stack-values.yaml +``` +Install loki-stack: +``` +helm -n monitoring upgrade --install -f loki-stack-values.yaml loki-stack grafana/loki-stack +``` +Grafana will be installed with Prometheus-stack... -# access web ui at http://localhost:8888 OR configure an ingress instance -kubectl get secret -n loki-stack loki-grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo -kubectl -n loki-stack port-forward service/loki-grafana 8888:80 +## Metrics with Prometheus-stack + Grafana +``` +helm repo add prometheus-community https://prometheus-community.github.io/helm-charts +helm repo update +``` +Download values file for prometheus-stack helm chart and replace any macros with corresponding values: +* %ADMIN_PASSWORD% -> Grafana admin password +* %SERVICE_FQDN% -> Service FQDN +* %MASTER_NODE_IPV4_ADDR% -> IPv4 address of your cluster master node +* %PVC_STORAGECLASS% -> your storageclass for persistent storage +* %PVC_STORAGE_SIZE% -> size of persistent storage, e.g. 4Gi +* %SMTP_HOST% +* %SMTP_USER% +* %SMTP_PASSWORD% +* %SMTP_SENDER_ADDRESS% +* %SMTP_FROM_HEADER% +``` +wget https://gitea.zwackl.de/dominik/k3s/raw/branch/master/prom-stack-values.yaml +``` +Install promethous-stack: +``` +helm -n monitoring upgrade --install -f prom-stack-values.yaml prom-stack prometheus-community/kube-prometheus-stack +``` +Access grafana web ui via port-forwarding at http://localhost:8080 (or configure an ingress instance): +``` +kubectl -n monitoring port-forward service/prom-stack-grafana 8080:80 ``` # HELM charts Docs: * https://helm.sh/docs/intro/using_helm/ -Prerequisites: -* running kubernetes installation -* kubectl with ENV[KUBECONFIG] pointing to appropriate config file -* helm - ## Create a chart `helm create helm-test`