chore: improve notes about prometheus and grafana

This commit is contained in:
Michele Cereda
2024-06-06 00:12:56 +02:00
parent ef227d759b
commit 5cfaa9476c
9 changed files with 359 additions and 208 deletions

View File

@@ -1,78 +0,0 @@
# Grafana on Kubernetes using Helm
## Table of contents <!-- omit in toc -->
1. [Usage](#usage)
1. [Gotchas](#gotchas)
1. [Further readings](#further-readings)
## Usage
Installation:
1. add the repository:
```sh
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
```
1. install the release:
```sh
helm upgrade --install --namespace monitoring --create-namespace grafana grafana/grafana
```
Get the admin user's password:
```sh
kubectl get secret --namespace monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
```
The Grafana server can be accessed via port 80 on `grafana.monitoring.svc.cluster.local` from within the cluster.<br/>
To get the external URL:
```sh
export POD_NAME=$(kubectl get pods --namespace monitoring -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=grafana" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace monitoring port-forward "${POD_NAME}" 3000
```
Clean up:
```sh
helm delete --namespace monitoring grafana
kubectl delete namespace --ignore-not-found monitoring
```
Access a Prometheus instance in the same namespace using `http://prometheus-server`
Get the default values from the updated chart
```sh
helm inspect values grafana/grafana > "$(git rev-parse --show-toplevel)/kubernetes/helm/grafana/values.yaml"
```
## Gotchas
Useful dashboards:
- `3662`: prometheus 2.0 overview
- `6417`: kubernetes cluster (prometheus)
- `9632`: nextcloud
## Further readings
- Official [helm chart]
- [Set up prometheus and ingress on kubernetes]
- [How to integrate Prometheus and Grafana on Kubernetes using Helm]
<!--
References
-->
<!-- Upstream -->
[helm chart]: https://github.com/grafana/helm-charts/tree/main/charts/grafana
<!-- Others -->
[how to integrate prometheus and grafana on kubernetes using helm]: https://semaphoreci.com/blog/prometheus-grafana-kubernetes-helm
[set up prometheus and ingress on kubernetes]: https://blog.gojekengineering.com/diy-how-to-set-up-prometheus-and-ingress-on-kubernetes-d395248e2ba

View File

@@ -1,72 +0,0 @@
# Prometheus on Kubernetes using Helm
## Table of contents <!-- omit in toc -->
1. [Usage](#usage)
1. [Further readings](#further-readings)
1. [Sources](#sources)
## Usage
Installation:
```sh
helm repo add \
'prometheus-community' 'https://prometheus-community.github.io/helm-charts'
helm upgrade --install \
--namespace 'monitoring' --create-namespace \
'prometheus' 'prometheus-community/prometheus'
```
The server can be accessed via port 80 on `prometheus-server.monitoring.svc.cluster.local` from within the cluster.
Get the server URL:
```sh
export POD_NAME=$(kubectl get pods --namespace monitoring -l "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace monitoring port-forward $POD_NAME 9090
```
Alertmanager can be accessed via port 80 on `prometheus-alertmanager.monitoring.svc.cluster.local` from within the cluster
Get Alertmanager's URL:
```sh
export POD_NAME=$(kubectl get pods --namespace monitoring -l "app=prometheus,component=alertmanager" -o jsonpath="{.items[0].metadata.name}")
kubectl --namespace monitoring port-forward $POD_NAME 9093
```
PushGateway can be accessed via port 9091 on `prometheus-pushgateway.monitoring.svc.cluster.local` from within the cluster
Get PushGateway's URL:
```sh
export POD_NAME=$(kubectl get pods --namespace monitoring -l "app=prometheus,component=pushgateway" -o jsonpath="{.items[0].metadata.name}")
```
## Further readings
- [Helm chart]
## Sources
All the references in the [further readings] section, plus the following:
- [Install Prometheus and Grafana with helm 3 on a local machine VM]
- [Set up prometheus and ingress on kubernetes]
- [How to integrate Prometheus and Grafana on Kubernetes using Helm]
<!--
References
-->
<!-- Upstream -->
[helm chart]: https://github.com/prometheus-community/helm-charts/tree/main/charts/prometheus
<!-- In-article sections -->
[further readings]: #further-readings
<!-- Others -->
[how to integrate prometheus and grafana on kubernetes using helm]: https://semaphoreci.com/blog/prometheus-grafana-kubernetes-helm
[install prometheus and grafana with helm 3 on a local machine vm]: https://dev.to/ko_kamlesh/install-prometheus-grafana-with-helm-3-on-local-machine-vm-1kgj
[set up prometheus and ingress on kubernetes]: https://blog.gojekengineering.com/diy-how-to-set-up-prometheus-and-ingress-on-kubernetes-d395248e2ba

View File

@@ -2,7 +2,7 @@
##
# Source:
# `helm template --namespace 'gitlab' 'gitlab-runner' 'gitlab/gitlab-runner'`
# `helm show values --repo 'https://charts.gitlab.io' 'gitlab-runner'`
##
useTini: false

View File

@@ -0,0 +1,6 @@
---
##
# Source:
# `helm show values --repo 'https://prometheus-community.github.io/helm-charts' 'prometheus'`
##