forked from kata-containers/kata-containers
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a containerd installation guide. Fixes: kata-containers#738. Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
- Loading branch information
1 parent
059e642
commit a21aa4b
Showing
1 changed file
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# Install Kata Containers with containerd | ||
|
||
1. Perform initial checks | ||
|
||
Check to see if Kata Containers is already installed: | ||
|
||
```bash | ||
$ command -v kata-runtime &>/dev/null && { echo >&2 "ERROR: Please remove existing Kata Containers installation"; exit 1; } | ||
``` | ||
|
||
1. Install dependencies | ||
|
||
```bash | ||
$ source /etc/os-release || source /usr/lib/os-release | ||
$ packages='containerd curl git jq' | ||
$ case "$ID" in | ||
$ ubuntu) sudo apt-get -y install $packages ;; | ||
$ *) echo >&2 "ERROR: Unsupported distro: $ID"; exit 1 ;; | ||
$ esac | ||
``` | ||
1. Install Kata Containers | ||
```bash | ||
$ tmpdir=$(mktemp -d) | ||
$ pushd "$tmpdir" &>/dev/null | ||
$ url="https://api.github.com/repos/kata-containers/runtime/releases/latest" | ||
$ full_url=$(curl -sL "$url" | jq -r '.assets[0].browser_download_url') | ||
$ arch=$(uname -m) | ||
$ echo "$full_url" | grep -q "$arch" || { echo >&2 "ERROR: No Kata Containers package for $arch architecture"; exit 1; } | ||
$ curl -LO "$full_url" | ||
$ file=$(echo "$full_url" | awk -F\/ '{print $NF}') | ||
$ sudo tar -C / -xvf "./${file}" | ||
$ popd &>/dev/null | ||
``` | ||
Show version details: | ||
```bash | ||
$ export PATH=$PATH:/opt/kata/bin | ||
$ kata-runtime --version | ||
``` | ||
1. Configure containerd | ||
Stop the service to allow the configuration to be modified: | ||
```bash | ||
$ sudo systemctl stop containerd | ||
``` | ||
Backup the original containerd configuration: | ||
```bash | ||
$ cfg="/etc/containerd/config.toml" | ||
$ sudo grep -q "io.containerd.kata.v2" "$cfg" || sudo cp "$cfg" "${cfg}.ORIGINAL" | ||
``` | ||
Add the Kata Containers configuration details: | ||
```bash | ||
$ sudo grep -q "io.containerd.kata.v2" "$cfg" || cat <<EOT | sudo tee -a "$cfg" | ||
$ [plugins] | ||
[plugins.cri] | ||
[plugins.cri.containerd] | ||
no_pivot = false | ||
default_runtime_name = "kata" | ||
[plugins.cri.containerd.runtimes.kata] | ||
runtime_type = "io.containerd.kata.v2" | ||
[plugins.linux] | ||
shim = "/usr/bin/containerd-shim" | ||
shim_debug = true | ||
EOT | ||
``` | ||
Allow the containerd service to find the Kata shim: | ||
```bash | ||
$ sudo ln -sf /opt/kata/bin/containerd-shim-kata-v2 /usr/bin/ | ||
``` | ||
Restart the service: | ||
```bash | ||
$ sudo systemctl restart containerd | ||
``` | ||
1. Run Kata Containers | ||
You are now ready to run Kata Containers: | ||
```bash | ||
$ image="docker.io/library/busybox:latest" | ||
$ sudo ctr image pull "$image" | ||
$ sudo ctr run --runtime "io.containerd.kata.v2" --rm -t "$image" test-kata uname -m | ||
``` | ||
The previous command shows details of the kernel version running inside the | ||
container, which is different to the host kernel version. |