loki/prom-stack values

This commit is contained in:
Dominik Chilla 2022-10-02 19:54:36 +00:00
parent c3c303cf1d
commit 31db753d1a

View File

@ -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 <a name="user-content-prometheus-grafana"></a>
# Cluster monitoring <a name="user-content-cluster-monitoring"></a>
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 <a name="user-content-loki-stack"></a>
## Log correlation with Loki-stack <a name="user-content-loki-stack"></a>
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 <a name="user-content-prometheus-grafana"></a>
```
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 <a name="user-content-helm"></a>
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 <a name="user-content-helm-create"></a>
`helm create helm-test`