kubectl get secrets 디코딩

1 개요[ | ]

kubectl get secrets 디코딩
$ kubectl get secrets test-secret -oyaml | grep ^data: -A2
data:
  password: YTYyZmpiZDM3OTQyZGNz
  username: YWRtaW4=

2 without jq[ | ]

$ kubectl get secrets test-secret -ojsonpath='{.data.password}' |base64 -d;echo
a62fjbd37942dcs
$ kubectl get secrets test-secret -ojsonpath='{.data.username}' |base64 -d;echo
admin
$ kubectl get secrets test-secret -oyaml | grep ^data: -A2 |tail -n+2|awk '{print $NF}'|xargs -IR sh -c 'echo R|base64 -d;echo'
a62fjbd37942dcs
admin
$ kubectl get secrets test-secret -oyaml | grep ^data: -A2 |tail -n+2|awk '{print $NF}'|while read -r R;do echo $R|base64 -d;echo;done
a62fjbd37942dcs
admin
$ kubectl get secrets test-secret -oyaml | grep ^data: -A2 |grep -v ^data:|awk '{print $NF}'|while read -r R;do echo $R|base64 -d;echo;done
a62fjbd37942dcs
admin

3 with jq 1.5[ | ]

$ kubectl get secrets test-secret -ojson | jq -r '.data[]' |xargs -IR sh -c 'echo R|base64 -d;echo'
a62fjbd37942dcs
admin
$ kubectl get secrets test-secret -ojson | jq -r '.data[]' |while read -r R;do echo $R|base64 -d;echo;done
a62fjbd37942dcs
admin

4 with jq 1.6+[ | ]

$ kubectl get secrets test-secret -ojson | jq -r '.data[] | @base64d'
a62fjbd37942dcs
admin

5 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}