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*** 。


解答:
kubectl config use-context k8s-c1-H

将被命名的资源写入文件

k api-resources --namespaced -o name > /opt/course/16/resources.txt

file

检查命名空间中角色数量 通过脚本循环检查

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

project-c14 with 300 resources

Killer.sh CKA模拟题目 汇总