-
Notifications
You must be signed in to change notification settings - Fork 187
Home
A dead simple kubernetes sidecar container for downloading configmaps and secrets as files.
Common usage scenarios.
That’s the most popular use-case. It relies on Grafanas provisioning feature.
Make sure to configure a dashboard provider pointing to a folder for example /tmp/sidecar-boards
:
apiVersion: 1
providers:
- name: 'k8s-sidecar'
# <string> name of the dashboard folder.
folder: ''
type: file
disableDeletion: false
updateIntervalSeconds: 10
allowUiUpdates: false
options:
path: '/tmp/sidecar-boards'
foldersFromFilesStructure: true
Now embed the k8s-sidecar in the pod as a sidecar container with the following environment configuration:
Variable | Value | Note |
---|---|---|
|
|
Label your configmaps with this label key with and arbitrary label value |
|
|
Matches the file provisioner configuration above |
Now a config map like this:
apiVersion: v1
kind: ConfigMap
metadata:
name: my-grafana-dashboard
labels:
dashboard: "1"
annotations:
k8s-sidecar-target-directory: "test"
data:
my-grafana-dashboard.json: "..." # snip
Is going to be downloaded by the sidecar and placed in the filesystem as /tmp/sidecar-boards/test/my-grafana-dashboard.json
. After at most 10s the provisioner should detect the file and place the dashboard in the folder test
because it’s configured to re-use the folder structure.