TroubleShooting

[쿠버네티스] helm으로 grafana 설치하기

하녕 2025. 7. 23. 15:05
반응형

service mesh 구성 중에 nas에 grafana 데이터를 배포하는 과정에 에러가 발생하여 기록합니다.

 

 

PV, PVC yaml 값

kind: PersistentVolume
apiVersion: v1
metadata:
  name: grafana-pv
spec:
  capacity:
    storage: 10Gi
  nfs:
    server: [nas address]
    path: [nas path]
  accessModes:
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Retain
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: grafana-pvc
  namespace: istio-system
spec:
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 10Gi
  volumeName: grafana-pv

 

PV 확인

 

PVC 확인

 

 

아래 URL로 들어가서 grafana repo를 찾습니다.

https://artifacthub.io/

 

Artifact Hub

Find, install and publish Cloud Native packages

artifacthub.io

 

 

친절히 repo 추가 방법을 알려줍니다.

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

helm search repo grafana # 필요한 차트를 찾기
helm pull grafana/grafana # 사용할 차트를 PULL

 

 

다운로드한 차트의 압축을 풀어줍니다.

 

 

생성한 PVC에 데이터를 집어넣어야 하기 때문에 values.yaml에서 416번째 줄에서 persistence 를 활성화 합니다.

이미 생성된 PVC를 사용하기 때문에 existingClaim에 pvc를 추가합니다.

persistence:
  type: pvc
  enabled: true
  # storageClassName: default
  ## (Optional) Use this to bind the claim to an existing PersistentVolume (PV) by name.
  volumeName: ""
  accessModes:
    - ReadWriteOnce
  size: 10Gi
  # annotations: {}
  finalizers:
    - kubernetes.io/pvc-protection
  # selectorLabels: {}
  ## Sub-directory of the PV to mount. Can be templated.
  # subPath: ""
  ## Name of an existing PVC. Can be templated.
  existingClaim: grafana-pvc
  ## Extra labels to apply to a PVC.
  extraPvcLabels: {}
  disableWarning: false

 

 

필요에 따라 values.yaml을 수정한 후에 배포합니다.

 

 

정상적으로 POD가 배포되지 않습니다.

 

 

로그를 확인했을 때, chown과 init-chown-data라는 init contaier에 대한 문제가 발생한 것을 확인 할 수 있습니다.

 

 

values.yaml에서 init container에 관련 된 내용을 찾아보면 아래와 같습니다.

# values.yaml의 452번째 줄
initChownData:
  ## If false, data ownership will not be reset at startup
  ## This allows the grafana-server to be run with an arbitrary user
  ##
  enabled: true

  ## initChownData container image
  ##
  image:
    # -- The Docker registry
    registry: docker.io
    repository: library/busybox
    tag: "1.31.1"
    sha: ""
    pullPolicy: IfNotPresent

  ## initChownData resource requests and limits
  ## Ref: http://kubernetes.io/docs/user-guide/compute-resources/
  ##
  resources: {}
  #  limits:
  #    cpu: 100m
  #    memory: 128Mi
  #  requests:
  #    cpu: 100m
  #    memory: 128Mi
  securityContext:
    readOnlyRootFilesystem: false
    runAsNonRoot: false
    runAsUser: 0
    seccompProfile:
      type: RuntimeDefault
    capabilities:
      add:
        - CHOWN
      drop:
        - ALL

 

mount 한 NAS의 스냅숏으로 인하여 chown이 정상적으로 작동하지 못하여 init container가 종료되어 서비스가 정상적으로 올라올수 없는 것을 확인 할 수 있습니다.
이는 CSP 마다 상이하기 때문에, 이와 같은 동일한 케이스가 발생하지 않고 정상적으로 프로비저닝이 될 수 있습니다.

 

따라서 init contaier를 비활성화 하고 수동으로 NAS의 디렉토리 영역을 472:472로 변경합시다.

UID 및 GID 변경

initChownData:
  ## If false, data ownership will not be reset at startup
  ## This allows the grafana-server to be run with an arbitrary user
  ##
  enabled: false

 

 

삭제 후 재설치를 진행합니다.

 

 

이후 ingress 구성 후 웹브라우저로 접근합니다.

반응형