Is this a request for help?:
Is this a BUG REPORT or FEATURE REQUEST? (choose one):
Version of Helm and Kubernetes:
Helm:
Version{SemVer:"v2.10.0", GitCommit:"9ad53aac42165a5fadc6c87be0dea6b115f93090", GitTreeState:"clean"}
Kubernetes:
Server Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.7-gke.12", GitCommit:"06f08e60069231bd21bdf673cf0595aac80b99f6", GitTreeState:"clean", BuildDate:"2019-02-25T20:37:10Z", GoVersion:"go1.10.8b4", Compiler:"gc", Platform:"linux/amd64"}
Which chart:
[stable/grafana]
What happened:
I'm trying to setup grafana to load charts from dashboards folder in chart as per documentation. Created dashboard folder in my chart folder and put sample redis.json file there. In values.yaml configured following:
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: true
options:
path: /var/lib/grafana/dashboards/default
dashboards:
default:
redis:
file: dashboards/redis.json
prometheus-stats:
gnetId: 2
revision: 2
datasource: Prometheus
# local-dashboard:
# url: https://example.com/repository/test.json
# local-dashboard-base64:
# url: https://example.com/repository/test-b64.json
# b64content: true`
When I deploy grafana prometheus-stats dashboard is loaded, but redis one no. I see that chart created config map with following contents. Also in container file redis.json was copied to /var/lib/grafana/dashboards/default, but it is empty. Does it mean it was not able to parse json or something like that, as there is empty value?
If I run
helm install --dry-run --debug --name grafana --namespace monitoring -f values.yaml stable/grafana
there is no errors thrown.
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-dashboards-default
labels:
app: grafana
chart: grafana-3.0.1
release: grafana
heritage: Tiller
dashboard-provider: default
data:
redis.json:
""
What you expected to happen:
Expect dashboard to be imported
How to reproduce it (as minimally and precisely as possible):
Using helm install command and modifying values.yaml file with above values
helm install --name grafana --namespace monitoring -f values.yaml stable/grafana
Anything else we need to know:
There is a ` at the end of the default dashboards provider. Is this a typo?
There is a ` at the end of the default dashboards provider. Is this a typo?
Yep @maorfr sorry, this is from formatting here
It seems to work for me. I have the same dashboardProviders section. In addition, I have the following key set:
dashboardsConfigMaps:
default: "grafana-dashboard"
The value grafana-dashboard is the name of a ConfigMap in the same namespace. The content looks like this:
apiVersion: v1
data:
gain-dashboard.json: "cut out for brevity"
kind: ConfigMap
metadata:
creationTimestamp: "2019-04-01T08:14:07Z"
name: grafana-dashboard
namespace: monitoring
resourceVersion: "1039344"
selfLink: /api/v1/namespaces/monitoring/configmaps/grafana-dashboard
uid: 1ec73781-5456-11e9-bfc8-42010a9c00b0
After deploying, I can see the following on the grafana container:
$ kubectl -n monitoring exec -it grafana-68cddfcf4-kq9s5 ls /var/lib/grafana/dashboards/default
gain-dashboard.json
The content of gain-dashboard.json corresponds to the content loaded into the ConfigMap.
In addition is the the dashboardProviders file in the following location:
$ kubectl -n monitoring exec -it grafana-68cddfcf4-kq9s5 ls /etc/grafana/provisioning/dashboards
dashboardproviders.yaml
I also configured a datasource but I omit that as it does not seem to be your issue.
Hi @frosenberg , thanks for helping out here. But it seems in your case you are actually loading dashboard from config map? My intention was to load from file in chart subfolder "dashboards", as per readme in chart repo. I've highlighted relevant section
There are a few methods to import dashboards to Grafana. Below are some examples and explanations as to how to use each method:
dashboards:
default:
some-dashboard:
json: |
{
"annotations":
...
# Complete json file here
...
"title": "Some Dashboard",
"uid": "abcd1234",
"version": 1
}
**custom-dashboard:
# This is a path to a file inside the dashboards directory inside the chart directory
file: dashboards/custom-dashboard.json**
can you check the latest chart version?
@maorfr just tried, same situation. File is mounted empty in container.
If I insert the same dashboard json content with this key json: | directly in values.yaml then it works for example...
Can you verify that the chart version is 3.0.1?
Yes, it is. Here is for example output for dashboard ConfigMap, which was generated during chart install
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-dashboards-default
labels:
app: grafana
chart: grafana-3.0.1
release: grafana
heritage: Tiller
dashboard-provider: default
data:
redis.json:
""
I've discovered some interesting behaviour:
If I run like this:
helm install --dry-run --debug --name grafana --namespace monitoring -f values.yaml stable/grafana
[debug] Created tunnel using local port: '64644'
[debug] SERVER: "127.0.0.1:64644"
[debug] Original chart version: ""
[debug] Fetched stable/grafana to /Users/petro.kashlikov/.helm/cache/archive/grafana-3.0.1.tgz
[debug] CHART PATH: /Users/petro.kashlikov/.helm/cache/archive/grafana-3.0.1.tgz
Then file is not processed as previously described.
When I did
helm fetch stable/grafana --untar
and then run
helm install --dry-run --debug --name grafana --namespace monitoring -f values.yaml .
then file is processing.
The file has to be inside the dashboards dir. It is not a feature that works for helm install. Does this make sense?
The file has to be inside the dashboards dir. It is not a feature that works for
helm install. Does this make sense?
So file was inside dashboards folder in both cases. But you say if I call local chart it will pick up file and if from repo then no? Would then trick with -f /dashboards/somechart.json. work, like it works for values.yaml?
file works locally, json works either way.
fileworks locally,jsonworks either way.
Thank you sou much, now everything is clear and works as expected.
Hi @petrokashlikov, @maorfr,
Can you elaborate when you mention tricking "-f /dashboards/somechart.json"? Where would you specify "-f /dashboards/somechart.json"? I'm running into the same issue with the json are not being detected in the dashboards folder and I'm not using the chart folder. I just have the values.yaml and the dashboards folder. Is that suppoprted?
Also, Did you clone the grafana repository from helm/stable?
Effectively yes, it will work only if you have chart locally. You don't need to to supply this "-f /dashboards/somechart.json" it was my question.
This is still an issue for me. All my custom dashboards are empty in the container. Can someone please give instructions how to import dashboards?
@anton-chuhunou I'm seeing the issue as well.
I think the feature requested is to be able to import a json file that is outside the chart directory.
For example, helm install -f /prometheus/values.yaml referencing a file in /prometheus/dashboard.json.
Does that make sense ?
Adding to this as I had the same issue, it is specified in the helm installation documentation that the dashboards directory specified is in the helm charts package .
Do a helm pull
helm3 pull stable/grafana
Deflate the tar package
tar -xvzf grafana-5.0.10.tgz
You should have a grafana directory that also holds a dashboards directory
Add your custom dashboards to that directory
cp my-custom-dashboards/* grafana/dashboards/
Compress the grafana dir
tar -czvf grafana-5.0.10.tgz grafana/
make sure your values.yaml has your custom dashboards and a proper provider
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: true
options:
path: /var/lib/grafana/dashboards/default
dashboards:
default:
k8s-apiserver:
file: dashboards/k8s-apiserver.json
datasource: Prometheus
k8s-cluster-networking:
file: dashboards/k8s-cluster-networking.json
datasource: Prometheus
Redeploy grafana
helm3 upgrade --install grafana grafana-5.0.10.tgz -f values.yaml
You should now have the dashboards installed
Hi, we would like to not pull the chart locally and change it. We would like to use helmfiles or helm without fetching the chart locally. How can we plug the file to the remote chart?
Seems like the issue is not solved yet??
Same issue here---
when using grafana via binaries, put all dashboard.json files in /var/lib/grafana/dashboards directory and your work is done.
when using grafana via docker-compose, mount your directory containing all dashboard.json files to the /var/lib/grafana/dashboards directory and your work is done.
Then why not with helm charts???
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: true
options:
path: /var/lib/grafana/dashboards/default
dashboards:
default:
kubernetes-cluster-monitoring:
# Ref: https://grafana.com/dashboards/3119 - Kubernetes cluster monitoring (via Prometheus)
gnetId: 3119
revision: 2
datasource: Prometheus
kubernetes-cluster:
# Ref: https://grafana.com/dashboards/6417 - Kubernetes cluster
gnetId: 6417
revision: 1
datasource: Prometheus
This is working for me
Most helpful comment
This is still an issue for me. All my custom dashboards are empty in the container. Can someone please give instructions how to import dashboards?