DEV Community

Cheedge Lee
Cheedge Lee

Posted on • Originally published at notes-renovation.hashnode.dev

Kubernets Secret (2)

5. How to decode the secret

Previous we see how to create a secret, now let’s use the base64 encode secret to decode the secret

Let’s first get the secret creating yaml file,

k get secrets database-data -o yaml > secret.yaml
Enter fullscreen mode Exit fullscreen mode

let’s use an simple opaque example, and we can see the file

apiVersion: v1
data:
  DB_PASSWORD: c2VjcmV0
kind: Secret
metadata:
  creationTimestamp: "2024-12-29T20:17:39Z"
  name: database-data
  namespace: database-ns
  resourceVersion: "5076"
  uid: a7c50ba3-8945-4ba2-b40e-27e2ecb86f2b
type: Opaque
Enter fullscreen mode Exit fullscreen mode

And the data is base64 encoded, so let’s decode it.

k get secrets database-data -n database-ns -o jsonpath='{.data.*}' | base64 -d
Enter fullscreen mode Exit fullscreen mode

and this will generate the decode DB_PASSWORD.

6. More Reference

There are more reference about secret can be found in officail documents.

Please leave your appreciation by commenting on this post!

Okay, let's go

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

👋 Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay