• This repository has been archived on 12/May/2021
  • Stars
    star
    238
  • Rank 169,306 (Top 4 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created about 7 years ago
  • Updated over 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Kata Containers version 1.x agent (for version 2.x see https://github.com/kata-containers/kata-containers). Virtual Machine agent for hardware virtualized containers

Build Status codecov

Kata Containers Agent

This project implements an agent called kata-agent that runs inside a virtual machine (VM).

The agent manages container processes inside the VM, on behalf of the runtime running on the host.

Debug mode

To enable agent debug output, add the agent.log=debug option to the guest kernel command line.

See the developer guide for further details.

Developer mode

Add agent.devmode to the guest kernel command line to allow the agent process to coredump (disabled by default). Specifying this option implicitly enables debug mode.

Enable trace support

See the tracing guide.

Enable debug console

Add agent.debug_console to the guest kernel command line to allow the agent process to start a debug console. Debug console is only available if bash or sh is installed in the rootfs or initrd image. Developers can connect to the virtual machine using the debug console

Enable debug console for firecracker

Firecracker doesn't have a UNIX socket connected to /dev/console, hence the kernel command line option agent.debug_console will not work for firecracker. Fortunately, firecracker supports hybrid vsocks, and they can be used to communicate processes in the guest with processes in the host. The kernel command line option agent.debug_console_vport was added to allow developers specify on which vsock port the debugging console should be connected.

In firecracker, the UNIX socket that is connected to the vsock end is created at /var/lib/vc/firecracker/$CID/root/kata.hvsock, where $CID is the container ID.

Run the following commands to have a debugging console in firecracker.

$ conf="/usr/share/defaults/kata-containers/configuration.toml"
$ sudo sed -i 's/^kernel_params.*/kernel_params="agent.debug_console_vport=1026"/g' "${conf}"
$ sudo su -c 'cd /var/lib/vc/firecracker/08facf/root/ && socat stdin unix-connect:kata.hvsock'
CONNECT 1026

NOTE: Ports 1024 and 1025 are reserved for communication with the agent and gathering of agent logs respectively

cpuset cgroup details

See the cpuset cgroup documentation.

Hotplug Timeout

When hot plugging devices into the Kata VM, the agent will wait by default for 3 seconds for the device to be plugged in and the corresponding add uevent for the device. If the timeout is reached without the above happening, the hot plug action will fail.

The length of the timeout can be increased by specifying the agent.hotplug_timeout to the guest kernel command line. For example, agent.hotplug_timeout=10s will increase the timeout to 10 seconds. The value of the option is in the Go duration format.

Any invalid values used for agent.hotplug_timeout will fall back to the default of 3 seconds.

Cgroups V2

Same as systemd, the kata-agent has an option to enable or disable the unified cgroup hierarchy (cgroups v2) in the guest through the kernel command line. Set agent.unified_cgroup_hierarchy to 1 or true to enable cgroups v2. For example, agent.unified_cgroup_hierarchy=true will enable cgroups v2 in the guest. Set agent.unified_cgroup_hierarchy to 0 or false to disable cgroups v2. For example, agent.unified_cgroup_hierarchy=0 will disable cgroups v2 in the guest. By default cgroups v2 is disabled.

Container Pipe Size

The agent will configure a Pipe for stdio (stdout, stderr, stdin) for each container. By default, this will use the OS' defaults in terms of pipe capacity. However, some workloads may require a larger pipe when writing to stdout/stderr in non-blocking mode.

The pipe's capacity for stdout/stderr can be modified by specifying the agent.container_pipe_size flag to the guest kernel command line. For example, agent.container_pipe_size=2097152 will set the stdout and stderr pipes to 2097152 bytes.

More Repositories

1

kata-containers

Kata Containers is an open source project and community working to build a standard implementation of lightweight Virtual Machines (VMs) that feel and perform like containers, but provide the workload isolation and security advantages of VMs. https://katacontainers.io/
Rust
3,597
star
2

runtime

Kata Containers version 1.x runtime (for version 2.x see https://github.com/kata-containers/kata-containers).
Go
2,117
star
3

documentation

Kata Containers version 1.x documentation (for version 2.x see https://github.com/kata-containers/kata-containers).
Shell
498
star
4

govmm

Virtual Machine Manager for Go (govmm) is a suite of packages that provide Go APIs for creating and managing virtual machines.
Go
308
star
5

community

Python
211
star
6

tests

Kata Containers tests, CI, and metrics
Shell
135
star
7

packaging

Kata Containers version 1.x packaging (for version 2.x see https://github.com/kata-containers/kata-containers).
Logos
118
star
8

osbuilder

Kata Containers version 1.x guest OS building scripts (for version 2.x see https://github.com/kata-containers/kata-containers).
Shell
110
star
9

shim

Kata Containers version 1.x shim (for version 2.x see https://github.com/kata-containers/kata-containers).
Go
67
star
10

proxy

Kata Containers version 1.x proxy (for version 2.x see https://github.com/kata-containers/kata-containers).
Go
57
star
11

ksm-throttler

Kata Containers KSM throttling daemon
Go
25
star
12

www.katacontainers.io

Kata Containers website repo
Sass
24
star
13

ci

Kata Containers CI
Shell
14
star
14

.github

Kata Containers default files for GitHub repositories
Shell
4
star
15

directvolume

Support for directly-assigning volumes to a VM runtime
Go
3
star
16

presentations

Kata Containers presentations in various meetup/conferences
3
star