CKS 模拟真题 Killer.sh | Question 9 | AppArmor Profile
Task weight: 3%
Use context: kubectl config use-context workload-prod
Some containers need to run more secure and restricted. There is an existing AppArmor profile located at /opt/course/9/profile for this.
- Install the AppArmor profile on Node
cluster1-node1. Connect usingssh cluster1-node1. - Add label
security=apparmorto the Node - Create a Deployment named apparmor in Namespace
defaultwith:- One replica of image
nginx:1.19.2 - NodeSelector for
security=apparmor - Single container named
c1with the AppArmor profile enabled
- One replica of image
The Pod might not run properly with the profile enabled. Write the logs of the Pod into /opt/course/9/logs so another team can work on getting the application running.
译文
任务权重:3%。
使用环境: kubectl config use-context workload-prod
有些容器需要更安全地运行,并受到限制。在 /opt/course/9/profile 中有一个现有的AppArmor 配置文件,用于此。
- 在node
cluster1-node1上安装 AppArmor 配置文件。使用ssh cluster1-node1连接。 - 在节点上添加标签
security=apparmor - 在名称空间 default 中创建一个名为
apparmor的 Deployment ,其中包括。- image 为
nginx:1.19.2 - NodeSelector 为
security=apparmor - 启用AppArmor配置 单一容器名为
c1
- image 为
启用配置文件后,Pod可能无法正常运行。将Pod的日志写入 /opt/course/9/logs ,这样另一个团队就可以努力让应用程序运行。
参考
https://kubernetes.io/docs/tutorials/clusters/apparmor
解答
1
检查配置文件, 并把配置文件复制到要部署的节点
vim /opt/course/9/profile |
# /opt/course/9/profile |
scp /opt/course/9/profile cluster1-node1:~/ |
登陆cluster1-node1 进行部署 apparmor配置文件
ssh cluster1-node1 |
2
检查node标签,并给node打标签
k label -h |
3
创建一个deploy 配置文件并进行编辑
k create deploy apparmor --image=nginx:1.19.2 $do > 9_deploy.yaml |
# 9_deploy.yaml |
创建deploy
k -f 9_deploy.yaml create |
检查调度情况和日志,已调度到对应节点,
k get pod -owide | grep apparmor |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Hao DevSecOps!
评论



