๐Ÿ‘ฝ ์ฟ ๋ฒ„๋„คํ‹ฐ์Šค ๋ชจ๋‹ˆํ„ฐ๋ง[ํ”„๋กœ๋ฉ”ํ…Œ์šฐ์Šค, ๊ทธ๋ผํŒŒ๋‚˜]

๊น€์„ฑ์ธยท2023๋…„ 10์›” 21์ผ
0

[DevOps] ๐ŸณDocker & Kubernetes

๋ชฉ๋ก ๋ณด๊ธฐ
48/62

1. ํ—ฌ๋ฆ„ ๋ ˆํฌ์ง€ํ† ๋ฆฌ ์ถ”๊ฐ€

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update

2. ๊ทธ๋ผํŒŒ๋‚˜์™€ ํ”„๋กœ๋ฉ”ํ…Œ์šฐ์Šค ๋ฐฐํฌ

mkdir grafana_prometheus
cd grafana_prometheus

ํ—ฌ๋ฆ„ ๋ฐฐํฌ๋ฅผ ์œ„ํ•œ values.yaml ์ž‘์„ฑํ•  ๋””๋ ‰ํ„ฐ๋ฆฌ ์ƒ์„ฑ
cat << EOF > values-prometheus.yaml

values-prometheus.yaml

server:
  enabled: true


  persistentVolume:
    enabled: true
    accessModes:
      - ReadWriteOnce
    mountPath: /data
    size: 100Gi
  replicaCount: 1

  retention: "15d" #ํ”„๋กœ๋ฉ”ํ…Œ์šฐ์Šค ๋ฐ์ดํ„ฐ ๋ณด์œ  ๊ธฐ๊ฐ„

cat << EOF > values-grafana.yaml

values-grafana.yaml

replicas: 1

service:
  type: LoadBalancer

persistence:
  type: pvc
  enabled: true
  # storageClassName: default
  accessModes:
    - ReadWriteOnce
  size: 10Gi
  # annotations: {}
  finalizers:
    - kubernetes.io/pvc-protection
adminUser: admin
adminPassword: test1234

3. ํ—ฌ๋ฆ„์ฐจํŠธ ๋ฐฐํฌ(ํ”„๋กœ๋ฉ”ํ…Œ์šฐ์Šค, ๊ทธ๋ผํŒŒ๋‚˜)

kubectl create ns prometheus
helm install prometheus prometheus-community/prometheus -f values-prometheus.yaml -n prometheus
helm install grafana grafana/grafana -f values-grafana.yaml -n prometheus

4. ๊ทธ๋ผํŒŒ๋‚˜ ์ ‘์†

์•ž์„œ ์„ค์ •ํ–ˆ๋˜ admin ๋กœ๊ทธ์ธ ์ •๋ณด๋กœ ๋กœ๊ทธ์ธํ•˜๊ธฐ

5. ํ”„๋กœ๋ฉ”ํ…Œ์šฐ์Šค๋ฅผ Data Sources์— ๋“ฑ๋กํ•˜๊ธฐ

URL์— ClusterIP ์ด๋ฆ„์„ ๋„ฃ์œผ๋ฉด ๋จ. (prometheus-server) , ๋„ค์ž„์ŠคํŽ˜์ด์Šค๋‹ค๋ฅด๋ฉด ๋˜ ์„ค์ •ํ•ด์ค˜์•ผํ–„

6. ๋Œ€์‹œ๋ณด๋“œ import

https://grafana.com/grafana/dashboards/7550-kubernetes-cluster-monitoring-prometheus/

  • DashBoard -> New -> Import -> grafana์—์„œ ์ฐพ์€ ๋Œ€์‹œ๋ณด๋“œ ID ์ž…๋ ฅ

7. ๋Œ€์‹œ๋ณด๋“œ ํ™œ์šฉ

315๋ฒˆ ๋Œ€์‹œ๋ณด๋“œ

13770 ๋Œ€์‹œ๋ณด๋“œ

0๊ฐœ์˜ ๋Œ“๊ธ€