Config Files
Mount configuration files into containers using Config Slots
Overview
Many self-hosted applications require configuration files at specific paths inside the container — prometheus.yml, gitlab.rb, mosquitto.conf, nginx.conf, and so on. Config Slots let you define these files as part of a stack template and edit their contents per deployment.
Under the hood, each config slot becomes a Kubernetes ConfigMap with a subPath volume mount. PodWarden handles ConfigMap creation, mounting, and cleanup automatically.
How Config Slots Work
Config Slots have two parts:
- Config Schema (on the stack) — declares which config files the workload accepts, their mount paths, file types, and optional default content
- Config Values (on the deployment) — stores the actual file content per deployment, allowing operators to customize each config file
When you deploy a deployment, PodWarden:
- Resolves content for each config slot (user-edited content takes priority over defaults)
- Creates a Kubernetes ConfigMap for each slot
- Mounts each ConfigMap into the container at the declared path using a subPath volume mount
- On undeploy, cleans up the ConfigMaps automatically
Defining Config Slots
Config slots are defined on stacks (or Hub templates). Each slot declares a mountable config file.
Adding Config Slots
- Go to Apps & Stacks and create or edit a definition
- Scroll to the Config Files section
- Click Add Config Slot
- Fill in the slot fields:
| Field | Required | Description |
|---|---|---|
name | Yes | Display name (e.g. "Prometheus Config") |
key | Yes | Unique identifier, used in ConfigMap naming (e.g. prometheus_yml) |
mount_path | Yes | Absolute path inside the container (e.g. /etc/prometheus/prometheus.yml) |
file_type | Yes | File format for syntax highlighting in the editor |
required | No | Whether the config file must be provided before deploying |
description | No | Help text explaining what this config file controls |
default_content | No | Default file content, used when the operator doesn't provide a custom value |
Supported File Types
The file_type field determines syntax highlighting in the config editor:
| File Type | Syntax Highlighting |
|---|---|
yaml | YAML |
json | JSON |
xml | XML |
toml | Plain text with line numbers |
ini | Plain text with line numbers |
conf | Plain text with line numbers |
rb | Plain text with line numbers |
env | Plain text with line numbers |
plaintext | Plain text with line numbers |
Config Schema Format
Config slots are stored as a JSON array in the config_schema field:
[
{
"name": "Prometheus Config",
"key": "prometheus_yml",
"mount_path": "/etc/prometheus/prometheus.yml",
"file_type": "yaml",
"required": true,
"description": "Main Prometheus configuration file",
"default_content": "global:\n scrape_interval: 15s\n\nscrape_configs:\n - job_name: 'prometheus'\n static_configs:\n - targets: ['localhost:9090']\n"
}
]Editing Config Files on Assignments
When creating or editing a deployment, config files appear in a collapsible Config Files section below the environment variables.
Customizing Config Files
- Go to Deployments and create or edit an assignment
- Expand the Config Files section (shows a count badge, e.g. "2 config files available")
- Each config slot shows as a card with the slot name, description, and file type
- Click Edit on any slot to open the code editor
- Edit the file content — the editor provides syntax highlighting based on the file type
- Click Reset to Default to revert to the template's default content
Each slot shows a status badge:
- default — using the template's default content (or empty)
- customized — operator has provided custom content
Config Values Format
Customized config file contents are stored as a JSON array in the config_values field on the assignment:
[
{
"key": "prometheus_yml",
"content": "global:\n scrape_interval: 30s\n\nscrape_configs:\n - job_name: 'node'\n static_configs:\n - targets: ['node-exporter:9100']\n"
}
]Only slots with customized content are stored. Slots without a config_values entry use the default_content from the schema.
Deployment Behavior
Content Resolution
For each config slot, PodWarden resolves the file content in this order:
- User-provided content — from
config_valueson the assignment - Default content — from
default_contentin the definition'sconfig_schema - Skip — if neither exists and the slot is not required, it's omitted
If a required slot has no content (no user value and no default), deployment is blocked with a validation error.
Kubernetes Resources
Each config slot with resolved content creates:
- ConfigMap named
{deployment-name}-cfg-{slot-key}in the target namespace - Volume mount using
subPathto mount the single file at the declaredmount_path
The ConfigMap contains a single data key — the filename extracted from the mount path (e.g. prometheus.yml from /etc/prometheus/prometheus.yml).
Redeployment
When you redeploy an assignment after changing config values:
- ConfigMaps are updated with new content
- The Deployment is reapplied, triggering a pod restart with the updated config files
Undeploy Cleanup
When you undeploy an assignment, PodWarden deletes all config slot ConfigMaps along with the Deployment, Service, and other resources.
Examples
Prometheus
A monitoring server with a YAML config file.
Config schema on the stack:
[
{
"name": "Prometheus Config",
"key": "prometheus_yml",
"mount_path": "/etc/prometheus/prometheus.yml",
"file_type": "yaml",
"required": true,
"description": "Scrape targets and alerting rules",
"default_content": "global:\n scrape_interval: 15s\n\nscrape_configs:\n - job_name: 'prometheus'\n static_configs:\n - targets: ['localhost:9090']\n"
}
]Operators customize the scrape targets per deployment while the default config provides a working starting point.
Mosquitto MQTT Broker
An MQTT broker with a .conf config file.
Config schema:
[
{
"name": "Mosquitto Config",
"key": "mosquitto_conf",
"mount_path": "/mosquitto/config/mosquitto.conf",
"file_type": "conf",
"required": false,
"description": "Mosquitto broker configuration",
"default_content": "listener 1883\nallow_anonymous true\npersistence true\npersistence_location /mosquitto/data/\nlog_dest stdout\n"
}
]GitLab (Multiple Config Files)
A complex application with multiple config files at different paths.
Config schema:
[
{
"name": "GitLab Configuration",
"key": "gitlab_rb",
"mount_path": "/etc/gitlab/gitlab.rb",
"file_type": "rb",
"required": true,
"description": "Main GitLab Omnibus configuration file"
},
{
"name": "GitLab Runner Config",
"key": "runner_toml",
"mount_path": "/etc/gitlab-runner/config.toml",
"file_type": "toml",
"required": false,
"description": "GitLab Runner registration and executor settings"
}
]Each config slot is independently editable per assignment. One operator might customize gitlab.rb while another uses the default.
Hub Templates with Config Slots
When you import a template from PodWarden Hub, any config slots defined on the Hub template are imported along with all other fields. The config_schema carries over — including default content — so operators can deploy immediately with sensible defaults or customize per deployment.
Hub template authors can add config slots in the template editor under the Config File Slots section.
Config Files vs. Volume Mounts
Config Slots and volume mounts serve different purposes:
| Config Slots | Volume Mounts (configMap type) | |
|---|---|---|
| Content source | Edited in PodWarden UI | Pre-existing ConfigMap in cluster |
| Management | PodWarden creates and manages the ConfigMap | You manage the ConfigMap yourself |
| Per-deployment customization | Built-in — each assignment can have different content | Manual — update the ConfigMap separately |
| Default content | Defined on the template | Not applicable |
| Syntax highlighting | Yes, based on file type | No |
Use Config Slots when you want operators to edit config file contents directly in PodWarden. Use configMap volume mounts when you have pre-existing ConfigMaps managed outside of PodWarden.
Next Steps
- Apps & Stacks — full field reference
- Storage — volume types including configMap and secret mounts
- Creating Custom Templates — build your own stack templates
- PodWarden Hub — browse templates with pre-configured config slots