728x90
Prometheus 이미지 빌드
https://prometheus.io/docs/prometheus/latest/configuration/configuration/
Dockerfile
FROM prom/prometheus:v2.19.0
ADD prometheus.yml /etc/prometheus/prometheus.yml
prometheus.yml
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9090']
- job_name: 'keycloak'
metrics_path: '/auth/realms/master/metrics'
scheme: 'https'
static_configs:
- targets: ['sso.multi.com']
- job_name: 'kubernetes-replicas-keycloak'
metrics_path: '/auth/realms/master/metrics'
kubernetes_sd_configs:
- api_server: '{serverIP}.com'
role: pod
tls_config:
insecure_skip_verify: true
relabel_configs:
# - action: labelmap
# regex: __meta_kubernetes_node_label_(.+)
- source_labels: [__meta_kubernetes_namespace]
action: keep
regex: default
- source_labels: [__meta_kubernetes_pod_name]
target_label: pod
action: keep
regex: replicas-test-keycloak(.*)
prometheus 실행
deployments.yaml
# kubectl create -f deployments.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: prometheus-test
namespace: default
labels:
app: prometheus-test
spec:
replicas: 1
selector:
matchLabels:
app: prometheus-test
template:
metadata:
labels:
app: prometheus-test
spec:
containers:
- name: prometheus-test
image: jonghunparksk/prometheus-v2_19_0-dt:0.0.1
imagePullPolicy: Always
prometheus 관리(확인)용 Service 생성
# kubectl create -f service.yaml
apiVersion: v1
kind: Service
metadata:
name: prometheus-test
labels:
app: prometheus-test
spec:
ports:
- name: http
port: 9090
targetPort: 9090
selector:
app: prometheus-test
type: LoadBalancer
728x90
'클라우드 > prometheus' 카테고리의 다른 글
prometheus 사용가이드 (0) | 2021.10.03 |
---|---|
prometheus - InfluxDB 설치( 설치 파일 사용 ) (0) | 2021.10.02 |
Remote Storage 설정하기 (0) | 2021.10.01 |
prometheus - gitlab metrics 설정하기 (0) | 2021.09.30 |
prometheus - keycloak Metrics 설정하기 (0) | 2021.09.29 |
댓글