Grafana 를 helm chart 를 사용하여 설치하면 편리하게 배포할 수 있다

 


 

helm chart 를 사용하여 Grafana 설치를 진행 하겠습니다.

 

1. Grafana 를 설치/사용할 namespace 를 먼저 생성

    → monitoring 이아닌 다른 namespace 도 사용 가능하다 default 로 monitoring 을 주로 사용

kubectl create ns monitoring

 

 

2. Grafana 를 다운받아올 helm repo를 추가 

    → Grafana 공식 github를 사용 

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

 

 

3. 추가한 repo 의 chart 를 다운로드 

helm pull grafana https://grafana.github.io/helm-charts

 

 

4. 다운로드된 chart 압축해제

tar -xvf grafana-6.60.1.tgz

 

 

 

5. grafana 폴더 안의 value.yaml 파일 수정

######## 접속을 위한 nodeport 로 변경
 185 service:
 186   enabled: true
 187   type: NodePort
 188   port: 8080
 189   targetPort: 3000
 190     # targetPort: 4181 To be used with a proxy extraContainer
 191   ## Service annotations. Can be templated.
 192   annotations: {}
 193   labels: {}
 194   portName: service
 195   # Adds the appProtocol field to the service. This allows to work with istio protocol selection. Ex: "http" or "tcp"
 196   appProtocol: ""
 197

######### admin 계정 설정 부분
 387 # Administrator credentials when not using an existing secret (see below)
 388 adminUser: admin
 389 adminPassword: admin

########## persistence 부분인데 지속적으로 grafana 를 사용할 거라면 pvc 를 사용으로 변경
 325 persistence:
 326   type: pvc
 327   enabled: false
 328   storageClassName: default
 329   accessModes:
 330     - ReadWriteOnce
 331   size: 10Gi
 332   # annotations: {}
 333   finalizers:
 334     - kubernetes.io/pvc-protection

 

 

6. helm chart 배포 

helm install grafana -f values.yaml -n monitoring ./

 

 

 

7. Grafana 접속

    → 초기 ID : admin

    → 초기 PW : 아래 있는 코드블록 내용으로 확인

kubectl get secret --namespace monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
#접속주소 => 'NodeIP:Port'
#위 사진에 있는 ClusterIP는 Cluster 내부의 IP이기 때문에 local desktop 에서 접속시에는 사용불가
#따라서 Grafana 를 설치한 Cluster Node 의 IP 및 위 사진에 있는 Port 정보로 로그인 해야함
#ex) http://10.0.2.10:32583

 

※ 주의사항

위 Grafana 는 helm chart 를 사용해서 기본 설정으로 배포한 것으로 사용 목적에 맞게 세부사항을 수정할 수 있습니다.

대표적으로 설정할 부분은 아래와 같습니다.

 

1. PVC 사용으로 설정하여 Grafana 의 데이터 유지

2. RDS를 연동하여 사용 가능

3. SSL 설정 가능

4. NodePort 뿐아니라 LB 를 사용하여 운영 가능

kubectl get cm/grafana -n monitoring
# configmap 에서 여러 내용을 수정 할 수 있으며 자세한 내용은 grafana 공식 홈피에지에 상세하게 적혀 있습니다.

 

 

 

 

 

 

+ Recent posts