[Kubernetes] Install Grafana(v9.5.21) Using Helm Chart

Helm 설치 및 설명 참고 {: .prompt-info }

Install the Grafana Helm charts #

  • namespace 생성

    1kubectl create namespace [NAMESPACE NAME]
  • Grafana 배포

    1helm repo add grafana https://grafana.github.io/helm-charts
    2helm repo update
    3helm install grafana grafana/grafana --namespace [NAMESPACE NAME] --set adminPassword=<your_password>

    Grafana - Helm 설치 참고

  • Password 설정하지 않았을 때, 아래와 같이 찾아보기

    1kubectl get secret --namespace [NAMESPACE NAME] grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
  • port-forward로 연결하기

    1kubectl --namespace [NAMESPACE NAME] port-forward $POD_NAME 3000
    1kubectl port-forward svc/grafana 3000:80 -n [NAMESPACE NAME]

Customize Default Configuration #

Setting Admin #

1...✂...
2
3# Administrator credentials when not using an existing secret (see below)
4adminUser: admin
5adminPassword: <your_password>
6
7...✂...
 1...✂...
 2
 3persistence:
 4  type: pvc
 5  enabled: true
 6  # storageClassName: default
 7  accessModes:
 8    - ReadWriteOnce
 9  size: 10Gi
10  # annotations: {}
11  finalizers:
12    - kubernetes.io/pvc-protection
13  # selectorLabels: {}
14  ## Sub-directory of the PV to mount. Can be templated.
15  # subPath: ""
16  ## Name of an existing PVC. Can be templated.
17  # existingClaim:
18  ## Extra labels to apply to a PVC.
19  extraPvcLabels: {}
20
21...✂...

외부 접속을 위한 NodePort 설정 #

 1...✂...
 2
 3## Expose the grafana service to be accessed from outside the cluster (LoadBalancer service).
 4## or access it from within the cluster (ClusterIP service). Set the service type and the port to serve it.
 5## ref: http://kubernetes.io/docs/user-guide/services/
 6##
 7service:
 8  enabled: true
 9  type: NodePort
10  loadBalancerIP: ""
11  loadBalancerClass: ""
12  loadBalancerSourceRanges: []
13  port: 80
14  targetPort: 3000
15    # targetPort: 4181 To be used with a proxy extraContainer
16  ## Service annotations. Can be templated.
17  annotations: {}
18  labels: {}
19  portName: service
20  # Adds the appProtocol field to the service. This allows to work with istio protocol selection. Ex: "http" or "tcp"
21  appProtocol: ""
22
23...✂...

Install Customize Default Configuration #

1helm install [RELEASE NAME] [Chart.yaml 경로] -f [YAML 파일 또는 URL에 값 지정 (여러 개를 지정가능)] -n [NAMESPACE NAME]
1helm install grafana grafana/grafana -f override-values.yaml -n [NAMESPACE NAME]

Uninstall the Chart #

1helm uninstall [RELEASE NAME] -n [NAMESPACE NAME]
Advertisement