Azure Kubernetes Service(AKS)에서 Prometheus가 설치되어 있는지 확인하는 방법을 찾고 계신가요? 🔍
이번 글에서는 kubectl을 활용하여 Prometheus의 설치 여부 및 실행 상태를 확인하는 방법을 단계별로 안내해 드립니다.
1️⃣ Prometheus 네임스페이스 확인
Prometheus는 일반적으로 monitoring 네임스페이스에 설치됩니다. 따라서 해당 네임스페이스가 존재하는지 먼저 확인해야 합니다.
kubectl get ns
📌 위 명령어를 실행하면 현재 클러스터에 존재하는 네임스페이스 목록이 출력됩니다.
예제 출력:
NAME STATUS AGE
default Active 300d
kube-system Active 300d
monitoring Active 200d
✅ monitoring 네임스페이스가 있다면, Prometheus가 설치되었을 가능성이 높습니다.
❌ 만약 monitoring 네임스페이스가 없다면, Prometheus가 설치되지 않았거나, 다른 네임스페이스에 설치되었을 수 있습니다.
2️⃣ Prometheus 관련 리소스 확인
Prometheus가 실행 중인지 확인하려면, 설치된 Pod 및 서비스를 조회해 보세요.
🔹 Prometheus 관련 Pod 확인
kubectl get pods -n monitoring | grep prometheus
예제 출력:
prometheus-kube-prometheus-operator-7f4fddc57d-xyz12 1/1 Running 0 10d
prometheus-kube-prometheus-prometheus-0 2/2 Running 0 10d
prometheus-grafana-6b9dbf88d5-lmn34 1/1 Running 0 10d
✅ prometheus-kube-prometheus-prometheus 같은 Pod가 실행 중이라면, Prometheus가 정상적으로 동작하고 있는 것입니다.
🔹 Prometheus 서비스(Service) 확인
kubectl get svc -n monitoring | grep prometheus
예제 출력:
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)
prometheus-kube-prometheus-prometheus ClusterIP 10.0.151.32 <none> 9090/TCP
prometheus-grafana ClusterIP 10.0.170.95 <none> 80/TCP
✅ prometheus-kube-prometheus-prometheus 서비스가 있으면, Prometheus가 실행 중이라는 의미입니다.
3️⃣ Helm을 사용한 Prometheus 설치 여부 확인
AKS에서 Prometheus가 Helm을 통해 설치되었는지 확인하려면 다음 명령어를 실행하세요.
helm list -A | grep prometheus
예제 출력:
NAME NAMESPACE REVISION STATUS CHART APP VERSION
prometheus monitoring 1 deployed kube-prometheus-stack-41.7.3 0.66.0
✅ kube-prometheus-stack 같은 Helm 릴리스가 표시되면, Helm을 통해 Prometheus가 설치된 것입니다.
4️⃣ Prometheus Custom Resource Definition (CRD) 확인
Prometheus가 Operator 모드로 설치된 경우, Custom Resource Definition(CRD)을 확인할 수도 있습니다.
kubectl get crds | grep prometheus
예제 출력:
alertmanagers.monitoring.coreos.com
podmonitors.monitoring.coreos.com
prometheuses.monitoring.coreos.com
prometheusrules.monitoring.coreos.com
servicemonitors.monitoring.coreos.com
✅ 위 항목들이 존재하면, Prometheus Operator가 설치된 상태입니다.
5️⃣ Prometheus UI 접근 확인
Prometheus가 실행 중이라면, 웹 UI에 접근하여 상태를 확인할 수도 있습니다.
🔹 포트포워딩을 이용한 접속
kubectl port-forward -n monitoring svc/prometheus-kube-prometheus-prometheus 9090:9090
이제 웹 브라우저에서 http://localhost:9090에 접속하면 Prometheus UI를 확인할 수 있습니다.
🛠 결론: Prometheus 설치 여부를 빠르게 확인하는 명령어
아래 핵심 명령어 5개를 실행하면 AKS에서 Prometheus가 설치되었는지 즉시 확인할 수 있습니다.
# 1. Prometheus 네임스페이스 확인
kubectl get ns | grep monitoring
# 2. Prometheus 관련 Pod 확인
kubectl get pods -n monitoring | grep prometheus
# 3. Prometheus 서비스 확인
kubectl get svc -n monitoring | grep prometheus
# 4. Helm으로 Prometheus 설치 여부 확인
helm list -A | grep prometheus
# 5. Prometheus CRD 확인
kubectl get crds | grep prometheus
✅ 위 명령어들을 차례로 실행하면 AKS에서 Prometheus가 설치되었는지 확인할 수 있습니다.
🚀 이제 Kubernetes 클러스터에서 Prometheus가 정상적으로 실행 중인지 직접 점검해 보세요!