CKS 题库 13、Container安全上下文
Context
Container Security Context应在特定namespace中修改Deployment。
Task
按照如下要求修改 sec-ns 命名空间里的 Deployment secdep
- 用ID为
30000的用户启动容器(设置用户ID为: 30000) - 不允许进程获得超出其父进程的特权(禁止
allowPrivilegeEscalation) - 以只读方式加载容器的根文件系统(对根文件的
只读权限)
参考
https://kubernetes.io/zh-cn/docs/tasks/configure-pod-container/security-context/
解答w
切换集群
kubectl config use-context KSMV00102 |
修改 deployment secdep
kubectl -n sec-ns edit deployment secdep |
在template字段下面的spec里面,添加或修改如下红字内容,并保存(考试中也是在Deployment下有两个image的) 请注意,考试和模拟环境中,先检查spec下面(非containers下面)是否有securityContext: {},如果有则可以直接修改即可。否则重复添加是不生效的。
securityContext: |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Hao DevSecOps!
评论



