diff --git a/tools/packaging/kata-deploy/README.md b/tools/packaging/kata-deploy/README.md index ec6a7c3e22..084b523c35 100644 --- a/tools/packaging/kata-deploy/README.md +++ b/tools/packaging/kata-deploy/README.md @@ -36,51 +36,22 @@ $ 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` annotation. +run through an applicable runtime if they are marked with the appropriate `runtimeClass` object. -`runtimeClass` is a built-in type in Kubernetes versions 1.14 and greater. In Kubernetes 1.13, `runtimeClass` -is defined through a custom resource definition. For Kubernetes 1.13: +`runtimeClass` is a built-in type in Kubernetes. To apply the Kata runtimeclasses: ```sh - $ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata-deploy/k8s-1.13 - $ kubectl apply -f runtimeclass-crd.yaml + $ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata-deploy/runtimeclasses + $ kubectl apply -f kata-runtimeClasses.yaml ``` -In order to use a workload Kata with QEMU, first add a `RuntimeClass` as: -- For Kubernetes 1.14: - ```sh - $ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata-deploy/k8s-1.14 - $ kubectl apply -f kata-qemu-runtimeClass.yaml - ``` - -- For Kubernetes 1.13: - ```sh - $ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata-deploy/k8s-1.13 - $ kubectl apply -f kata-qemu-runtimeClass.yaml - ``` - - -In order to use a workload Kata with Firecracker, first add a `RuntimeClass` as: -- For Kubernetes 1.14: - ```sh - $ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata-deploy/k8s-1.14 - $ kubectl apply -f kata-fc-runtimeClass.yaml - ``` - -- For Kubernetes 1.13: - ```sh - $ cd $GOPATH/src/github.com/kata-containers/kata-containers/tools/packaging/kata-deploy/k8s-1.13 - $ kubectl apply -f kata-fc-runtimeClass.yaml - ``` - -The following YAML snippet shows how to specify a workload should use Kata with QEMU: +The following YAML snippet shows how to specify a workload should use Kata with Cloud Hypervisor: ```yaml spec: template: spec: - runtimeClassName: kata-qemu + runtimeClassName: kata-clh ``` The following YAML snippet shows how to specify a workload should use Kata with Firecracker: @@ -92,6 +63,15 @@ spec: runtimeClassName: kata-fc ``` +The following YAML snippet shows how to specify a workload should use Kata with QEMU: + +```yaml +spec: + template: + spec: + runtimeClassName: kata-qemu +``` + To run an example with `kata-qemu`: ```sh @@ -122,6 +102,7 @@ $ kubectl delete -f kata-deploy/base/kata-deploy.yaml $ kubectl apply -f kata-cleanup/base/kata-cleanup.yaml $ kubectl delete -f kata-cleanup/base/kata-cleanup.yaml $ kubectl delete -f kata-rbac/base/kata-rbac.yaml +$ kubectl delete -f runtimeclasses/kata-runtimeClasses.yaml ``` ## `kata-deploy` details @@ -151,9 +132,9 @@ applying labels to the nodes. This DaemonSet installs the necessary Kata binaries, configuration files, and virtual machine artifacts on the node. Once installed, the DaemonSet adds a node label `katacontainers.io/kata-runtime=true` and reconfigures -either CRI-O or containerd to register two `runtimeClasses`: `kata-qemu` (for QEMU isolation) and `kata-fc` (for Firecracker isolation). -As a final step the DaemonSet restarts either CRI-O or containerd. Upon deletion, the DaemonSet removes the -Kata binaries and VM artifacts and updates the node label to `katacontainers.io/kata-runtime=cleanup`. +either CRI-O or containerd to register three `runtimeClasses`: `kata-clh` (for Cloud Hypervisor isolation), `kata-qemu` (for QEMU isolation), +and `kata-fc` (for Firecracker isolation). As a final step the DaemonSet restarts either CRI-O or containerd. Upon deletion, +the DaemonSet removes the Kata binaries and VM artifacts and updates the node label to `katacontainers.io/kata-runtime=cleanup`. #### Kata cleanup diff --git a/tools/packaging/kata-deploy/k8s-1.13/kata-clh-runtimeClass.yaml b/tools/packaging/kata-deploy/k8s-1.13/kata-clh-runtimeClass.yaml deleted file mode 100644 index 6e17d040f1..0000000000 --- a/tools/packaging/kata-deploy/k8s-1.13/kata-clh-runtimeClass.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -kind: RuntimeClass -apiVersion: node.k8s.io/v1alpha1 -metadata: - name: kata-clh -spec: - runtimeHandler: kata-clh diff --git a/tools/packaging/kata-deploy/k8s-1.13/kata-fc-runtimeClass.yaml b/tools/packaging/kata-deploy/k8s-1.13/kata-fc-runtimeClass.yaml deleted file mode 100644 index 0d445b557a..0000000000 --- a/tools/packaging/kata-deploy/k8s-1.13/kata-fc-runtimeClass.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -kind: RuntimeClass -apiVersion: node.k8s.io/v1alpha1 -metadata: - name: kata-fc -spec: - runtimeHandler: kata-fc diff --git a/tools/packaging/kata-deploy/k8s-1.13/kata-qemu-runtimeClass.yaml b/tools/packaging/kata-deploy/k8s-1.13/kata-qemu-runtimeClass.yaml deleted file mode 100644 index d53ac7d910..0000000000 --- a/tools/packaging/kata-deploy/k8s-1.13/kata-qemu-runtimeClass.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -kind: RuntimeClass -apiVersion: node.k8s.io/v1alpha1 -metadata: - name: kata-qemu -spec: - runtimeHandler: kata-qemu ---- -kind: RuntimeClass -apiVersion: node.k8s.io/v1alpha1 -metadata: - name: kata -spec: - runtimeHandler: kata diff --git a/tools/packaging/kata-deploy/k8s-1.13/runtimeclass-crd.yaml b/tools/packaging/kata-deploy/k8s-1.13/runtimeclass-crd.yaml deleted file mode 100644 index cbb09740e2..0000000000 --- a/tools/packaging/kata-deploy/k8s-1.13/runtimeclass-crd.yaml +++ /dev/null @@ -1,26 +0,0 @@ -kind: CustomResourceDefinition -apiVersion: apiextensions.k8s.io/v1beta1 -metadata: - name: runtimeclasses.node.k8s.io - labels: - addonmanager.kubernetes.io/mode: Reconcile -spec: - group: node.k8s.io - version: v1alpha1 - versions: - - name: v1alpha1 - served: true - storage: true - names: - plural: runtimeclasses - singular: runtimeclass - kind: RuntimeClass - scope: Cluster - validation: - openAPIV3Schema: - properties: - spec: - properties: - runtimeHandler: - type: string - pattern: '^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*)?$' diff --git a/tools/packaging/kata-deploy/k8s-1.14/kata-clh-runtimeClass.yaml b/tools/packaging/kata-deploy/k8s-1.14/kata-clh-runtimeClass.yaml deleted file mode 100644 index 91f7ebaaa3..0000000000 --- a/tools/packaging/kata-deploy/k8s-1.14/kata-clh-runtimeClass.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -kind: RuntimeClass -apiVersion: node.k8s.io/v1beta1 -metadata: - name: kata-clh -handler: kata-clh diff --git a/tools/packaging/kata-deploy/k8s-1.14/kata-fc-runtimeClass.yaml b/tools/packaging/kata-deploy/k8s-1.14/kata-fc-runtimeClass.yaml deleted file mode 100644 index dc019883fd..0000000000 --- a/tools/packaging/kata-deploy/k8s-1.14/kata-fc-runtimeClass.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: RuntimeClass -apiVersion: node.k8s.io/v1beta1 -metadata: - name: kata-fc -handler: kata-fc diff --git a/tools/packaging/kata-deploy/k8s-1.14/kata-qemu-runtimeClass.yaml b/tools/packaging/kata-deploy/k8s-1.14/kata-qemu-runtimeClass.yaml deleted file mode 100644 index b5f75f0e25..0000000000 --- a/tools/packaging/kata-deploy/k8s-1.14/kata-qemu-runtimeClass.yaml +++ /dev/null @@ -1,12 +0,0 @@ ---- -kind: RuntimeClass -apiVersion: node.k8s.io/v1beta1 -metadata: - name: kata -handler: kata ---- -kind: RuntimeClass -apiVersion: node.k8s.io/v1beta1 -metadata: - name: kata-qemu -handler: kata-qemu diff --git a/tools/packaging/kata-deploy/k8s-1.18/kata-runtimeClasses.yaml b/tools/packaging/kata-deploy/runtimeclasses/kata-runtimeClasses.yaml similarity index 100% rename from tools/packaging/kata-deploy/k8s-1.18/kata-runtimeClasses.yaml rename to tools/packaging/kata-deploy/runtimeclasses/kata-runtimeClasses.yaml