1001Ferramentas
🔐Dev

Kubernetes Secret Generator

Generate a Kubernetes Secret in YAML with values already base64-encoded. Store passwords and tokens safely and apply them to your cluster with kubectl.

YAML

Kubernetes Secrets with the base64 already done

A Secret looks like a ConfigMap until you reach the data field, which only takes base64. So you open a terminal, run echo senha | base64, forget the -n flag, and ship a value with a trailing newline that looks right and fails at login. Here you type key=value pairs and the encoded manifest appears as you go, with no stray newline attached to anything.

The output is a fixed block: apiVersion v1, kind Secret, metadata.name, type Opaque, then data with one encoded entry per line, split on the first equals sign. Encoding runs through the browser btoa function, which walks the string byte by byte in Latin-1. An accented password ends up as different bytes than the UTF-8 the cluster expects, and anything past Latin-1, an emoji for instance, makes the whole output read Erro.

Keep it to ASCII values: usernames, tokens, API keys. For accented or non-Latin passwords, encode in a terminal with base64, or skip encoding altogether with stringData, which the API server encodes for you. And the part people skip: base64 is transport, not encryption, so whoever reads the file reads the password in one command. Do not commit the manifest. Generation happens locally in your browser.

Frequently asked questions

Does base64 protect the value?
No. It is reversible with base64 -d in a second. Real protection comes from RBAC, encryption at rest for etcd, or an external manager such as Vault or Sealed Secrets.
How do I verify what I generated?
Pipe the encoded value through base64 -d and compare it with what you typed. Garbled characters usually mean the value had accents, which runs into the Latin-1 limitation.
Can it produce a TLS or registry Secret?
No, the type is always Opaque. Those formats need specific keys such as tls.crt and tls.key or .dockerconfigjson, and kubectl create secret tls or docker-registry is the safer route.

Related Tools