I am trying to create a configmap for a Grafana datasource, using an instance of Grafana from the Kube-Prometheus-Stack helm chart https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack
I am aware for dashboards, you can create a configmap from a json file using the commands listed in this answer: stable/prometheus-operator - adding persistent grafana dashboards
wget https://raw.githubusercontent.com/percona/grafana-dashboards/master/dashboards/MongoDB_Overview.json
kubectl -n monitoring create cm grafana-mongodb-overview --from-file=MongoDB_Overview.json
kubectl -n monitoring label cm grafana-mongodb-overview grafana_dashboard=mongodb-overview
Can something similar be done for grafana datasources? I currently have a datasource.yaml which contains the following lines:
data:
datasource-PRF1-Prometheus.yaml: |-
apiVersion: 1
datasources:
- name: Test-Prometheus
type: prometheus
url: https://prometheus.url.net/
access: Server
isDefault: true
basicAuth: true
basicAuthPassword: password
basicAuthUser: admin
However, I am not able to import a datasource using it, even though it creates a configmap.
datasource.yaml
by something unique and descriptive for your case, I have for exampleloki-datasource.yaml
– Sheriff