Blog
Home

Kubernetes tip 4: Update a Secret from files

20 July 2026 · 53 views

A small Kubernetes tip that saves time when updating TLS secrets. If your secret is generated from files, you do not need to delete and recreate it manually:

kubectl create secret generic production-tls \
  --from-file=./tls.key \
  --from-file=./tls.crt \
  --dry-run=client -o yaml | kubectl apply -f -

This is a clean way to update a secret in a repeatable way, especially in scripts or CI/CD pipelines.

Terminal screenshot of the kubectl secret update command

Co-authored with Claude.

If this was useful, you can buy me a coffee.

New articles: follow via RSS.

Comments

← All articlesView as Markdown