30843fd7f74a211d4e780d2137d5dea0bd84f1cb
[it/test.git] / XTesting / kubespray / docs / kata-containers.md
1 # Kata Containers
2
3 [Kata Containers](https://katacontainers.io) is a secure container runtime with lightweight virtual machines that supports multiple hypervisor solutions.
4
5 ## Hypervisors
6
7 _Qemu_ is the only hypervisor supported by Kubespray.
8
9 ## Installation
10
11 To enable Kata Containers, set the following variables:
12
13 **k8s-cluster.yml**:
14
15 ```yaml
16 container_manager: containerd
17 kata_containers_enabled: true
18 ```
19
20 **etcd.yml**:
21
22 ```yaml
23 etcd_deployment_type: host
24 ```
25
26 ## Usage
27
28 By default, runc is used for pods.
29 Kubespray generates the runtimeClass kata-qemu, and it is necessary to specify it as
30 the runtimeClassName of a pod spec to use Kata Containers:
31
32 ```shell
33 $ kubectl get runtimeclass
34 NAME        HANDLER     AGE
35 kata-qemu   kata-qemu   3m34s
36 $
37 $ cat nginx.yaml
38 apiVersion: v1
39 kind: Pod
40 metadata:
41   name: mypod
42 spec:
43   runtimeClassName: kata-qemu
44   containers:
45   - name: nginx
46     image: nginx:1.14.2
47 $
48 $ kubectl apply -f nginx.yaml
49 ```
50
51 ## Configuration
52
53 ### Recommended : Pod Overhead
54
55 [Pod Overhead](https://kubernetes.io/docs/concepts/configuration/pod-overhead/) is a feature for accounting for the resources consumed by the Runtime Class used by the Pod.
56
57 When this feature is enabled, Kubernetes will count the fixed amount of CPU and memory set in the configuration as used by the virtual machine and not by the containers running in the Pod.
58
59 Pod Overhead is mandatory if you run Pods with Kata Containers that use [resources limits](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/#requests-and-limits).
60
61 **Set cgroup driver**:
62
63 To enable Pod Overhead feature you have to configure Kubelet with the appropriate cgroup driver, using the following configuration:
64
65 `cgroupfs` works best:
66
67 ```yaml
68 kubelet_cgroup_driver: cgroupfs
69 ```
70
71 ... but when using `cgroups v2` (see <https://www.redhat.com/en/blog/world-domination-cgroups-rhel-8-welcome-cgroups-v2>) you can use systemd as well:
72
73 ```yaml
74 kubelet_cgroup_driver: systemd
75 ```
76
77 **Qemu hypervisor configuration**:
78
79 The configuration for the Qemu hypervisor uses the following values:
80
81 ```yaml
82 kata_containers_qemu_overhead: true
83 kata_containers_qemu_overhead_fixed_cpu: 10m
84 kata_containers_qemu_overhead_fixed_memory: 290Mi
85 ```
86
87 ### Optional : Select Kata Containers version
88
89 Optionally you can select the Kata Containers release version to be installed. The available releases are published in [GitHub](https://github.com/kata-containers/kata-containers/releases).
90
91 ```yaml
92 kata_containers_version: 2.2.2
93 ```
94
95 ### Optional : Debug
96
97 Debug is disabled by default for all the components of Kata Containers. You can change this behaviour with the following configuration:
98
99 ```yaml
100 kata_containers_qemu_debug: 'false'
101 ```