October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

Grafana as Code: Surviving Destroy-Recreate With Provisioning Files

Grafana recovery after container replacement depends on two separate layers: persistent storage for instance data and provisioning files for declared dashboards and data sources.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To recreate Grafana without losing its intended setup, preserve its data directory and redeploy its provisioning files. They solve different problems: persistent storage retains Grafana’s database state, while provisioning files rebuild the resources declared in those files. A volume alone does not recreate file-defined dashboards, and provisioning alone does not preserve every part of an instance’s database.

What a container replacement can erase

Grafana’s Docker image uses an embedded SQLite database by default to store configuration, users, dashboards, and other data. If changes exist only in the container’s writable filesystem, removing that container removes those changes too. Grafana recommends using a Docker volume or bind mount for data that must persist. See Grafana’s Run Grafana Docker image documentation.

As an Amazon Associate I earn from qualifying purchases.

For Docker, the documented data path is /var/lib/grafana. Mount persistent storage there, or at the data path if your Grafana configuration customizes it. Check the configuration used by the image you deploy rather than assuming every instance uses the default. Grafana documents its Docker paths in Configure a Grafana Docker image.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Two recovery layers: stored state and declared resources

Persistent data retains instance state

A persistent volume or bind mount keeps data written under Grafana’s data path available to a replacement container. This is the layer to use for database state that must survive container removal. Docker volumes and bind mounts are both documented persistence options; choose according to how your deployment manages storage and host paths.

Provisioning files rebuild what you declare

Grafana’s classic provisioning reads YAML files at startup to configure resources such as data sources and dashboards. Dashboard provider configuration points Grafana to a directory containing dashboard definitions, so the provider file and the referenced definitions must both be available in the replacement instance. The standard Docker provisioning path is /etc/grafana/provisioning, though it may be customized. Keep the files in version control and make them available at the configured paths in every replacement container. See Provision Grafana.

In Docker, this usually means providing the data directory and provisioning content separately: mount persistent storage at the configured data path, and include provisioning files in the image or mount them at the configured provisioning path. A volume that preserves the database does not supply missing dashboard JSON or YAML, and a mounted provisioning directory does not preserve unrelated database state.

Make file provisioning repeatable—and account for its effects

Provisioning makes declared resources reproducible, but it also establishes a source of truth. Grafana can reconfigure an existing data source to match its provisioning file. A data-source file’s deleteDatasources list deletes the named sources before configured sources are added or updated; prune: true removes provisioned data sources that are no longer present in the file. Review these settings before deploying changes that remove or rename entries.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

File-provisioned dashboards have a related consequence: a later update from the source can overwrite edits made in Grafana’s UI. Grafana ignores the dashboard JSON version value for this reconciliation. Removing a dashboard’s provisioning source can delete that dashboard unless its provider has disableDeletion: true. Treat edits to file-managed dashboards as changes to the source files when those files are authoritative.

Versioning the provisioning files and dashboard definitions lets a team review changes and roll them back; automation can then deploy the reviewed configuration consistently. Grafana describes Git collaboration, CI/CD, and infrastructure-as-code tools as parts of an as-code workflow in Provision Grafana and its as-code workflows overview.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Deliver provisioning and persistence on Kubernetes

The same two-layer distinction applies to Kubernetes. Use persistent storage for Grafana data that must survive pod replacement, and separately ensure each replacement pod receives the provisioning configuration and referenced dashboard files. Grafana’s Kubernetes guide demonstrates a PersistentVolumeClaim supplying provisioning files through a mounted directory, then restarting the pod to apply the resources; that example does not define a universal production storage design. See Deploy Grafana on Kubernetes.

Choose storage and configuration delivery to suit the cluster and workload. A mounted provisioning directory answers how files reach the pod; it does not, by itself, establish that Grafana’s database directory is persistent. Confirm both separately in the deployment manifests and the paths configured for that Grafana release.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recovery checklist for a replacement instance

  1. Confirm which Grafana version, configuration, and data and provisioning paths the replacement uses. Defaults documented for Docker are /var/lib/grafana and /etc/grafana/provisioning; customized paths take precedence.
  2. Verify that persistent storage is mounted at Grafana’s configured data path if database state must survive replacement.
  3. Verify that provisioning YAML files and every referenced dashboard definition are present at the configured paths in the new container or pod.
  4. Review dashboard provider deletion behavior and data-source deletion or pruning settings before applying file changes.
  5. Start or restart Grafana as appropriate for the deployment, then inspect the resulting dashboards and data sources to confirm they match the intended configuration.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.