mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-28 08:17:37 +00:00
kata-deploy: Remove kata-deploy-docker.sh
Kata Containers 2.x is not supported outside of the kubernetes world. With this in mind, let's remove leftovers from the 1.x deployments & documentation. Fixes: #1356 Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
parent
38b5a43267
commit
62cbaf4de4
@ -1,9 +1,5 @@
|
||||
# `kata-deploy`
|
||||
|
||||
* [Docker quick start](#docker-quick-start)
|
||||
* [Install Kata and configure Docker](#install-kata-and-configure-docker)
|
||||
* [Run a sample workload utilizing Kata containers](#run-a-sample-workload-utilizing-kata-containers)
|
||||
* [Remove Kata](#remove-kata)
|
||||
* [Kubernetes quick start](#kubernetes-quick-start)
|
||||
* [Install Kata on a running Kubernetes cluster](#install-kata-on-a-running-kubernetes-cluster)
|
||||
* [Run a sample workload](#run-a-sample-workload)
|
||||
@ -16,56 +12,11 @@
|
||||
|
||||
[`kata-deploy`](.) provides a Dockerfile, which contains all of the binaries
|
||||
and artifacts required to run Kata Containers, as well as reference DaemonSets, which can
|
||||
be utilized to install Kata Containers for both Docker and on a running Kubernetes cluster.
|
||||
be utilized to install Kata Containers on a running Kubernetes cluster.
|
||||
|
||||
Note, installation through DaemonSets successfully installs `katacontainers.io/kata-runtime` on
|
||||
a node only if it uses either containerd or CRI-O CRI-shims.
|
||||
|
||||
## Docker quick start
|
||||
|
||||
The `kata-deploy` container image makes use of a script, `kata-deploy-docker`, for installation of
|
||||
Kata artifacts and configuration of Docker to utilize the runtime. The following volumes are required to be mounted
|
||||
to aid in this:
|
||||
- `/opt/kata`: this is where all Kata artifacts are installed on the system
|
||||
- `/var/run/dbus`, `/run/systemd`: this is require for reloading the the Docker service
|
||||
- `/etc/docker`: this is required for updating `daemon.json` in order to configure the Kata runtimes in Docker
|
||||
|
||||
|
||||
### Install Kata and configure Docker
|
||||
|
||||
To install:
|
||||
|
||||
```sh
|
||||
$ docker run -v /opt/kata:/opt/kata -v /var/run/dbus:/var/run/dbus -v /run/systemd:/run/systemd -v /etc/docker:/etc/docker -it katadocker/kata-deploy kata-deploy-docker install
|
||||
```
|
||||
|
||||
Once complete, `/etc/docker/daemon.json` is updated or created to include the Kata runtimes: `kata-qemu` and `kata-fc`, for utilizing
|
||||
QEMU and Firecracker, respectively, for the VM isolation layer.
|
||||
|
||||
### Run a sample workload utilizing Kata containers
|
||||
|
||||
Run a QEMU QEMU isolated Kata container:
|
||||
|
||||
```sh
|
||||
$ docker run --runtime=kata-qemu -itd alpine
|
||||
```
|
||||
|
||||
Run a Firecracker isolated Kata container:
|
||||
|
||||
```sh
|
||||
$ docker run --runtime=kata-fc -itd alpine
|
||||
```
|
||||
|
||||
### Remove Kata
|
||||
|
||||
To uninstall:
|
||||
|
||||
```sh
|
||||
$ docker run -v /opt/kata:/opt/kata -v /var/run/dbus:/var/run/dbus -v /run/systemd:/run/systemd -v /etc/docker:/etc/docker -it katadocker/kata-deploy kata-deploy-docker remove
|
||||
```
|
||||
|
||||
After completing, the original `daemon.json`, if it existed, is restored and all Kata artifacts from `/opt/kata` are removed.
|
||||
|
||||
## Kubernetes quick start
|
||||
|
||||
### Install Kata on a running Kubernetes cluster
|
||||
|
@ -1,123 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (c) 2019 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
set -o nounset
|
||||
|
||||
conf_file="/etc/docker/daemon.json"
|
||||
conf_file_backup="${conf_file}.bak"
|
||||
snippet="${conf_file}.snip"
|
||||
tmp_file="${conf_file}.tmp"
|
||||
|
||||
# If we fail for any reason a message will be displayed
|
||||
die() {
|
||||
msg="$*"
|
||||
echo "ERROR: $msg" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
function print_usage() {
|
||||
echo "Usage: $0 [install/remove]"
|
||||
}
|
||||
|
||||
function install_artifacts() {
|
||||
echo "copying kata artifacts onto host"
|
||||
cp -a /opt/kata-artifacts/opt/kata/* /opt/kata/
|
||||
chmod +x /opt/kata/bin/*
|
||||
}
|
||||
|
||||
function configure_docker() {
|
||||
echo "configuring docker"
|
||||
|
||||
cat <<EOT | tee -a "$snippet"
|
||||
{
|
||||
"runtimes": {
|
||||
"kata-qemu": {
|
||||
"path": "/opt/kata/bin/kata-runtime",
|
||||
"runtimeArgs": [ "--kata-config", "/opt/kata/share/defaults/kata-containers/configuration-qemu.toml" ]
|
||||
},
|
||||
"kata-qemu-virtiofs": {
|
||||
"path": "/opt/kata/bin/kata-runtime",
|
||||
"runtimeArgs": [ "--kata-config", "/opt/kata/share/defaults/kata-containers/configuration-qemu-virtiofs.toml" ]
|
||||
},
|
||||
"kata-fc": {
|
||||
"path": "/opt/kata/bin/kata-runtime",
|
||||
"runtimeArgs": [ "--kata-config", "/opt/kata/share/defaults/kata-containers/configuration-fc.toml" ]
|
||||
},
|
||||
"kata-clh": {
|
||||
"path": "/opt/kata/bin/kata-runtime",
|
||||
"runtimeArgs": [ "--kata-config", "/opt/kata/share/defaults/kata-containers/configuration-clh.toml" ]
|
||||
},
|
||||
"kata-acrn": {
|
||||
"path": "/opt/kata/bin/kata-runtime",
|
||||
"runtimeArgs": [ "--kata-config", "/opt/kata/share/defaults/kata-containers/configuration-acrn.toml" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
EOT
|
||||
if [ -f ${conf_file} ]; then
|
||||
cp -n "$conf_file" "$conf_file_backup"
|
||||
|
||||
# Merge in the json snippet:
|
||||
jq -s '[.[] | to_entries] | flatten | reduce .[] as $dot ({}; .[$dot.key] += $dot.value)' "${conf_file}" "${snippet}" > "${tmp_file}"
|
||||
mv "${tmp_file}" "${conf_file}"
|
||||
rm "${snippet}"
|
||||
else
|
||||
mv "${snippet}" "${conf_file}"
|
||||
fi
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl reload docker
|
||||
}
|
||||
|
||||
function remove_artifacts() {
|
||||
echo "deleting kata artifacts"
|
||||
rm -rf /opt/kata/
|
||||
}
|
||||
|
||||
function cleanup_runtime() {
|
||||
echo "cleanup docker"
|
||||
rm -f "${conf_file}"
|
||||
|
||||
if [ -f "${conf_file_backup}" ]; then
|
||||
cp "${conf_file_backup}" "${conf_file}"
|
||||
fi
|
||||
systemctl daemon-reload
|
||||
systemctl reload docker
|
||||
}
|
||||
|
||||
function main() {
|
||||
# script requires that user is root
|
||||
euid=`id -u`
|
||||
if [[ $euid -ne 0 ]]; then
|
||||
die "This script must be run as root"
|
||||
fi
|
||||
|
||||
action=${1:-}
|
||||
if [ -z $action ]; then
|
||||
print_usage
|
||||
die "invalid arguments"
|
||||
fi
|
||||
|
||||
case $action in
|
||||
install)
|
||||
install_artifacts
|
||||
configure_docker
|
||||
;;
|
||||
remove)
|
||||
cleanup_runtime
|
||||
remove_artifacts
|
||||
;;
|
||||
*)
|
||||
echo invalid arguments
|
||||
print_usage
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
main $@
|
Loading…
Reference in New Issue
Block a user