Search
moon
sun

Thanos

Prometheus 기반의 확장 가능한 모니터링 시스템을 구축하기 위한 오픈소스 프로젝트이다.
주로 Prometheus의 장기 데이터 저장 및 글로벌 쿼리 기능을 강화하는 데 사용된다.

Thanos의 주요 기능

1.
확장성
•
Prometheus 인스턴스를 여러 개 운영할 경우, 데이터를 중앙에서 조회할 수 있도록 지원합니다.
•
여러 개의 Prometheus 서버를 사용하면서도 글로벌 View를 제공합니다.
2.
장기 스토리지 지원
•
Prometheus의 기본 보관 기간은 제한적이지만, Thanos는 데이터를 장기적으로 저장할 수 있도록 도와줍니다.
•
Amazon S3 등의 객체 스토리지를 지원합니다.
3.
고가용성 (High Availability, HA)
•
Prometheus 서버가 다운되거나 데이터가 손실되더라도, Thanos를 통해 데이터를 안전하게 저장하고 복구할 수 있습니다.
4.
글로벌 쿼리
•
여러 개의 Prometheus 인스턴스가 존재하더라도, 이를 하나의 데이터 소스로 통합하여 조회할 수 있습니다.
•
PromQL을 사용하여 중앙에서 데이터를 쉽게 분석할 수 있습니다.

Thanos의 주요 컴포넌트

1.
Thanos Sidecar
•
Prometheus와 함께 실행되며, Prometheus 데이터를 장기 스토리지에 업로드하고 Thanos Query에 데이터를 제공합니다.
2.
Thanos Store
•
객체 스토리지에 저장된 메트릭 데이터를 읽고 제공하는 역할을 합니다.
3.
Thanos Query
•
여러 개의 Prometheus 인스턴스와 Thanos Store의 데이터를 쿼리하여 글로벌 View를 제공합니다.
4.
Thanos Compact
•
장기 스토리지에 저장된 데이터를 압축하고 최적화하는 역할을 합니다.
5.
Thanos Ruler
•
Prometheus의 Alerting 및 Recording Rule을 장기 데이터 저장소에서도 사용할 수 있도록 지원합니다.
cat << EOF > objstore.yml type: s3 config: bucket: skills-thanos-bucket endpoint: s3.ap-northeast-2.amazonaws.com access_key: <ACCEESS_KEY> access_key: <SECRET_ACCESS_KEY> EOF
Shell
복사
kubectl create namespace monitoring
Shell
복사
kubectl create secret generic thanos-objstore -n monitoring --from-file=objstore.yml -o yaml --dry-run=client | kubectl apply -f -
Shell
복사
cat > prometheus.values.yaml << EOF prometheus: prometheusSpec: thanos: image: quay.io/thanos/thanos:v0.28.1 objectStorageConfig: name: thanos-objstore key: objstore.yml thanosService: enabled: true clusterIP: '' thanosServiceMonitor: enabled: true EOF
Shell
복사
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm repo update helm install kube-prometheus-stack prometheus-community/kube-prometheus-stack -n monitoring -f prometheus-values.yaml
Shell
복사
helm install thanos oci://registry-1.docker.io/bitnamicharts/thanos -n monitoring \ --set queryFrontend.service.type=LoadBalancer \ --set query.dnsDiscovery.sidecarsNamespace=monitoring \ --set query.dnsDiscovery.sidecarsService=kube-prometheus-stack-thanos-discovery \ --set query.dnsDiscovery.enabled=true \ --set query.enabled=true
Shell
복사
Thanos에 frontend에 접속하여 target을 확인하면 아래와 같이 적용되어 있다.