kubernetesazure-devopsautomationgrafanagrafana-api

Automate Grafana Dashboard Creation


Currently I have created Grafana Dashboard manually. I have got the Json. I wanted to automate and I came across the Grafana HTTP API. https://grafana.com/docs/grafana/latest/developers/http_api/dashboard/. The problem is currently Grafana is not exposed outside. Its having internal Load balancer. I am planning to automate the Dashboard creation throug

  1. Create a short-lived service account token
  2. Create a temporary pod(https://hub.docker.com/r/curlimages/curl) and execute the API calls by passing the json to create Dashboard from the pipeline.

Is there any alternatives or is there any security concern doing this ?


Solution

  • Currently, we dont have self hosted agent, so, here is what I did.

    1. Create a shell script file(curl into creating the Dashboard calling the grafana api)
    2. Create a Dashboard model Json
    3. copy both into the pod while running through pipeline
    4. execute the shell script on the pod through the pipeline.

    Its working fine