1 개요[ | ]
- kubectl get secrets 디코딩
Console
Copy
$ kubectl get secrets test-secret -oyaml | grep ^data: -A2
data:
password: YTYyZmpiZDM3OTQyZGNz
username: YWRtaW4=
2 without jq[ | ]
Console
Copy
$ kubectl get secrets test-secret -ojsonpath='{.data.password}' |base64 -d;echo
a62fjbd37942dcs
$ kubectl get secrets test-secret -ojsonpath='{.data.username}' |base64 -d;echo
admin
Console
Copy
$ 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
Console
Copy
$ 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
Console
Copy
$ 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[ | ]
Console
Copy
$ kubectl get secrets test-secret -ojson | jq -r '.data[]' |xargs -IR sh -c 'echo R|base64 -d;echo'
a62fjbd37942dcs
admin
Console
Copy
$ 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+[ | ]
Console
Copy
$ kubectl get secrets test-secret -ojson | jq -r '.data[] | @base64d'
a62fjbd37942dcs
admin
5 같이 보기[ | ]
편집자 Jmnote
로그인하시면 댓글을 쓸 수 있습니다.