CKA 模拟真题 Killer.sh | Question 16 | Namespaces and Api Resources
Use context: kubectl config use-context k8s-c1-H
Write the names of all namespaced Kubernetes resources (like Pod, Secret, ConfigMap…) into /opt/course/16/resources.txt .
Find the project-* Namespace with the highest number of Roles defined in it and write its name and amount of Roles into /opt/course/16/crowded-namespace.txt .
译文
将所有命名的 Kubernetes 资源(如 Pod、Secret、ConfigMap……)的名称写入 /opt/course/16/resources.txt 中。
查找定义角色数量最多的 *project-*** 命名空间,并将其名称和角色数量写入 /opt/course/16/crowded-namespace.txt 中。
解答
bash
kubectl config use-context k8s-c1-H |
将被命名的资源写入文件
bash
k api-resources --namespaced -o name > /opt/course/16/resources.txt |
file
检查命名空间中角色数量 通过脚本循环检查
bash
for i in `k get ns -o name | cut -d / -f 2` ; do echo $i ; k -n $i get role --no-headers | wc -l; done |
file
vim /opt/course/16/crowded-namespace.txt
yaml
project-c14 with 300 resources |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Hao DevSecOps!
评论



