DevOps & Config Tools

Kubernetes ConfigMap Generator

Turn configuration into a ConfigMap: KEY=value lines or a whole .env file become data entries, and files such as nginx.conf become keys that can be mounted as files. The generator warns about values that belong in a Secret, checks the 1 MiB size limit, can make the ConfigMap immutable or give it a content hash, and shows how a pod uses it and the equivalent kubectl command.

  • Runs in your browser
  • No sign-up
  • Free to use
Start from an example
Options

    How to use Kubernetes ConfigMap Generator

    1. Enter the ConfigMap name and namespace.
    2. Paste KEY=value lines or a .env file.
    3. Add files, each starting with “--- filename”.
    4. Copy the ConfigMap and the usage example.

    Kubernetes ConfigMap Generator features

    .env aware

    Quotes, export prefixes and comments handled.

    Files

    Configuration files as keys, mounted into a folder.

    Secret detection

    Passwords and tokens flagged for a Secret instead.

    Immutable

    Optional immutable flag for safer, cheaper ConfigMaps.

    Content hash

    Name changes with content to trigger rollouts.

    Usage

    envFrom and volume mount snippet plus kubectl command.

    When to use Kubernetes ConfigMap Generator

    • Moving app settings from a .env file into Kubernetes.
    • Shipping an nginx or app configuration file to pods.
    • Creating environment-specific settings for staging and production.
    • Learning how ConfigMaps reach containers.

    Kubernetes ConfigMap Generator FAQ

    Environment variables or mounted files?

    Environment variables suit simple settings and are read at start. Mounted files suit whole configuration files and are updated in running pods after a short delay.

    Why are some keys flagged?

    ConfigMaps are stored and displayed in plain text. Passwords, tokens and keys belong in a Secret with restricted access.

    Do pods see changes?

    Mounted files update after about a minute (not with subPath). Environment variables only change when the pod restarts, for example with kubectl rollout restart.

    What does the content hash do?

    It appends a short hash of the data to the name. Changing the data changes the name, so updating the Deployment reference rolls out new pods automatically.

    How large can a ConfigMap be?

    At most 1 MiB in total; the generator checks the size.

    Is anything uploaded?

    No. The YAML is generated in your browser.

    Configuration for pods

    A ConfigMap stores non-secret configuration for pods, separate from the container image, so the same image runs in development, staging and production with different settings. Each key can be exposed as an environment variable or as a file in a mounted folder.

    Most configuration starts life as a .env file or a set of KEY=value pairs. The generator parses them with the same rules as dotenv loaders: comments and blank lines are skipped, export prefixes are removed, and single- and double-quoted values are unquoted, including multi-line values. Keys are checked against the characters Kubernetes allows.

    Whole files go into the same ConfigMap: start each with a line “--- filename”. Mounted as a volume, every file key becomes a file in the mount folder, which is how web server and application configuration files reach containers.

    Two options help with change management. Immutable ConfigMaps cannot be edited, which protects against accidental changes and reduces load on the API server; you create a new one to change values. A content hash in the name, as used by Kustomize, makes every change produce a new name, so referencing it from the Deployment triggers a rolling update.

    Values that look like secrets are flagged, because ConfigMaps are readable by anyone with access to the namespace and appear in plain text in kubectl output. Put those in a Secret, created with the Kubernetes Secret Template Generator.

    Other useful tools