k8s-sidecar
Used to watch Kubernetes ConfigMaps and Secrets and copy their contents into a container’s filesystem.
What is k8s-sidecar?
The k8s-sidecar image is a lightweight utility container often deployed alongside applications to dynamically inject configuration. It continuously monitors Kubernetes ConfigMaps and Secrets within a namespace and writes their contents to a mounted volume inside the container.
This approach enables applications that cannot natively reload configurations from the Kubernetes API to consume updates without modification. For example, it is commonly used with logging and monitoring stacks, such as Grafana or Prometheus, where dashboards and rule files can be managed as ConfigMaps and automatically synced to disk.
By decoupling configuration management from application logic, k8s-sidecar simplifies dynamic configuration workflows in Kubernetes environments.
How to use this image
The k8s-sidecar image is typically run as a sidecar container in the same pod as the main application.
Examples:
<code><pre>apiVersion: v1
kind: Pod
metadata:
name: grafana
spec:
containers:
- name: grafana
image: grafana/grafana:latest
volumeMounts:
- name: dashboards
mountPath: /var/lib/grafana/dashboards
- name: sidecar
image: quay.io/kiwigrid/k8s-sidecar:latest
env:
- name: LABEL
value: grafana_dashboard
- name: FOLDER
value: /var/lib/grafana/dashboards
volumeMounts:
- name: dashboards
mountPath: /var/lib/grafana/dashboards
volumes:
- name: dashboards
emptyDir: {}</pre></code>
This example shows k8s-sidecar watching ConfigMaps labeled grafana_dashboard
and writing them into Grafana’s dashboards folder.
Image variants
The k8s-sidecar image is generally published under quay.io/kiwigrid/k8s-sidecar
and available in these forms:
k8s-sidecar:<version>
Version-pinned images (e.g., k8s-sidecar:1.27.0
) are recommended for production to ensure predictable behavior.
k8s-sidecar:latest
Tracks the most recent stable release. Useful for testing but less reliable for long-term production use.
k8s-sidecar:dev / nightly
Built from the development branch. Intended for contributors or teams testing upcoming features.