1

In some project there are scaling and orchestration implemented using technologies of a local cloud provider, with no Docker & Kubernetes. But the project has poor logging and monitoring, I'd like to instal Prometheus, Loki, and Grafana for metrics, logs, and visualisation respectively. Unfortunately, I've found no articles with instructions about using Prometheus without K8s.

But is it possible? If so, is it a good was? I know that Prometheus & Loki can automatically detect services in the K8s to extract metrics and logs, but will the same work for a custom orchestration system?

2 Answers 2

1

I've found out that it is a possible and fine approach. Prometheus support different methods of service discovery, this is explained in the docs: Configuration. As I understood the Loki way of work, it just uses Promtail which sends logs from services, so there is no need of service discovery. An example of Promtail installation is here. Also, more details can be found in the doc: Promtail install.

0

Yes--absolutely you can skip Kubernetes. Suggest that you still use Docker, but you could even just install the components separately.

I think it's easiest using Docker Compose (need to have package docker-compose installed on your host) to manage the containers.

Here is a docker-compose.yml that might be helpful:

version: '3'

services:
    prometheus:
        image: prom/prometheus:latest
        restart: unless-stopped
        ports:
            - "9090:9090"
        volumes:
            - /home/${USER}/opt/prometheus/data:/opt/prometheus/data:rw
            - /home/${USER}/opt/prometheus/config:/opt/prometheus/config:rw
        environment:
            SERVER_KEY: ${SERVER_KEY}
            SERVER_CERT: ${SERVER_CERT}

    grafana:
        image: grafana/grafana:latest
        restart: unless-stopped
        ports:
            - "3000:3000"
        volumes:
            - /home/${USER}/var/lib/grafana:/var/lib/grafana:rw
            - /home/${USER}/var/log/grafana:/var/log/grafana:rw
            - /home/${USER}/etc/grafana/grafana.ini:/etc/grafana/grafana.ini:rw
            - /home/${USER}/etc/grafana/ldap.toml:/etc/grafana/ldap.toml:rw
        environment:
            SERVER_KEY: ${SERVER_KEY}
            SERVER_CERT: ${SERVER_CERT}
            GF_SECURITY_ADMIN_USER: ${GF_SECURITY_ADMIN_USER}
            GF_SECURITY_ADMIN_PASSWORD: ${GF_SECURITY_ADMIN_PASSWORD}
        depends_on:
            - "prometheus"

Can also use Docker Compose for Loki and Promtail.

Docker Compose reference: https://docs.docker.com/compose/compose-file

1
  • Yeah, it's obvious that it's possible to install the apps, cuz they are installed in K8s in some way... But the question was about service discovery outside of Kubernetes – will this work correctly, in the right way?
    – AivanF.
    Sep 25, 2020 at 21:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.