You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.7 KiB

  1. # Kata Containers
  2. [Kata Containers](https://katacontainers.io) is a secure container runtime with lightweight virtual machines that supports multiple hypervisor solutions.
  3. ## Hypervisors
  4. _Qemu_ is the only hypervisor supported by Kubespray.
  5. ## Installation
  6. To enable Kata Containers, set the following variables:
  7. **k8s-cluster.yml**:
  8. ```yaml
  9. container_manager: containerd
  10. kata_containers_enabled: true
  11. ```
  12. **etcd.yml**:
  13. ```yaml
  14. etcd_deployment_type: host
  15. ```
  16. ## Usage
  17. By default, runc is used for pods.
  18. Kubespray generates the runtimeClass kata-qemu, and it is necessary to specify it as
  19. the runtimeClassName of a pod spec to use Kata Containers:
  20. ```shell
  21. $ kubectl get runtimeclass
  22. NAME HANDLER AGE
  23. kata-qemu kata-qemu 3m34s
  24. $
  25. $ cat nginx.yaml
  26. apiVersion: v1
  27. kind: Pod
  28. metadata:
  29. name: mypod
  30. spec:
  31. runtimeClassName: kata-qemu
  32. containers:
  33. - name: nginx
  34. image: nginx:1.14.2
  35. $
  36. $ kubectl apply -f nginx.yaml
  37. ```
  38. ## Configuration
  39. ### Recommended : Pod Overhead
  40. [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.
  41. 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.
  42. 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).
  43. **Set cgroup driver**:
  44. To enable Pod Overhead feature you have to configure Kubelet with the appropriate cgroup driver, using the following configuration:
  45. `cgroupfs` works best:
  46. ```yaml
  47. kubelet_cgroup_driver: cgroupfs
  48. ```
  49. ... 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:
  50. ```yaml
  51. kubelet_cgroup_driver: systemd
  52. ```
  53. **Qemu hypervisor configuration**:
  54. The configuration for the Qemu hypervisor uses the following values:
  55. ```yaml
  56. kata_containers_qemu_overhead: true
  57. kata_containers_qemu_overhead_fixed_cpu: 10m
  58. kata_containers_qemu_overhead_fixed_memory: 290Mi
  59. ```
  60. ### Optional : Select Kata Containers version
  61. 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).
  62. ```yaml
  63. kata_containers_version: 2.2.2
  64. ```
  65. ### Optional : Debug
  66. Debug is disabled by default for all the components of Kata Containers. You can change this behaviour with the following configuration:
  67. ```yaml
  68. kata_containers_qemu_debug: 'false'
  69. ```