CKS 模拟真题 Killer.sh | Question 11 | Secrets in ETCD
Task weight: 7%
Use context: kubectl config use-context workload-prod
There is an existing Secret called database-access in Namespace team-green .
Read the complete Secret content directly from ETCD (using etcdctl ) and store it into /opt/course/11/etcd-secret-content . Write the plain and decoded Secret’s value of key “pass” into /opt/course/11/database-password .
译文
任务权重:7%。
使用环境:kubectl config use-context workload-prod
在命名空间 team-green 中有一个名为 data-access 的现有 Secret。
直接从 ETCD 读取完整的 Secret 内容(使用 etcdctl ),并将其存储到 /opt/course/11/etcd-secret-content 。在/opt/course/11/database-password 中写入纯文本和解码的Secret的密钥 “pass “的值。
解答
进入控制节点,然后检查是否安装了etcdctl
ssh cluster1-controlplane1 |
查询证书密钥相关的文件
cat /etc/kubernetes/manifests/kube-apiserver.yaml | grep etcd |
输出结果 |
通过上面的结果进行secret的查询
ETCDCTL_API=3 etcdctl \ |
查询路径 /registry/{type}/{namespace}/{name}
把结果写入文件
# /opt/course/11/etcd-secret-content |
解码pass的值并写入文件
echo Y29uZmlkZW50aWFs | base64 -d > /opt/course/11/database-password |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Hao DevSecOps!
评论



