mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-29 16:57:18 +00:00
snap: improve README and Makefile
Address code review of pr #82 fixes #88 Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
540d3a26be
commit
81a41050b8
@ -26,10 +26,10 @@ check_kata_kernel_version(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_yq() {
|
install_yq() {
|
||||||
GOPATH=${GOPATH:-${HOME}/go}
|
path=$1
|
||||||
local yq_path="${GOPATH}/bin/yq"
|
local yq_path=${path}/yq
|
||||||
local yq_pkg="github.com/mikefarah/yq"
|
local yq_pkg="github.com/mikefarah/yq"
|
||||||
[ -x "${GOPATH}/bin/yq" ] && return
|
[ -x "${yq_path}" ] && return
|
||||||
|
|
||||||
case "$(arch)" in
|
case "$(arch)" in
|
||||||
"aarch64")
|
"aarch64")
|
||||||
@ -45,7 +45,7 @@ install_yq() {
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
mkdir -p "${GOPATH}/bin"
|
mkdir -p "${path}"
|
||||||
|
|
||||||
# Workaround to get latest release from github (to not use github token).
|
# Workaround to get latest release from github (to not use github token).
|
||||||
# Get the redirection to latest release on github.
|
# Get the redirection to latest release on github.
|
||||||
|
5
Makefile
5
Makefile
@ -7,13 +7,14 @@
|
|||||||
|
|
||||||
MK_DIR :=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
MK_DIR :=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
|
||||||
SED := sed
|
SED := sed
|
||||||
YQ := $(shell go env GOPATH)/bin/yq
|
YQ := $(MK_DIR)/yq
|
||||||
SNAPCRAFT_FILE := snap/snapcraft.yaml
|
SNAPCRAFT_FILE := snap/snapcraft.yaml
|
||||||
VERSIONS_YAML_FILE := versions.yaml
|
VERSIONS_YAML_FILE := versions.yaml
|
||||||
VERSIONS_YAML_FILE_URL := https://raw.githubusercontent.com/kata-containers/runtime/master/versions.yaml
|
VERSIONS_YAML_FILE_URL := https://raw.githubusercontent.com/kata-containers/runtime/master/versions.yaml
|
||||||
VERSION_FILE := VERSION
|
VERSION_FILE := VERSION
|
||||||
VERSION_FILE_URL := https://raw.githubusercontent.com/kata-containers/runtime/master/VERSION
|
VERSION_FILE_URL := https://raw.githubusercontent.com/kata-containers/runtime/master/VERSION
|
||||||
|
|
||||||
|
export MK_DIR
|
||||||
export YQ
|
export YQ
|
||||||
export VERSION_FILE
|
export VERSION_FILE
|
||||||
export VERSIONS_YAML_FILE
|
export VERSIONS_YAML_FILE
|
||||||
@ -31,7 +32,7 @@ test-packaging-tools:
|
|||||||
@$(MK_DIR)/obs-packaging/build_from_docker.sh
|
@$(MK_DIR)/obs-packaging/build_from_docker.sh
|
||||||
|
|
||||||
$(YQ):
|
$(YQ):
|
||||||
@bash -c "source .ci/lib.sh; install_yq"
|
@bash -c "source .ci/lib.sh; install_yq $${MK_DIR}"
|
||||||
|
|
||||||
$(VERSION_FILE):
|
$(VERSION_FILE):
|
||||||
@curl -sO $(VERSION_FILE_URL)
|
@curl -sO $(VERSION_FILE_URL)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
# Kata Containers snap image
|
# Kata Containers snap image
|
||||||
|
|
||||||
* [Kata Containers snap image](#kata-containers-snap-image)
|
|
||||||
* [Initial setup](#initial-setup)
|
* [Initial setup](#initial-setup)
|
||||||
* [Build snap image](#build-snap-image)
|
* [Install snap](#install-snap)
|
||||||
* [Install snap (developer)](#install-snap-developer)
|
* [Build and install snap image](#build-and-install-snap-image)
|
||||||
|
* [Configure Kata Containers](#configure-kata-containers)
|
||||||
* [Integration with docker](#integration-with-docker)
|
* [Integration with docker](#integration-with-docker)
|
||||||
* [Limitations](#limitations)
|
* [Limitations](#limitations)
|
||||||
|
|
||||||
@ -18,7 +18,15 @@ This directory contains the resources needed to build the Kata Containers
|
|||||||
$ sudo apt-get install -y snapd snapcraft
|
$ sudo apt-get install -y snapd snapcraft
|
||||||
```
|
```
|
||||||
|
|
||||||
## Build snap image
|
## Install snap
|
||||||
|
|
||||||
|
You can install Kata Containers from the [snapcraft store][8] or by running the following command:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ sudo snap install kata-containers
|
||||||
|
```
|
||||||
|
|
||||||
|
## Build and install snap image
|
||||||
|
|
||||||
Run next command at the root directory of the packaging repository.
|
Run next command at the root directory of the packaging repository.
|
||||||
|
|
||||||
@ -26,8 +34,6 @@ Run next command at the root directory of the packaging repository.
|
|||||||
$ make snap
|
$ make snap
|
||||||
```
|
```
|
||||||
|
|
||||||
## Install snap (developer)
|
|
||||||
|
|
||||||
To install the resulting snap image, snap must be put in [classic mode][3] and the
|
To install the resulting snap image, snap must be put in [classic mode][3] and the
|
||||||
security confinement must be disabled (*--classic*). Also since the resulting snap
|
security confinement must be disabled (*--classic*). Also since the resulting snap
|
||||||
has not been signed the verification of signature must be omitted (*--dangerous*).
|
has not been signed the verification of signature must be omitted (*--dangerous*).
|
||||||
@ -39,7 +45,7 @@ $ sudo snap install --classic --dangerous kata-containers_[VERSION]_[ARCH].snap
|
|||||||
Replace `VERSION` with the current version of Kata Containers and `ARCH` with
|
Replace `VERSION` with the current version of Kata Containers and `ARCH` with
|
||||||
the system architecture.
|
the system architecture.
|
||||||
|
|
||||||
## Configuring Kata Containers ##
|
## Configure Kata Containers
|
||||||
|
|
||||||
By default Kata Containers snap image is mounted at `/snap/kata-containers` as a
|
By default Kata Containers snap image is mounted at `/snap/kata-containers` as a
|
||||||
read-only file system, therefore default configuration file can not be edited.
|
read-only file system, therefore default configuration file can not be edited.
|
||||||
@ -52,48 +58,28 @@ $ sudo cp /snap/kata-containers/current/usr/share/defaults/kata-containers/confi
|
|||||||
$ $EDITOR /etc/kata-containers/configuration.toml
|
$ $EDITOR /etc/kata-containers/configuration.toml
|
||||||
```
|
```
|
||||||
|
|
||||||
## Integration with docker ##
|
## Integration with docker and kubernetes
|
||||||
|
|
||||||
the path to the runtime provided by the Kata Containers snap image is
|
The path to the runtime provided by the Kata Containers snap image is
|
||||||
`/snap/kata-containers/current/usr/bin/kata-runtime`, this runtime must be added to
|
`/snap/kata-containers/current/usr/bin/kata-runtime`. You should use it to
|
||||||
[dockerd][5] via `systemd` or `dockerd` configuration file.
|
run Kata Containers with [docker][9] and [kubernetes][10].
|
||||||
|
|
||||||
`/etc/systemd/system/docker.service.d/runtime.conf`
|
|
||||||
|
|
||||||
```ini
|
|
||||||
[Service]
|
|
||||||
ExecStart=/usr/bin/dockerd -D --add-runtime kata-runtime=/snap/kata-containers/current/usr/bin/kata-runtime --default-runtime=kata-runtime
|
|
||||||
```
|
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
`/etc/docker/daemon.json`
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"default-runtime": "kata-runtime",
|
|
||||||
"runtimes": {
|
|
||||||
"kata-runtime": {
|
|
||||||
"path": "/snap/kata-containers/current/usr/bin/kata-runtime"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
after having added the new runtime, the service must be reloaded and restarted
|
|
||||||
|
|
||||||
```
|
|
||||||
$ sudo systemctl daemon-reload
|
|
||||||
$ sudo systemctl restart docker
|
|
||||||
```
|
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
The [miniOS image][2] is not included in the snap image as it is not possible for
|
The [miniOS image][2] is not included in the snap image as it is not possible for
|
||||||
QEMU to open a guest RAM backing store on a read-only filesystem.
|
QEMU to open a guest RAM backing store on a read-only filesystem. Fortunately,
|
||||||
|
you can start Kata Containers with a Linux initial RAM disk (initrd) that is
|
||||||
|
included in the snap image. If you want to use the miniOS image instead of initrd,
|
||||||
|
then a new configuration file can be [created](#configuring-kata-containers)
|
||||||
|
and [configured][7].
|
||||||
|
|
||||||
[1]: https://docs.snapcraft.io/snaps/intro
|
[1]: https://docs.snapcraft.io/snaps/intro
|
||||||
[2]: https://github.com/kata-containers/documentation/blob/master/architecture.md#root-filesystem-image
|
[2]: https://github.com/kata-containers/documentation/blob/master/architecture.md#root-filesystem-image
|
||||||
[3]: https://docs.snapcraft.io/reference/confinement#classic
|
[3]: https://docs.snapcraft.io/reference/confinement#classic
|
||||||
[4]: https://github.com/kata-containers/runtime
|
[4]: https://github.com/kata-containers/runtime
|
||||||
[5]: https://docs.docker.com/engine/reference/commandline/dockerd
|
[5]: https://docs.docker.com/engine/reference/commandline/dockerd
|
||||||
|
[6]: https://github.com/kata-containers/documentation/blob/master/install/docker/ubuntu-docker-install.md
|
||||||
|
[7]: https://github.com/kata-containers/documentation/blob/master/Developer-Guide.md#configure-to-use-initrd-or-rootfs-image
|
||||||
|
[8]: https://snapcraft.io/kata-containers
|
||||||
|
[9]: https://github.com/kata-containers/documentation/blob/master/Developer-Guide.md#run-kata-containers-with-docker
|
||||||
|
[10]: https://github.com/kata-containers/documentation/blob/master/Developer-Guide.md#run-kata-containers-with-kubernetes
|
||||||
|
Loading…
Reference in New Issue
Block a user