I am not 100% sure, that this is the right way to go about it, but I have a grafana deployment:
spec:
volumes:
- name: grafana-config
configMap:
name: grafana-configmap
- name: default-dashboard
configMap:
name: default-dashboard
- name: grafana-pv
persistentVolumeClaim:
claimName: grafana-pvc
securityContext:
runAsUser: 0
containers:
- name: grafana
image: grafana/grafana:latest
env:
- name: GF_INSTALL_PLUGINS
value: yesoreyeram-boomtheme-panel
ports:
- containerPort: 3000
volumeMounts:
- mountPath: "/var/lib/grafana"
name: grafana-pv
- name: grafana-config
mountPath: /etc/grafana/provisioning/dashboards
- name: default-dashboard
mountPath: /var/lib/grafana/dashboards/
And in there I specify, that I want: default-dashboard
, which contains the json of a grafana dashboard.
So, when I deploy grafana, I get a dashboard created for me, which is great.
The issue, that I want to address, is that there might be many apps, all wanting their own dashboard, and it doesn't seem reasonable to manually specify a volume mount, in the way that I have done now.
So is it somehow possible to automatically mount all configMaps? Preferably everything matching some selector?
Or is there any other way to deploy a dashboard in this way without the grafana.yaml
being aware of every individual config map?