Context
该 cluster 使用 containerd 作为 CRI 运行时。containerd 的默认运行时处理程序是 runc 。 containerd 已准备好支持额外的运行时处理程序 runsc (gVisor)。
Task
使用名为 runsc 的现有运行时处理程序,创建一个名为 untrusted 的 RuntimeClass。 更新 namespace server 中的所有 Pod 以在 gVisor 上运行。 您可以在 /cks/gVisor/rc.yaml 中找到一个模版清单。
解:
apiVersion: node.k8s.io/v1
kind: RuntimeClass
metadata:
kubernetes.io 搜索 runtimeclass
# 修改runtimeclass配置
vim /cks/gVisor/rc.yaml
# 应用配置
kubectl apply -f /cks/gVisor/rc.yaml
# 验证
kubectl get runtimeclass
# 查看server资源
kubectl get all -n server
# 查看runtimeclass这个参数在deployment参数的位置
kubectl explain deployment.spec.template.spec | grep runtime
# 修改deployment
kubectl edit deploy busybox-run -n server
kubectl edit deploy nginx-host -n server
kubectl edit deploy run-test -n server