-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grafana initializes dashboard provider before sidecar has completed parsing all dashboard ConfigMaps #527
Comments
Could this be a timing issue between Grafana container and the side car container? ie. Grafana initializes the dashboard provider before the sidecar container has finished the parsing of all the ConfigMaps? Logs of the
Logs of the
When the Grafana pod is in running status. Shelling into the
|
I have exactly the same issue using kube-prometheus-stack v18.0.9 which is using grafana/grafana:8.1.2 I found this thread on Grafana support that let me think that the General folder config is overriding the config of the configured folder. It got weirder as I also tried to switch to
@tringuyen-yw Did you find a workaround to configure dashboards' folders automatically ? 😃 EDIT : By searching a bit more, I found that if you override the sidecar config with this :
It creates the rights Grafana folders and places correctly the dashboard in the right folder and you don't need the |
@ChuckNoxis Sorry for taking so long to answer. @jwausle Chuck gave the correct solution. Here is a more complete solution with comment grafana:
# Sidecars that collect the ConfigMaps with specified label and stores the included files them into the respective folders
sidecar:
dashboards:
enabled: true
# label key that the ConfigMaps containing dashboards should have to be collected by the sidecar
# The value is unused, the ConfigMap could be labelled as:
# label:
# grafana_dashboard: "1"
label: grafana_dashboard
# specific kube-prometheus-stack
# when dashboards.annotations.grafana_folder is UNDEFINED: all the dashboards will be created in Grafana "General" directory
# by default the built-in dashboards for kube-prometheus-stack are designed for kube-state-metrics
# it is more elegant to place those dashboards in a properly named Grafana dashboard folder
# the annotation below will be added to each dashboard ConfigMap created by kube-prometheus-stack helm chart
annotations:
grafana_folder: "KUBE-STATE-METRICS"
# folder in the Grafana container where the collected dashboards are stored (unless `defaultFolderName` is set)
folder: /tmp/dashboards
# "grafana_folder" is the annotation key which must be set in the ConfigMap defining the dashboards.
# In the example below the CM has annotations.grafana_folder: "KAFKA"
# which means all the dashboards defined in the CM would be stored
# - in /tmp/dashboards/KAFKA on the Filesystem of the Grafana container
# "/tmp/dashboards" is defined in grafana.sidecar.dashboards.folder
# "KAFKA" is the custom folder defined in the ConfigMap along with dashboard definitions
# - the dashboards are visible in the Grafana UI under the "KAFKA" dashboard folder
#
# apiVersion: v1
# kind: ConfigMap
# metadata:
# name: ...
# namespace: ...
# labels:
# app: ...
# grafana_dashboard: "1"
# annotations:
# grafana_folder: "KAFKA"
# data:
# dashboard1.json:
# json code of dashboard1
# dashboard2.json:
# json code of dashboard2
folderAnnotation: grafana_folder
provider:
# allow updating provisioned dashboards from the UI
allowUiUpdates: true
# MANDATORY when grafana.sidecar.dashboards.folderAnnotation is defined
# 'true' = allow Grafana to replicate dashboard structure from filesystem, ie
# - create a subdir in the File system and store the *.json files of the dashboards
# the json code and the subdir name are defined in the ConfigMap of the dashboards
# see example in comment section of grafana.sidecar.dashboards.folderAnnotation
# AND
# - In Grafana UI, place the dashboards defined in the ConfigMap (CM)
# in a dashboard folder with a name specified in the CM annotation `grafana_folder: ???`
foldersFromFilesStructure: true
# valid TZ values: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
defaultDashboardsTimezone: 'America/Toronto' # default = utc Example of ConfigMap defining Dahsboards where you want to place in a Grafana folder named apiVersion: v1
kind: ConfigMap
metadata:
name: cm-my-dashboards
# if different namespace than kube-prometheus-stack
# must set value `searchNamespace` https://github.com/grafana/helm-charts/blob/main/charts/grafana/values.yaml#L637
#namespace: <where the kube-prometheus-stack helm release is installed>
labels:
# grafana will pick up automatically all the configmaps that are labeled "grafana_dashboard: 1"
# the label key `grafana_dashboard` is configured in https://github.com/grafana/helm-charts/blob/main/charts/grafana/values.yaml#L627
# overridable in https://github.com/prometheus-community/helm-charts/blob/main/charts/kube-prometheus-stack/values.yaml#L666
grafana_dashboard: "1"
annotations:
# the dashboards in this ConfigMap will be placed in the Grafana UI, dashboard folder
# named as the value of the `grafana_folder` key below
# REQUIRE the Grafana helm value to be exactly 'grafana.sidecar.dashboards.folderAnnotation: grafana_folder'
grafana_folder: "MY-DASHBOARD-FOLDER"
data:
MyCustom_Dashboards.json: |-
{
blabla
} In conclusion, I think the solution is satisfactory, technicallky there is no issue with Grafana. If there is an issue worth mentioning, this would rather the Grafana config is insufficiently documented. If Grafafa helm chart maintainers think that the additional comments I added in this answer are worth to be mentioned in the Grafava default helm values. I'll make a Pull Request. |
Thanks Man , it worked for me ,,,, |
I am not quite sure whether this is actually an issue, but: Following the configuration explained by @tringuyen-yw the sidecar container shows frequent log entries like these (issued roughly every minute):
|
Worked for me, thank you! @tringuyen-yw The only place I found an explanation this good. |
@tringuyen-yw Appreciate it! It's effective for me, and your explanation is the most clear I've ever come across. |
I have the same issue. Were you able to find what configuration causes this? I also see the pod restarts often and additional to the logs you posted, I also see: |
@AnushaRaoCosnova Changing the log level in the sidecar container or increasing the Change log level:
Increasing the
|
Thank you @tringuyen-yw! Your explanation is really helpful for me to understand my issue and your solution really worked for me as well. |
Using kube-prometheus-stack heml chart v16.12.0 which has a dependency on Grafana helm chart v6.13.5.
Maybe I should file this issue in https://github.com/prometheus-community/helm-charts. I hope this is OK to file it here as I think it pertains to Grafana helm chart.
I would like to import some dashboards in a specific Grafana folder named
KAFKA
.I have customize the helm value in
my-helm-values.yaml
:Then create a ConfigMap containing the dashboards. The configmap is created in the same namespace as the Grafana helm chart
Install the
/kube-prometheus-stack
helm chart with Grafana's custom valuesGrafana UI shows the
KAFKA
folder as specified indashboardProviders
but it is empty. All theJson
dashboards in the ConfigMaps are imported but located in theGeneral
folder.I think the reason for Grafana to fail to provison the custom dashboards is b/c the custom dashboard provider
strimzi
was not ready. See the comment below for more diagnostics details.The text was updated successfully, but these errors were encountered: