Share YAML without breaking the indentation
YAML fails silently. Two spaces instead of four, one tab where a space belonged, or a colon inside an unquoted string, and the file that worked on your machine is invalid on the reader's. That is exactly the failure a paste prevents: the text arrives byte-for-byte, not re-rendered through a chat client that strips leading whitespace.
Why a paste beats pasting into chat
Chat apps collapse runs of spaces, convert tabs, apply smart punctuation and wrap long lines. All four break YAML. Even clients that offer a code block can mangle trailing spaces, which matter inside literal blocks (|). A paste link stores the text as typed, and the reader can copy from the raw endpoint if their editor needs it.
Round-trip a YAML paste
# get the exact file back
curl -s https://pastesite.com/raw/K8sMan1fest > deployment.yaml
diff deployment.yaml ~/project/deployment.yaml
Before sending a Kubernetes or compose file
| Usually fine to share | Redact first |
|---|---|
| apiVersion, kind, metadata.name | Secret manifests, base64 "data" values |
| Container images and ports | Registry credentials, imagePullSecrets |
| Resource limits and probes | Cloud provider account ids, ARNs |
| Environment variable names | Environment variable values that are tokens |
| Volume names and mount paths | PVC names that reveal customer identities |
Kubernetes Secrets are base64, not encrypted. Anyone reading the paste can decode them in one command, so treat data: blocks as plaintext credentials.
Common indentation bugs to check first
- Tabs. YAML forbids them for indentation. Editors inserting tabs produce an error that points at the wrong line.
- Two versus four spaces. Consistent within a file matters more than the count, but mixed levels inside one mapping are fatal.
- Colons in values.
name: http://xparses as a mapping; quote it asname: "http://x". - Anchors and aliases.
&default/*defaultsurvives a paste, but some tools re-emit YAML and expand them, changing the diff. - Trailing newline. Some parsers care at EOF; the raw endpoint preserves what you pasted.
Choosing paste settings
Set the language to YAML for keys, strings and comments in colour. Config files rarely belong in a public feed, so mark the paste unlisted and give it an expiry. If the file contains anything that looks like a credential, replace it with a placeholder and add a password — then send the password in a different message.
Frequently asked questions
Does the paste convert tabs to spaces?
No. The text is stored exactly as pasted. If your editor wrote tabs, the paste keeps tabs — and a YAML parser will reject them, which is a useful signal rather than a paste bug.
Can I share a Kubernetes Secret safely?
Only if you have replaced the base64 values. A Secret is trivially decodable, so redact the data block and keep the structure.
Which YAML flavours are highlighted?
Any YAML text gets the same key/value/comment colouring. There is no schema awareness, so a Kubernetes manifest and a CI config are treated identically.
Can I compare two YAML files?
Yes — paste both versions into the text comparison tool, or paste the output of diff -u with the language set to Diff.