Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ values.yaml
configMaps/*
!configMaps/*.json
.DS_Store
auth
70 changes: 20 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,46 @@
# Monitoring Nodes and Pods in Kubernetes with Ingress

# Monitoring Nodes/Pods in Kubernetes and Ingress

This repository contains scripts to install Prometheus, various exporters, and Grafana. The goal is to streamline the entire process—making it quick and easy to go from installation to viewing reports in Grafana about the OpenHistoricalMap infrastructure.
This repository contains scripts for installing **Prometheus**, various **exporters**, **Grafana** and **Loki**. The goal is to **simplify the monitoring setup**, making it quick and efficient to go from **installation to viewing detailed reports in Grafana** about the **OpenHistoricalMap** infrastructure.

## Authentication for Prometheus

Before installing Prometheus, create basic authentication credentials for the Prometheus endpoint:
Before installing **Prometheus**, set up **basic authentication credentials** for the Prometheus endpoint:

```sh
htpasswd -c auth prometheus-user
kubectl create secret generic prometheus-basic-auth --from-file=auth -n monitoring
```

After this step, you can proceed with Prometheus installation and configure the Ingress to use this basic authentication.
Once authentication is configured, you can proceed with Prometheus installation and configure Ingress to use these credentials.

## Install prometheus and Grafana
## Installing Prometheus and Grafana

This will install Prometheus, Grafana.
This setup will install Prometheus and Grafana for monitoring your Kubernetes cluster.

### Production Deployment

```sh
export ENVIROMENT=staging
#export ENVIROMENT=Production
export GRAFANA_ADMINPASSWORD=1234
export NODEGROUP_TYPE=web_large
export ENVIRONMENT=production
./deploy.sh create
## Delete apps
./deploy.sh delete
```

## Staging Deployment

## Install Dashboard

Import the file dashboard.json into Grafana.

Result:
https://prometheus.openhistoricalmap.org/

![image](https://github.com/user-attachments/assets/ca986706-5a56-4f2d-9f1c-148b602a053a)


```sh
export GRAFANA_ADMINPASSWORD=1234
export NODEGROUP_TYPE=web_large
export ENVIRONMENT=staging

## Adding Hetzner node exporter
./deploy.sh create
```


Hetzner server is going to be installed manually the exporter
### Deleting Applications

```sh
wget https://github.com/prometheus/node_exporter/releases/download/v1.6.1/node_exporter-1.6.1.linux-amd64.tar.gz
tar -xvzf node_exporter-1.6.1.linux-amd64.tar.gz
sudo cp node_exporter-1.6.1.linux-amd64/node_exporter /usr/local/bin/
sudo useradd --no-create-home --shell /bin/false node_exporter
sudo nano /etc/systemd/system/node_exporter.service
sudo systemctl daemon-reload
sudo systemctl start node_exporter
sudo systemctl enable node_exporter
sudo systemctl status node_exporter
```
- In monitoring namespace edit prometheus-server ConfigMap
To remove the deployed applications, execute:

```sh
kubectl edit cm prometheus-server -n monitoring
./deploy.sh delete
```


```sh
scrape_configs:
- job_name: node-exporter-external
scrape_interval: 1m
scrape_timeout: 10s
metrics_path: /metrics
scheme: http
static_configs:
- targets:
- "<HETZNER_IP>:9100"
....
```
Loading