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.

115 lines
3.5 KiB

  1. # containerd
  2. [containerd] An industry-standard container runtime with an emphasis on simplicity, robustness and portability
  3. Kubespray supports basic functionality for using containerd as the default container runtime in a cluster.
  4. _To use the containerd container runtime set the following variables:_
  5. ## k8s_cluster.yml
  6. When kube_node contains etcd, you define your etcd cluster to be as well schedulable for Kubernetes workloads. Thus containerd and dockerd can not run at same time, must be set to bellow for running etcd cluster with only containerd.
  7. ```yaml
  8. container_manager: containerd
  9. ```
  10. ## etcd.yml
  11. ```yaml
  12. etcd_deployment_type: host
  13. ```
  14. ## Containerd config
  15. Example: define registry mirror for docker hub
  16. ```yaml
  17. containerd_registries:
  18. "docker.io":
  19. - "https://mirror.gcr.io"
  20. - "https://registry-1.docker.io"
  21. ```
  22. `containerd_registries` is ignored for pulling images when `image_command_tool=nerdctl`
  23. (the default for `container_manager=containerd`). Use `crictl` instead, it supports
  24. `containerd_registries` but lacks proper multi-arch support (see
  25. [#8375](https://github.com/kubernetes-sigs/kubespray/issues/8375)):
  26. ```yaml
  27. image_command_tool: crictl
  28. ```
  29. ### Containerd Runtimes
  30. Containerd supports multiple runtime configurations that can be used with
  31. [RuntimeClass] Kubernetes feature. See [runtime classes in containerd] for the
  32. details of containerd configuration.
  33. In kubespray, the default runtime name is "runc", and it can be configured with the `containerd_runc_runtime` dictionary:
  34. ```yaml
  35. containerd_runc_runtime:
  36. name: runc
  37. type: "io.containerd.runc.v2"
  38. engine: ""
  39. root: ""
  40. options:
  41. systemdCgroup: "false"
  42. binaryName: /usr/local/bin/my-runc
  43. base_runtime_spec: cri-base.json
  44. ```
  45. Further runtimes can be configured with `containerd_additional_runtimes`, which
  46. is a list of such dictionaries.
  47. Default runtime can be changed by setting `containerd_default_runtime`.
  48. #### Base runtime specs and limiting number of open files
  49. `base_runtime_spec` key in a runtime dictionary is used to explicitly
  50. specify a runtime spec json file. `runc` runtime has it set to `cri-base.json`,
  51. which is generated with `ctr oci spec > /etc/containerd/cri-base.json` and
  52. updated to include a custom setting for maximum number of file descriptors per
  53. container.
  54. You can change maximum number of file descriptors per container for the default
  55. `runc` runtime by setting the `containerd_base_runtime_spec_rlimit_nofile`
  56. variable.
  57. You can tune many more [settings][runtime-spec] by supplying your own file name and content with `containerd_base_runtime_specs`:
  58. ```yaml
  59. containerd_base_runtime_specs:
  60. cri-spec-custom.json: |
  61. {
  62. "ociVersion": "1.0.2-dev",
  63. "process": {
  64. "user": {
  65. "uid": 0,
  66. ...
  67. ```
  68. The files in this dict will be placed in containerd config directory,
  69. `/etc/containerd` by default. The files can then be referenced by filename in a
  70. runtime:
  71. ```yaml
  72. containerd_runc_runtime:
  73. name: runc
  74. base_runtime_spec: cri-spec-custom.json
  75. ...
  76. ```
  77. Config insecure-registry access to self hosted registries.
  78. ```yaml
  79. containerd_insecure_registries:
  80. "test.registry.io": "http://test.registry.io"
  81. "172.19.16.11:5000": "http://172.19.16.11:5000"
  82. "repo:5000": "http://repo:5000"
  83. ```
  84. [containerd]: https://containerd.io/
  85. [RuntimeClass]: https://kubernetes.io/docs/concepts/containers/runtime-class/
  86. [runtime classes in containerd]: https://github.com/containerd/containerd/blob/main/docs/cri/config.md#runtime-classes
  87. [runtime-spec]: https://github.com/opencontainers/runtime-spec