Sunday, September 18, 2022

How to generate a kubernetes secret with base64 encrypted

 Lets' say I want to create a secret with two key value pairs in it username,password.

The data should be base64 encrypted.

Initial values.

username: 'admin'
password: '4w572$9sns1&!'

These should be converted to base64.

can you below command to do them.

echo -n 'admin' | base64
YWRtaW4=

And the final secret will be like below.

secret.yml

apiVersion: v1
kind: Secret
metadata:
  name: first-secret
type: Opaque
data:
  username: YWRtaW4=
  password: NHc1NzIk0XNuczEmIQ==



No comments:

Post a Comment