You can create Kubernetes runtime classes to specify whether containers
should be run as the default runtime, runc, or
using kata-runtime. The examples in this book
use the name native to specify the use of
runc, and the name
kata-containers to specify the use of
kata-runtime. You can use any name you like.
To create a runtime class:
Create a file for a runtime class for Kata Containers named
kata-runtime.yamlwith the following contents:kind: RuntimeClass apiVersion: node.k8s.io/v1beta1 metadata: name: kata-containers handler: kataLoad the runtime class to the Kubernetes deployment:
$
kubectl apply -f kata-runtime.yamlThe runtime class
kata-containerscan now be used in pod configuration files to specify a container should be run as a Kata container, using thekata-containersruntime. For examples of creating pods using this runtime class, see Section 3.3, “Creating Kata Containers”.(Optional) If you want to specify a runtime for
runc, you can do this in a similar way. This is an optional configuration step. Asruncis the default runtime, pods automatically run usingruncunless you specify otherwise. This file is namedrunc-runtime.yaml:kind: RuntimeClass apiVersion: node.k8s.io/v1beta1 metadata: name: native handler: runcLoad the runtime class to the Kubernetes deployment:
$
kubectl apply -f runc-runtime.yamlThe runtime class
nativecan be used in pod configuration files to specify a container should be run as a runC container, using theruncruntime.You can see a list of the available runtime classes for a Kubernetes cluster using the kubectl get runtimeclass. For example:
$
kubectl get runtimeclassNAME CREATED AT kata-containers 2019-09-11T06:48:12Z native 2019-09-11T07:08:56Z

