Answer the question
In order to leave comments, you need to log in
Question on kubernetes and prometheus: setup?
Good afternoon.
I'm trying to run prometheus monitoring via kubernetes.
At the moment everything works through docker.
Here is the docker-compose file
version: "3.1"
services:
http:
container_name: "http_pr"
build:
context: "./"
dockerfile: "./docker/http.Dockerfile"
ports:
- "8085:8085"
# links:
# - "grpc:grpc"
environment:
PORT_HTTP: ":8085"
GRPC: "grpc:9000"
grpc:
container_name: "grpc"
build:
context: "./"
dockerfile: "./docker/grpc.Dockerfile"
ports:
- "9000:9000"
environment:
TCP_PORT: ":9000"
DB_TYPE: "inmemory"
prometheus:
image: prom/prometheus:latest
volumes:
- ./prometheus:/etc/prometheus/
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
ports:
- 9090:9090
depends_on:
- http
grafana:
image: grafana/grafana:latest
ports:
- 3000:3000
depends_on:
- prometheus
global:
scrape_interval: 15s # By default, scrape targets every 15 seconds.
evaluation_interval: 15s # By default, scrape targets every 15 seconds.
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
- job_name: myCounters
metrics_path: /posts/metrics
static_configs:
- targets:
- http:8085
apiVersion: apps/v1
kind: Deployment
metadata:
name: prometheus-deployment
labels:
app: prometheus
spec:
replicas: 1
selector:
matchLabels:
app: prometheus
template:
metadata:
labels:
app: prometheus
spec:
containers:
- name: prometheus
image: prom/prometheus
args:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
# volumeMounts:
# - name: config-volume
# mountPath: ./prometheus:/etc/prometheus/
ports:
- containerPort: 9090
# volumes:
# - name: config-volume
apiVersion: v1
kind: Service
metadata:
name: prometheus-service
spec:
selector:
app: prometheus
ports:
- protocol: TCP
port: 9090
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question