欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 汽车 > 时评 > [CKS] K8S RuntimeClass SetUp

[CKS] K8S RuntimeClass SetUp

2026/1/31 17:36:32 来源:https://blog.csdn.net/agjllxchjy/article/details/143664067  浏览:    关键词:[CKS] K8S RuntimeClass SetUp

最近准备花一周的时间准备CKS考试,在准备考试中发现有一个题目关于RuntimeClass创建和挂载的题目。

​ 专栏其他文章:

  • [CKS] Create/Read/Mount a Secret in K8S-CSDN博客
  • [CKS] Audit Log Policy-CSDN博客
    -[CKS] 利用falco进行容器日志捕捉和安全监控-CSDN博客
  • [CKS] K8S NetworkPolicy Set Up-CSDN博客
  • [CKS] K8S AppArmor Set Up-CSDN博客
  • [CKS] 利用Trivy对image进行扫描-CSDN博客
  • [CKS] kube-batch修复不安全项-CSDN博客
  • [CKS] K8S ServiceAccount Set Up-CSDN博客
  • [CKS] K8S Admission Set Up-CSDN博客
  • [CKS] K8S Dockerfile和yaml文件安全检测-CSDN博客
  • CKS真题
  • CKA真题

What’s the RuntimeClass

参见官方文档: https://v1-28.docs.kubernetes.io/docs/concepts/containers/runtime-class/

Question 1

Create a RuntimeClass called sandbox that uses the preconfigured runsc runtime for untrusted workloads.

这个题要求我们创建一个叫做sandbox的runtimeclass,他的handler是runsc

Practice

  • 编辑/创建 sandbox.yml,文件内容如下:
    在这里插入图片描述
  • 创建RuntimeClass
kubectl create -f sandbox.yml

Question 2

Configure all Pods in the sunnydale namespace to use gVisor.

这个题要求我们将sunnydale下面所有的pod配置上gVisor,这就是我们刚才创建的runtimeClass

Practice

  • 查看sunnydale下面的所有的pod,kubectl get pod -n sunnydale,通过这个我们可以看到所有的pod是通过deployment创建的
    在这里插入图片描述
    这时,我们就需要对每个deployment来进行修改使用这个runtimeClass,通过kubectl get deployment -n sunnydale可以看到这个下面的所有的deployment:
    在这里插入图片描述

  • 编辑所有deployment, kubectl edit deployment -n sunnydale xxx,在deployment中添加如下内容:

spec:template:spec:runtimeClassName: sandbox

配置每个container的runtimeClassNamesandbox

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com