K8s secret解密
root@ubuntu:~# kubectl get secret rbd-db -n rbd-system -o yaml
apiVersion: v1
data:
mysql-password: ZTU5ZTg3NzM= #经过SECRET加密的密码
mysql-user: d3JpdGU= #经过SECRET加密的用户
kind: Secret
metadata:
creationTimestamp: "2020-02-17T02:56:34Z"
name: rbd-db
namespace: rbd-system
ownerReferences:
- apiVersion: rainbond.io/v1alpha1
blockOwnerDeletion: true
controller: true
kind: RbdComponent
name: rbd-db
uid: 355a6a48-41b8-458e-b83f-032782b1de6e
resourceVersion: "3185"
selfLink: /api/v1/namespaces/rbd-system/secrets/rbd-db
uid: 3cc680d8-fcde-4128-ad5c-ef15f0192a1f
type: Opaque
得到加密的用户名和密码后进行解密,分别解密得到用户名和密码。
root@ubuntu:~# echo 'd3JpdGU=' | base64 --decode
write
root@ubuntu:~# echo 'ZTU5ZTg3NzM=' | base64 --decode
e59e8773