DevTools Logo

ENV to ConfigMap Converter

ENV to ConfigMap Converter

Turn a .env file into Kubernetes ConfigMap or Secret YAML, locally and byte-safely.

Runs in your browser
Try an example

.env file

4 lines · 78 chars

Kubernetes YAML

4 key(s)

Details

Kubernetes ConfigMaps store plain configuration and Secrets store base64-encoded data. Paste a .env file and choose the target object, name and namespace. Values with spaces, quotes and embedded newlines are emitted as YAML block scalars; Secret data is encoded from UTF-8 bytes so non-ASCII text survives. Keys are checked against DNS-1123 rules with lowercase suggestions, and duplicate keys follow .env last-wins semantics with a warning.

More examples

Application settings

APP_NAME=demo
PORT=8080
FEATURE_FLAGS=alpha,beta

Each assignment becomes a quoted key under data in the generated ConfigMap.

Multiline PEM

PRIVATE_KEY='-----BEGIN KEY-----
abc
-----END KEY-----'

Multiline values are emitted with the YAML block scalar |- so indentation stays valid.

Secret with Unicode

GREETING=Grüße 😀

Base64 Secret output encodes UTF-8 bytes, preserving non-ASCII characters.

Examples

Simple config

Input
PORT=8080
APP_NAME=demo
Output
data: PORT '8080', APP_NAME 'demo'

Each key becomes a quoted scalar under data.

Multiline PEM

Input
PRIVATE_KEY='-----BEGIN KEY-----
abc
-----END KEY-----'
Output
PRIVATE_KEY: |- followed by indented lines

YAML block scalars preserve line breaks without trailing newline ambiguity.

Unicode secret

Input
GREETING=Grüße 😀
Output
Base64 text under Secret.data

Base64 is computed from UTF-8 bytes, not Latin-1 code units.

Duplicate keys

Input
A=first
A=second
Output
A: 'second' plus a duplicate warning

Last value wins, matching shell/dotenv grammar.

About this tool

ENV to ConfigMap Converter translates a .env file into Kubernetes ConfigMap or Secret YAML. It preserves value quoting, supports export prefixes, joins multi-line quoted values and encodes Secret data from UTF-8 bytes so unicode is safe.

Keys are checked against DNS-1123 rules with suggestions, and duplicate keys follow .env last-wins semantics with a visible warning. Names, namespaces and immutability controls are available inline; values are emitted with YAML quoting or block scalars as appropriate.

All conversion runs in the browser. Nothing is uploaded, and the resulting YAML can be copied or downloaded straight into a deployment workflow.

What this tool does not do

  • Input follows simple KEY=VALUE dotenv grammar; interpolation such as ${VAR} is not evaluated.
  • Base64 is encoding, not encryption; the tool does not protect secret values.
  • Multiline values are detected from quoted spans; unquoted multi-line values are treated as separate assignments.
  • Kubernetes 1 MiB object limits are warned about but not enforced by the tool.
  • No cluster connection is made; the tool only emits YAML text.

How to use this tool

  1. Paste the env file

    Paste assignments in KEY=VALUE form. export prefixes, comments, quoted values and blank lines are handled.

  2. Choose the object

    Switch between ConfigMap and Secret, set name and namespace, and choose base64 data or plain stringData.

  3. Review warnings

    Check duplicate-key and key-name warnings; invalid keys block output until corrected.

  4. Copy or download

    Copy the YAML into a manifest or save it as a file for kubectl apply.

Use cases

Migration to Kubernetes

Move an existing .env file into a manifest without hand-quoting every value.

Secret preparation

Generate base64 Secret data locally rather than shipping values through a web service.

Config reviews

See all keys and values in one YAML block before committing them.

Teaching Kubernetes

Show the difference between ConfigMap data and Secret data/stringData.

Output forms

SettingEffect
ConfigMap + dataSingle-line values quoted; multiline values as |- block scalars
Secret + dataValues base64-encoded from UTF-8 bytes
Secret + stringDataPlain values; Kubernetes encodes them on create
immutableAdds immutable: true to the object
namespaceAdds metadata.namespace when provided

Kubernetes limits objects to 1 MiB; a warning appears at 80% of that budget.

Common mistakes

Mistake:Putting underscores in ConfigMap keys.

Fix:DNS-1123 keys allow lowercase letters, digits, dashes and dots; the tool suggests a replacement.

Mistake:Assuming base64 is encryption.

Fix:Secret data is only encoded; use RBAC and encryption at rest to protect values.

Mistake:Using a block scalar for a value with trailing spaces.

Fix:Trailing spaces are preserved in quoted single-line values; block scalars strip them.

Mistake:Expecting duplicates to produce two YAML keys.

Fix:Dotenv last-wins semantics apply, and the duplicate is reported.

Mistake:Pasting token values into a random web tool.

Fix:This converter works entirely in the browser and never transmits input.

Frequently asked questions

When should I generate a Kubernetes Secret instead of a ConfigMap?

Use ConfigMaps for non-sensitive settings like feature flags, URLs, and ports, and Secrets (coupled with RBAC and encryption at rest or external secret managers) for API keys, tokens, and passwords.

Is Kubernetes Secret base64 encoding encryption?

No. Base64 in a Secret YAML is plain binary-to-text encoding anyone can decode; never commit raw Secret manifests to Git without Sealed Secrets, SOPS, or an external secret store.

How are multiline values like PEM keys formatted?

Multiline ConfigMap entries emit clean YAML block scalars (|-), while Secret data encodes raw UTF-8 bytes to standard single-line base64.

Is my .env file uploaded anywhere?

Never. Conversion happens 100% locally in your browser with no persistence or telemetry.

References & standards