Shared ConfigMaps (K8s Config)
Several of your applications need the same configuration file, or one
application needs a config block too large to sit comfortably inside its own
values. The K8s Config Component type creates Kubernetes ConfigMaps that any
of your applications can mount as files.
When to use this
Use a K8s Config Component when the content is a file — a config file, a shell
script, a certificate bundle — that one or more applications read from disk,
and especially when more than one application needs the same copy. For single
values reused across Components, use Variables instead. For anything
sensitive, use Secrets Manager — a ConfigMap is not a secret store.
Creating a shared ConfigMap
Provision a K8s Config Component with your configuration data:
configMaps:
app-config:
# Optionally copy the ConfigMap into additional namespaces:
# namespaces:
# - ns1
# - ns2
data:
key1: value1
key2: value2
hello-world.sh: |
#!/bin/sh
echo "Hello world"| Key | Required | Description |
|---|---|---|
configMaps.<name> | Yes | Each entry defines one ConfigMap |
<name>.data | Yes | Key/value pairs. Values can be plain strings or multiline content such as scripts and config files |
<name>.namespaces | No | Additional namespaces to copy the ConfigMap into |
Mounting it in an application
In your application Component — the generic application types — reference the
ConfigMap under volumes:
volumes:
configMaps:
app-config:
mountPath: /app/configThere is no data key here. You are mounting the ConfigMap you already
created, not defining a new one inline.
Each key in the ConfigMap's data appears as a file under the mount path — for
example /app/config/hello-world.sh.
Related articles
- Variables and Shared Config — for templating single values across Components
- Secrets Manager — for credentials and other sensitive values
Updated about 6 hours ago