Documentation Index
Fetch the complete documentation index at: https://docs.ahmadraza.in/llms.txt
Use this file to discover all available pages before exploring further.
Prometheus and Loki Configuration and Deployment Using Docker
Prometheus Configuration (prometheus.yml)
Configuration File
Create the Prometheus configuration fileprometheus.yml as shown below:
- Prometheus scrapes metrics from itself (
localhost:9090), Loki (loki:3100), Kubernetes pods, and nodes. - Kubernetes service discovery is used for pods and nodes, with relabeling to map labels to the appropriate metrics.
Docker Compose Deployment for Prometheus, Loki, and Grafana
docker-compose.yml
Use the following docker-compose.yml file to deploy Prometheus, Loki, and Grafana as Docker services:
Explanation of the Services:
-
Prometheus:
- Uses the
prom/prometheus:v2.41.0Docker image. - Configures Prometheus to use the custom
prometheus.ymlconfiguration file. - Enables the
remote-write-receiverto accept metrics sent from external sources (e.g., EKS or KIND).
- Uses the
-
Loki:
- Uses the
grafana/loki:2.7.0Docker image. - Exposes Loki on port
3100. - Mounts a custom
loki-config.ymlconfiguration file.
- Uses the
-
Grafana:
- Uses the
grafana/grafana:latestDocker image. - Sets the default admin password for Grafana (
GF_SECURITY_ADMIN_PASSWORD=admin). - Exposes Grafana on port
3000. - Depends on the Prometheus and Loki services to be up and running.
- Persists Grafana data using a Docker volume (
grafana-storage).
- Uses the
Networks and Volumes:
- The services are all connected to the
monitoringnetwork, created with thebridgedriver. - Grafana’s data is persisted with a Docker volume (
grafana-storage).
This setup will deploy Prometheus, Loki, and Grafana using Docker Compose, providing centralized logging and monitoring services with external integration support.
