60.Cloud/80.Kubernetes
kube-prometheus-stack dashboard configmap으로 추가하기
왕영주
2021. 2. 24. 17:47
Helm Value에 아래와같이 sidecar를 enable 해주고 label을 configmap에 담으면 dashboard가 추가된다.
configmap이 계속 반영이 안돼서 SC를 disable후 다시 enable해서 조치했습니다.
이후 configmap 추가 및 삭제 시 자동으로 감지하여 반영됩니다.
sidecar:
dashboards:
enabled: true
label: grafana_dashboard
-
root@yjwang0-k8s-01:~# head -n30 dashboard2.yaml
### https://github.com/grafana/helm-charts/blob/main/charts/grafana/README.md
apiVersion: v1
kind: ConfigMap
metadata:
name: test2-configmap
labels:
grafana_dashboard: "1"
data:
test2dashboard.json: |-
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
...
-
아래와 같이 grafana-sc-dashboard (sidecar) 컨테이너가 pod내에 생성되며 자동으로 configmap에서 생성되고 삭제됨
root@yjwang0-k8s-01:~# kubectl logs prom-stack-grafana-6b59d47799-xsqg4 grafana-sc-dashboard |grep test2dashb
[2021-02-24 08:40:42] File in configmap test2dashboard.json ADDED
[2021-02-24 08:47:01] File in configmap test2dashboard.json DELETED
[2021-02-24 08:48:36] File in configmap test2dashboard.json ADDED
반응형