This init container is intended for grafana customization with predefined list of plugins.
All the plugins listed in plugins list file will be added to grafana while appropriate grafana pod start in Kubernetes.
These plugins are downloaded while this image build instead of init container runtime.
- DataSources:
- Applications:
- Panels:
During build grafana-plugin-init container all plugins download from https://grafana.com/api/plugins (User interface available by link https://grafana.com/grafana/plugins/) and add into Docker image.
When operator create or update Grafana deployment it create deployment with two containers:
- grafana-plugins-init -
initContainerwhich run with volumegrafana-plugins(mount to/opt/plugins) in which it copy all plugins - grafana -
containerwith Grafana which also has volumegrafana-plugins(mount to/var/lib/grafana/plugins)
When pod grafana-deployment start with init container, it always run first and execute initialize actions.
So when initContainer start it copy all plugins from image to mounted volume grafana-plugins.
Next it complete it work and grafana container start also with volume grafana-plugins.
Structure of init image:
/
└── entrypoint.sh
└── etc
└── grafana
└── plugins
├── NeoCat-grafana-cal-heatmap-panel-d7d3579
├── Vonage-Grafana_Status_panel-ca77e0d
├── algenty-grafana-flowcharting-276ca4a
├── black-mirror-1-singlestat-math-0aca146
├── briangann-gauge-panel
├── ...
└── vertamedia-clickhouse-datasourceThere is file plugins.list which contains plugin name and plugin version specified via space separator.
Currently plugins can be download only from:
https://grafana.com/api/pluginsFormat:
<plugin_name> <version>For example for include plugin which store on artifactory by link:
https://grafana.com/api/plugins/briangann-gauge-panel/versions/2.0.1/downloadneed specify:
briangann-gauge-panel 2.0.1In some cases it may be necessary add plugin which was downloaded manually from Grafana.com or from any other source.
For build this image locally with custom plugins need:
-
Edit
download_plugins.shand comment step for remove directory/tmp/pluginsecho "=> Remove directories from pervious build..." rm -rf ${DESTINATION_PATH} mkdir -p ${DESTINATION_PATH}
-
Download and extract folder with plugin to
/tmp/plugins. For example:/tmp └── /plugins └── /<manually-downloaded-plugin-1> └── <plugin-content> └── /<manually-downloaded-plugin-2> └── <plugin-content> -
Run
docker build .
During build script docker build download all plugins as ZIP files into /tmp/downloads.
Then it unarchive all plugins into /tmp/plugins.
And during build Docker image Docker will copy all files from /tmp/plugins to /etc/grafana/plugins/.