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 <eric_ernst@apple.com>
This commit is contained in:
Eric Ernst 2021-04-27 08:03:07 -07:00
parent 12a65d2359
commit 05c224c3d4
2 changed files with 16 additions and 3 deletions

View File

@ -36,10 +36,11 @@ $ kubectl apply -k kata-deploy/overlays/k3s
### Run a sample workload ### Run a sample workload
Workloads which utilize Kata can node-select based on `katacontainers.io/kata-runtime=true`, and are Workloads specify the runtime they'd like to utilize by setting the appropriate `runtimeClass` object within
run through an applicable runtime if they are marked with the appropriate `runtimeClass` object. 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 ```sh
$ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata-deploy/runtimeclasses $ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata-deploy/runtimeclasses
$ kubectl apply -f kata-runtimeClasses.yaml $ kubectl apply -f kata-runtimeClasses.yaml

View File

@ -8,6 +8,9 @@ overhead:
podFixed: podFixed:
memory: "160Mi" memory: "160Mi"
cpu: "250m" cpu: "250m"
scheduling:
nodeSelector:
katacontainers.io/kata-runtime: "true"
--- ---
kind: RuntimeClass kind: RuntimeClass
apiVersion: node.k8s.io/v1beta1 apiVersion: node.k8s.io/v1beta1
@ -18,6 +21,9 @@ overhead:
podFixed: podFixed:
memory: "160Mi" memory: "160Mi"
cpu: "250m" cpu: "250m"
scheduling:
nodeSelector:
katacontainers.io/kata-runtime: "true"
--- ---
kind: RuntimeClass kind: RuntimeClass
apiVersion: node.k8s.io/v1beta1 apiVersion: node.k8s.io/v1beta1
@ -28,6 +34,9 @@ overhead:
podFixed: podFixed:
memory: "130Mi" memory: "130Mi"
cpu: "250m" cpu: "250m"
scheduling:
nodeSelector:
katacontainers.io/kata-runtime: "true"
--- ---
kind: RuntimeClass kind: RuntimeClass
apiVersion: node.k8s.io/v1beta1 apiVersion: node.k8s.io/v1beta1
@ -38,3 +47,6 @@ overhead:
podFixed: podFixed:
memory: "130Mi" memory: "130Mi"
cpu: "250m" cpu: "250m"
scheduling:
nodeSelector:
katacontainers.io/kata-runtime: "true"