Skip to content
migration.tools
.env to Kubernetes Secret

.env to Kubernetes Secret converter

Turn the .env file your app used on a VM or in Compose into a Kubernetes Secret you can reference with envFrom. Encoding happens on this page, so production credentials aren't pasted into someone else's server.

Options

.env

Kubernetes Secret

The result appears here as soon as there is input.

Processed on this device. Nothing you paste or drop is uploaded.

How to use it

  1. 1Paste your .env or drop a file onto the input panel.
  2. 2Adjust the options — the result updates as you type.
  3. 3Copy the Kubernetes Secret or download it. Drop several files to convert a batch into one ZIP.

Using the manifest

Apply it with kubectl apply -f, then load every key into a container with envFrom: - secretRef: name: app-secrets. Non-sensitive settings belong in a ConfigMap instead — switch the resource type and use configMapRef.

kubectl create secret generic --from-env-file does the same job from a terminal. A manifest is more useful when you need to review the keys, template the name and namespace, or seal the Secret before committing it.

Questions

Why are values base64-encoded?

The Kubernetes API stores Secret data as base64 so it can hold binary values. It is not encryption. Use stringData if you want the manifest to stay readable until it is applied.

Guides that use this tool