CKS 考试题整理 (05)-Container 安全上下文

发布时间 2023-06-16 16:52:51作者: 打工人,打工魂

Context

Container Security Context 应在特定 namespace 中修改 Deployment。

Task

按照如下要求修改 sec-ns 命名空间里的 Deployment secdep

  1. 用ID为30000 的用户启动容器(设置用户ID为:30000)
  2. 不允许进程获得超出父进程的特权(禁止 allowPrivilegeEscalation)
  3. 以只读方式加载容器的根文件系统(对根文件的只读权限)

 

参考资料

https://kubernetes.io/zh-cn/docs/tasks/configure-pod-container/security-context/

解答

切换集群

kubectl config use-context KSMV00102

 

按照题目要求,在线修改

kubectl -n sec-ns edit deployment secdep

 

解答

切换集群

kubectl config use-context KSMV00102

 

按照题目要求,在线修改

kubectl -n sec-ns edit deployment secdep

 

在template 字段下面的spec里面,添加红字内容