All Tools View Categories About Contact Privacy

.env to Kubernetes ConfigMap/Secret Converter

Convert a .env file into Kubernetes ConfigMap or Secret YAML — valid keys, optional base64, full metadata.

Runs entirely in your browser — nothing is uploaded.

About .env to Kubernetes ConfigMap/Secret Converter

When environment configuration lands in Kubernetes it becomes a ConfigMap, and anything sensitive becomes a Secret — both with strict rules: data keys may only contain alphanumeric characters, -, _ and ., and Secret values are stored base64-encoded by convention. Hand-writing these manifests from a .env is repetitive and error-prone; one transposed character in a base64 blob silently breaks a secret reference.

The .env to Kubernetes ConfigMap/Secret Converter generates the manifest for you. Paste a .env, pick ConfigMap or Secret, and receive valid YAML with the right apiVersion, kind, metadata and data entries. Secret values are base64-encoded automatically (with a plain-value toggle for stringData workflows), keys are validated against the Kubernetes character set, and options cover the resource name, namespace, labels, annotations and lowercase-key normalization.

The whole thing runs in your browser — the values never leave the page — so generating a manifest is now a two-second task instead of a manual chore.

Features

  • ConfigMap or Secret: pick the resource kind in one click.
  • Strict key validation: only A-Z, a-z, 0-9, -, _ and . are allowed; invalid keys are flagged.
  • Automatic base64: Secret values are encoded exactly like kubectl expects.
  • Plain-value toggle: emit unencoded values for stringData-style Secrets.
  • Lowercase keys: normalize .env keys for envFrom convention.
  • Full metadata: name, namespace, labels and annotations.
  • Correct apiVersion: v1 for both ConfigMap and Secret.
  • Quoted .env handling: wrapped values are unwrapped correctly; comments skipped.
  • Copy or download: clipboard or a .yaml file ready for kubectl apply.
  • Private: all conversion happens in your browser.

How to Use

  1. Paste your .env content into the input box, or load the sample to try it.
  2. Choose ConfigMap or Secret with the toggle.
  3. Set metadata. Resource name, optional namespace, labels and annotations.
  4. Optionally tick Lowercase keys to normalize for envFrom.
  5. Click Convert. The manifest YAML appears on the right.
  6. Copy or download and pipe it to kubectl apply.

Examples

Example 1 — App configuration ConfigMap. A developer converts PORT, DATABASE_URL and feature flags into a ConfigMap named app-config and mounts it with envFrom; lowercase keys match the deployment convention.

Example 2 — API Secret. A backend converts a .env full of API keys and tokens into a Secret with base64 data, applied with kubectl apply and referenced from a deployment that never sees the raw values in plain text.

Example 3 — Multi-environment namespaces. A platform team generates the same .env into staging and production manifests by changing only the namespace field.

Example 4 — stringData workflow. A developer uses the plain-value toggle to emit a Secret with stringData and apply it through a GitOps pipeline that encodes values in-cluster.

Example 5 — Monorepo standardization. An SRE converts all service .env files into ConfigMaps so every microservice gets identical, reviewable manifests.

Benefits

  • Valid manifests: correct kinds, apiVersion and data structure every time.
  • No manual base64: Secret encoding is derived, not typed.
  • Schema-safe keys: invalid characters are caught before they reach the cluster.
  • Reviewable output: deterministic conversion, easy to diff and lint.
  • Fast iteration: regenerate on every .env change in seconds.
  • Private & free: browser-only conversion, no account.

Frequently Asked Questions

What does this tool do?
It reads a .env file of KEY=value lines and outputs a ready-to-apply Kubernetes ConfigMap or Secret manifest. Values become data entries, Secret values can be base64-encoded, and keys are normalized to the valid ConfigMap/Secret key character set.
When do I need a ConfigMap vs a Secret?
ConfigMap is for non-sensitive configuration (ports, feature flags, endpoints). Secret is for anything sensitive such as API keys, passwords and tokens — it stores values base64-encoded (which is obfuscation, not encryption) and is often encrypted at rest.
How are keys normalized?
Kubernetes allows only alphanumeric characters, -, _ and . in ConfigMap and Secret data keys. Keys are validated and reported; an option maps uppercase .env keys to lowercase (the convention used with envFrom) to keep manifests consistent.
Are Secret values really base64?
When producing a Secret, the value of every KEY=value line is base64-encoded just like kubectl or the client libraries do. The plugin offers a toggle to keep values plain for situations where a Secret is used through envFrom with stringData.
Does it handle quoted values?
Yes. Double- and single-quoted values from the .env are unwrapped before conversion, comment lines and blank lines are dropped, and duplicate keys are flagged with their line numbers.
Can I add metadata?
Yes — choose the resource name, optional namespace and optional labels/annotations. The YAML is written with a header comment indicating it was generated from a .env, ready to pipe to kubectl apply.
Is my data uploaded?
No. Everything runs client-side in your browser. Nothing is sent to any server, stored or logged.
Why is base64 not encryption?
base64 is reversible encoding, so a Secret manifest with encoded values is not a secure store. For production secrets use sealed-secrets, SOPS, or your platform’s secret manager. This tool only generates the manifest format Kubernetes expects.