Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieve secret value from openshift

I created a key/value secret in openshift. I want to retrieve the value of that key/value pair.

i tried using

oc describe secret ashish -n my-project

but it gave the value as shown below but i dont the value for my key it just shows 7bytes.

Name:         ashish
Namespace:    my-project
Labels:       <none>
Annotations:  <none>

Type:  Opaque

Data
====
ashish:  7 bytes
like image 250
ashish Avatar asked Jul 17 '26 01:07

ashish


1 Answers

You can get key and value using "oc get secret/SECRETNAME -o yaml" simply, but you should decode the value by base64. After you retrieve the key using "oc get -o yaml", the value can decode simply as follows.

oc get secret ashish -n my-project \
   -o go-template --template="{{.data.KEY|base64decode}}"
VALUE

For example,

oc get secret ashish -n my-project \
   -o go-template --template="{{.data.ashish|base64decode}}"
...value...
like image 102
Daein Park Avatar answered Jul 18 '26 18:07

Daein Park



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!