TIL/기타

[k8s, 모니터링] grafana 와 cost-analyzer 의 helm chart 가 app-of-apps 구성에서 오류를 일으키는 현상.

쓱쓱565 2024. 10. 15. 17:37

k8s, 모니터링] grafana 와 cost-exploer 의 helm chart 가 app-of-apps 구성에서 오류를 일으키는 현상.

환경

  • helm Version:"v3.12.3"
  • EKS 표준 설정 클러스터
  • monitoring-app 이라는 app에 prometheus, grafana 등의 helm chart를 통합 관리.
# chart.yaml
appVersion: "1.16.0"

dependencies:
- name: "loki"
  condition: loki.enabled
  repository: "https://grafana.github.io/helm-charts"
  version: "^2.9.0"
- name: "promtail"
  condition: promtail.enabled
  repository: "https://grafana.github.io/helm-charts"
  version: "^6.7.4"
- name: "grafana"
  condition: grafana.enabled
  version: "~7.0.0"
  repository:  "https://grafana.github.io/helm-charts"
- name: "prometheus"
  condition: prometheus.enabled
  version: "~25.0.0"
  repository:  "https://prometheus-community.github.io/helm-charts"
- name: "kube-prometheus-stack"
  condition: kube-prometheus-stack.enabled
  version: "~65.0.0"
  repository:  "https://prometheus-community.github.io/helm-charts"
- name: "cost-analyzer"
  condition: cost-analyzer.enabled
  version: "~2.4"
  repository:  "https://kubecost.github.io/cost-analyzer"
# values.yaml
loki: 
    foo: bar

prometheus: 
    foo: bar

grafana: 
    foo: bar

kube-prometheus-stack: 
    foo: bar

이상 현상

아래의 에러 문구를 표시. 각종 value 값을 바꾸더라도 계속 오류 발생.

Error: template: monitoring/charts/grafana/templates/tests/test.yaml:6:11: executing "monitoring/charts/grafana/templates/tests/test.yaml" at <include "grafana.fullname" .>: error calling include: template: monitoring/charts/cost-analyzer/templates/_helpers.tpl:870:14: executing "grafana.fullname" at <.Values.grafana.fullnameOverride>: nil pointer evaluating interface {}.fullnameOverride Use --debug flag to render out invalid YA

파악한 원인

cost-analyzer(kubecost의 헬름 차트 이름)의 global 설정에 prometheus, grafana 등의 값이 이미 존재함.
해당 값들과 기존 value 파일의 구성이 충돌함.

https://github.com/kubecost/cost-analyzer-helm-chart/blob/develop/cost-analyzer/values.yaml

해결 방법

  1. grafana와는 별도의 app에 cost-analyzer를 설치.
  2. 현재 grafana를 삭제하고 kube-prometheus-stack 내의 grafana 를 활용하기.