From 05c224c3d4ddf0ea995c5052c0ad94397fa6a17b Mon Sep 17 00:00:00 2001 From: Eric Ernst Date: Tue, 27 Apr 2021 08:03:07 -0700 Subject: [PATCH] runtimeclass: add nodeSelector To ensure we run on nodes which have Kata installed, let's add the nodeSelector to the runtimeclass definition, and have it match the label that we applied during installation of the kata artifacts. Signed-off-by: Eric Ernst --- tools/packaging/kata-deploy/README.md | 7 ++++--- .../runtimeclasses/kata-runtimeClasses.yaml | 12 ++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tools/packaging/kata-deploy/README.md b/tools/packaging/kata-deploy/README.md index 084b523c3..cc09ea31b 100644 --- a/tools/packaging/kata-deploy/README.md +++ b/tools/packaging/kata-deploy/README.md @@ -36,10 +36,11 @@ $ kubectl apply -k kata-deploy/overlays/k3s ### Run a sample workload -Workloads which utilize Kata can node-select based on `katacontainers.io/kata-runtime=true`, and are -run through an applicable runtime if they are marked with the appropriate `runtimeClass` object. +Workloads specify the runtime they'd like to utilize by setting the appropriate `runtimeClass` object within +the `Pod` specification. The `runtimeClass` examples provided define a node selector to match node label `katacontainers.io/kata-runtime:"true"`, +which will ensure the workload is only scheduled on a node that has Kata Containers installed -`runtimeClass` is a built-in type in Kubernetes. To apply the Kata runtimeclasses: +`runtimeClass` is a built-in type in Kubernetes. To apply each Kata Containers `runtimeClass`: ```sh $ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata-deploy/runtimeclasses $ kubectl apply -f kata-runtimeClasses.yaml diff --git a/tools/packaging/kata-deploy/runtimeclasses/kata-runtimeClasses.yaml b/tools/packaging/kata-deploy/runtimeclasses/kata-runtimeClasses.yaml index a696e3b3f..fd8bc858b 100644 --- a/tools/packaging/kata-deploy/runtimeclasses/kata-runtimeClasses.yaml +++ b/tools/packaging/kata-deploy/runtimeclasses/kata-runtimeClasses.yaml @@ -8,6 +8,9 @@ overhead: podFixed: memory: "160Mi" cpu: "250m" +scheduling: + nodeSelector: + katacontainers.io/kata-runtime: "true" --- kind: RuntimeClass apiVersion: node.k8s.io/v1beta1 @@ -18,6 +21,9 @@ overhead: podFixed: memory: "160Mi" cpu: "250m" +scheduling: + nodeSelector: + katacontainers.io/kata-runtime: "true" --- kind: RuntimeClass apiVersion: node.k8s.io/v1beta1 @@ -28,6 +34,9 @@ overhead: podFixed: memory: "130Mi" cpu: "250m" +scheduling: + nodeSelector: + katacontainers.io/kata-runtime: "true" --- kind: RuntimeClass apiVersion: node.k8s.io/v1beta1 @@ -38,3 +47,6 @@ overhead: podFixed: memory: "130Mi" cpu: "250m" +scheduling: + nodeSelector: + katacontainers.io/kata-runtime: "true"