1. 生成username和password加密文件
# echo -n 'admin' | base64 YWRtaW4= # echo -n 'kyle123' | base64 a3lsZTEyMw==
2. 创建yaml内容
## cat redis_secret.yaml apiVersion: v1 kind: Secret metadata: name: mysecret type: Opaque data: username: YWRtaW4= password: a3lsZTEyMw==
3. 查询Secret解析内容
# kubectl get secrets mysecret -o yaml -n test apiVersion: v1 data: password: a3lsZTEyMw== username: YWRtaW4= kind: Secret metadata: creationTimestamp: "2021-01-05T03:03:21Z" name: mysecret namespace: test resourceVersion: "1821791891" selfLink: /api/v1/namespaces/test/secrets/mysecret uid: 0708309a-5952-4ae7-9e0e-7ab4154de1e3 type: Opaque