diff options
author | Ian Lewis <ianlewis@google.com> | 2019-12-06 06:39:35 +0900 |
---|---|---|
committer | Fabricio Voznika <fvoznika@google.com> | 2019-12-05 13:39:35 -0800 |
commit | 757adfa287c17d925aec7976a86986bd5b52229c (patch) | |
tree | 9ff6d8c3422a3ce4ca9d1f5929a8bbb780f96f4e | |
parent | 1547f2451927d95f9da1a24479e57a47405dc1ed (diff) |
Add docs for Kubernetes Runtime Class. (#33)
Adds doc to explicitly create the Kubernetes RuntimeClass object needed
to use the shim via the Kubernetes API.
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | docs/runtime-handler-quickstart.md | 45 | ||||
-rw-r--r-- | docs/runtime-handler-shim-v2-quickstart.md | 45 | ||||
-rwxr-xr-x | test/e2e/runtimeclass-install.sh | 33 |
4 files changed, 125 insertions, 2 deletions
@@ -13,8 +13,8 @@ gvisor-containerd-shim is a containerd shim for [gVisor](https://github.com/goog ## Installation - [Untrusted Workload Quick Start (containerd >=1.1)](docs/untrusted-workload-quickstart.md) -- [Runtime Handler Quick Start (containerd >=1.2)](docs/runtime-handler-quickstart.md) -- [Runtime Handler Quick Start (shim v2) (containerd >=1.2)](docs/runtime-handler-shim-v2-quickstart.md) +- [Runtime Handler/RuntimeClass Quick Start (containerd >=1.2)](docs/runtime-handler-quickstart.md) +- [Runtime Handler/RuntimeClass Quick Start (shim v2) (containerd >=1.2)](docs/runtime-handler-shim-v2-quickstart.md) # Contributing diff --git a/docs/runtime-handler-quickstart.md b/docs/runtime-handler-quickstart.md index e48b2dd1a..684390b55 100644 --- a/docs/runtime-handler-quickstart.md +++ b/docs/runtime-handler-quickstart.md @@ -204,3 +204,48 @@ sudo crictl inspect ${CONTAINER_ID} sudo crictl exec ${CONTAINER_ID} dmesg | grep -i gvisor } ``` + +### Set up the Kubernetes Runtime Class + +1. Install the Runtime Class for gVisor + +[embedmd]:# (../test/e2e/runtimeclass-install.sh shell /{ # Step 1/ /^}/) +```shell +{ # Step 1: Install a RuntimeClass +cat <<EOF | kubectl apply -f - +apiVersion: node.k8s.io/v1beta1 +kind: RuntimeClass +metadata: + name: gvisor +handler: runsc +EOF +} +``` + +2. Create a Pod with the gVisor Runtime Class + +[embedmd]:# (../test/e2e/runtimeclass-install.sh shell /{ # Step 2/ /^}/) +```shell +{ # Step 2: Create a pod +cat <<EOF | kubectl apply -f - +apiVersion: v1 +kind: Pod +metadata: + name: nginx-gvisor +spec: + runtimeClassName: gvisor + containers: + - name: nginx + image: nginx +EOF +} +``` + +3. Verify that the Pod is running + +[embedmd]:# (../test/e2e/runtimeclass-install.sh shell /{ # Step 3/ /^}/) +```shell +{ # Step 3: Get the pod +kubectl get pod nginx-gvisor -o wide +} +``` diff --git a/docs/runtime-handler-shim-v2-quickstart.md b/docs/runtime-handler-shim-v2-quickstart.md index f5253074d..ca8336089 100644 --- a/docs/runtime-handler-shim-v2-quickstart.md +++ b/docs/runtime-handler-shim-v2-quickstart.md @@ -185,3 +185,48 @@ sudo crictl inspect ${CONTAINER_ID} sudo crictl exec ${CONTAINER_ID} dmesg | grep -i gvisor } ``` + +### Set up the Kubernetes Runtime Class + +1. Install the Runtime Class for gVisor + +[embedmd]:# (../test/e2e/runtimeclass-install.sh shell /{ # Step 1/ /^}/) +```shell +{ # Step 1: Install a RuntimeClass +cat <<EOF | kubectl apply -f - +apiVersion: node.k8s.io/v1beta1 +kind: RuntimeClass +metadata: + name: gvisor +handler: runsc +EOF +} +``` + +2. Create a Pod with the gVisor Runtime Class + +[embedmd]:# (../test/e2e/runtimeclass-install.sh shell /{ # Step 2/ /^}/) +```shell +{ # Step 2: Create a pod +cat <<EOF | kubectl apply -f - +apiVersion: v1 +kind: Pod +metadata: + name: nginx-gvisor +spec: + runtimeClassName: gvisor + containers: + - name: nginx + image: nginx +EOF +} +``` + +3. Verify that the Pod is running + +[embedmd]:# (../test/e2e/runtimeclass-install.sh shell /{ # Step 3/ /^}/) +```shell +{ # Step 3: Get the pod +kubectl get pod nginx-gvisor -o wide +} +``` diff --git a/test/e2e/runtimeclass-install.sh b/test/e2e/runtimeclass-install.sh new file mode 100755 index 000000000..28abbcd00 --- /dev/null +++ b/test/e2e/runtimeclass-install.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# A sample script to test installing a RuntimeClass + +set -ex + +{ # Step 1: Install a RuntimeClass +cat <<EOF | kubectl apply -f - +apiVersion: node.k8s.io/v1beta1 +kind: RuntimeClass +metadata: + name: gvisor +handler: runsc +EOF +} + +{ # Step 2: Create a pod +cat <<EOF | kubectl apply -f - +apiVersion: v1 +kind: Pod +metadata: + name: nginx-gvisor +spec: + runtimeClassName: gvisor + containers: + - name: nginx + image: nginx +EOF +} + +{ # Step 3: Get the pod +kubectl get pod nginx-gvisor -o wide +} |