summaryrefslogtreecommitdiffhomepage
path: root/g3doc/user_guide/runtimeclass.md
blob: 2e2d997be9885a6de19600067ea19ff60243d4ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# RuntimeClass

First, follow the appropriate installation instructions for your version of
containerd.

*   For 1.1 or lower, use `gvisor-containerd-shim`.
*   For 1.2 or higher, use `containerd-shim-runsc-v1`.

# Set up the Kubernetes RuntimeClass

Creating the [RuntimeClass][runtimeclass] in Kubernetes is simple once the
runtime is available for containerd:

```shell
cat <<EOF | kubectl apply -f -
apiVersion: node.k8s.io/v1beta1
kind: RuntimeClass
metadata:
  name: gvisor
handler: runsc
EOF
```

Pods can now be created using this RuntimeClass:

```shell
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
  name: nginx-gvisor
spec:
  runtimeClassName: gvisor
  containers:
  - name: nginx
    image: nginx
EOF
```

You can verify that the Pod is running via this RuntimeClass:

```shell
kubectl get pod nginx-gvisor -o wide
```

[runtimeclass]:  https://kubernetes.io/docs/concepts/containers/runtime-class/