

 **이 페이지 개선에 도움 주기** 

이 사용자 가이드에 기여하려면 모든 페이지의 오른쪽 창에 있는 **GitHub에서 이 페이지 편집** 링크를 선택합니다.

# Helm을 사용하여 Prometheus 배포
<a name="deploy-prometheus"></a>

Amazon Managed Service for Prometheus를 사용하는 대신 헬름을 사용하여 Prometheus를 클러스터에 배포할 수 있습니다. 이미 Helm이 설치되어 있는 경우 `helm version` 명령을 사용하여 버전을 확인할 수 있습니다. Helm은 Kubernetes 클러스터를 위한 패키지 관리자입니다. Helm 및 Helm 설치 방법에 대한 자세한 내용은 [Amazon EKS에서 Helm을 사용하여 애플리케이션 배포](helm.md) 단원을 참조하십시오.

Amazon EKS 클러스터에 대해 Helm을 구성하면 이 Helm을 사용하여 다음 단계에 따라 Prometheus를 배포할 수 있습니다.

1. Prometheus 네임스페이스를 생성합니다.

   ```
   kubectl create namespace prometheus
   ```

1. `prometheus-community` 차트 리포지토리를 추가합니다

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

1. Prometheus를 배포합니다.

   ```
   helm upgrade -i prometheus prometheus-community/prometheus \
       --namespace prometheus \
       --set alertmanager.persistence.storageClass="gp2" \
       --set server.persistentVolume.storageClass="gp2"
   ```
**참고**  
이 명령을 실행할 때 `Error: failed to download "stable/prometheus" (hint: running helm repo update may help)` 오류가 발생하면 `helm repo update prometheus-community`를 실행한 다음 2단계 명령을 다시 실행해봅니다.

   `Error: rendered manifests contain a resource that already exists` 오류가 발생하면 `helm uninstall your-release-name -n namespace `를 실행한 다음 3단계 명령을 다시 실행해봅니다.

1. `prometheus` 네임스페이스의 모든 포드가 `READY` 상태인지 확인합니다.

   ```
   kubectl get pods -n prometheus
   ```

   예제 출력은 다음과 같습니다.

   ```
   NAME                                             READY   STATUS    RESTARTS   AGE
   prometheus-alertmanager-59b4c8c744-r7bgp         1/2     Running   0          48s
   prometheus-kube-state-metrics-7cfd87cf99-jkz2f   1/1     Running   0          48s
   prometheus-node-exporter-jcjqz                   1/1     Running   0          48s
   prometheus-node-exporter-jxv2h                   1/1     Running   0          48s
   prometheus-node-exporter-vbdks                   1/1     Running   0          48s
   prometheus-pushgateway-76c444b68c-82tnw          1/1     Running   0          48s
   prometheus-server-775957f748-mmht9               1/2     Running   0          48s
   ```

1. `kubectl`을 사용하여 포트를 통해 로컬 시스템에 Prometheus 콘솔을 전송합니다.

   ```
   kubectl --namespace=prometheus port-forward deploy/prometheus-server 9090
   ```

1. 웹 브라우저에서 `http://localhost:9090`으로 이동하여 Prometheus 콘솔을 봅니다.

1. **- 커서에 지표 삽입** 메뉴에서 지표를 선택한 후 **실행**을 선택합니다. **그래프** 탭을 선택하여 시간에 따른 지표를 표시합니다. 다음 이미지는 시간에 따른 `container_memory_usage_bytes`를 표시합니다.  
![\[Prometheus 지표\]](http://docs.aws.amazon.com/ko_kr/eks/latest/userguide/images/prometheus-metric.png)

1. 상단 탐색 모음에서 **상태**를 선택한 후 **대상**을 선택합니다.  
![\[Prometheus 콘솔\]](http://docs.aws.amazon.com/ko_kr/eks/latest/userguide/images/prometheus.png)

   서비스 검색을 사용하여 Prometheus에 연결된 모든 Kubernetes 엔드포인트가 표시됩니다.