kata-containers/src/agent
Zixuan Tan 6e4d4c329a agent,runtime-rs: Add license header to passfd_io.rs
Fixes: #6714
Signed-off-by: Zixuan Tan <tanzixuan.me@gmail.com>
2024-01-31 21:07:48 +08:00
..
.cargo linker: no such file linking error on AArch64 2020-01-09 11:08:23 +08:00
rustjail agent: Use pipes as stdout/stderr of container process 2024-01-31 21:07:48 +08:00
samples agent: add grpc interface for stat and resize operations 2022-03-03 18:57:02 -08:00
src agent,runtime-rs: Add license header to passfd_io.rs 2024-01-31 21:07:48 +08:00
vsock-exporter agent: update tokio dependency 2023-05-18 09:36:06 +00:00
.gitignore agent: update netlink libraries 2021-06-30 22:39:50 +08:00
.rustfmt.toml agent: set edition = "2018" in .rustfmt.toml to fix rustfmt about async fn 2021-01-18 15:38:19 +08:00
Cargo.lock agent: Use pipes as stdout/stderr of container process 2024-01-31 21:07:48 +08:00
Cargo.toml agent: Bump ttrpc version 2024-01-04 15:58:34 +08:00
kata-agent.service.in agent: Set fixed NOFILE limit value for kata-agent 2021-05-04 15:06:11 +03:00
kata-containers.target systemd-service: build rust-agent systemd services 2020-03-03 09:24:02 +08:00
Makefile agent: Allow specifying DESTDIR and AGENT_POLICY via env vars 2023-10-03 14:18:45 +02:00
README.md docs: fix agent proto file path 2022-01-06 00:22:49 +08:00
VERSION build: Only keep one VERSION file 2021-03-31 23:51:20 +02:00

Kata Agent

Overview

The Kata agent is a long running process that runs inside the Virtual Machine (VM) (also known as the "pod" or "sandbox").

The agent is packaged inside the Kata Containers guest image which is used to boot the VM. Once the runtime has launched the configured hypervisor to create a new VM, the agent is started. From this point on, the agent is responsible for creating and managing the life cycle of the containers inside the VM.

For further details, see the architecture document.

Audience

If you simply wish to use Kata Containers, it is not necessary to understand the details of how the agent operates. Please see the installation documentation for details of how deploy Kata Containers (which will include the Kata agent).

The remainder of this document is only useful for developers and testers.

Build from Source

Since the agent is written in the Rust language this section assumes the tool chain has been installed using standard Rust rustup tool.

Build with musl

If you wish to build the agent with the musl C library, you need to run the following commands:

$ arch=$(uname -m)
$ rustup target add "${arch}-unknown-linux-musl"
$ sudo ln -s /usr/bin/g++ /bin/musl-g++

Note:

It is not currently possible to build using musl on ppc64le and s390x since both platforms lack the musl target.

Build the agent binary

The following steps download the Kata Containers source files and build the agent:

$ GOPATH="${GOPATH:-$HOME/go}"
$ dir="$GOPATH/src/github.com/kata-containers"
$ git -C ${dir} clone --depth 1 https://github.com/kata-containers/kata-containers
$ make -C ${dir}/kata-containers/src/agent

Change the agent API

The Kata runtime communicates with the Kata agent using a ttRPC based API protocol.

This ttRPC API is defined by a set of protocol buffers files. The protocol files are used to generate the bindings for the following components:

Component Language Generation method [*] Tooling required
runtime Golang Run, make generate-protocols protoc
agent Rust Run, make

Key:

[*] - All commands must be run in the agent repository.

If you wish to change the API, these files must be regenerated. Although the rust code will be automatically generated by the build script, the Golang code generation requires the external protoc command to be available in $PATH.

To install the protoc command on a Fedora/CentOS/RHEL system:

$ sudo dnf install -y protobuf-compiler

Custom guest image and kernel assets

If you wish to develop or test changes to the agent, you will need to create a custom guest image using the osbuilder tool. You may also wish to create a custom guest kernel.

Once created, configure Kata Containers to use these custom assets to allow you to test your changes.

Note:

To simplify development and testing, you may wish to run the agent stand alone initially.

Tracing

For details of tracing the operation of the agent, see the tracing documentation.

Run the agent stand alone

Although the agent is designed to run in a VM environment, for development and testing purposes it is possible to run it as a normal application.

When run in this way, the agent can be controlled using the low-level Kata agent control tool, rather than the Kata runtime.

For further details, see the agent control tool documentation.