@@ -9,13 +9,32 @@ for more information about containerd config.
9
9
Note that the ` [plugins."io.containerd.grpc.v1.cri"] ` section is specific to CRI,
10
10
and not recognized by other containerd clients such as ` ctr ` , ` nerdctl ` , and Docker/Moby.
11
11
12
+ ## Config versions
13
+ The content of ` /etc/containerd/config.toml ` must start with a version header, for example:
14
+ ``` toml
15
+ version = 3
16
+ ```
17
+
18
+ The config version 3 was introduced in containerd v2.0.
19
+ The config version 2 used in containerd 1.x is still supported and automatically
20
+ converted to the config version 3.
21
+
22
+ For the further information, see [ ` ../PLUGINS.md ` ] ( ../PLUGINS.md ) .
23
+
12
24
## Basic configuration
13
25
### Cgroup Driver
14
26
While containerd and Kubernetes use the legacy ` cgroupfs ` driver for managing cgroups by default,
15
27
it is recommended to use the ` systemd ` driver on systemd-based hosts for compliance of
16
28
[ the "single-writer" rule] ( https://systemd.io/CGROUP_DELEGATION/ ) of cgroups.
17
29
18
30
To configure containerd to use the ` systemd ` driver, set the following option in ` /etc/containerd/config.toml ` :
31
+ + In containerd 2.x
32
+ ``` toml
33
+ version = 3
34
+ [plugins .'io .containerd .cri .v1 .runtime' .containerd .runtimes .runc .options ]
35
+ SystemdCgroup = true
36
+ ```
37
+ + In containerd 1.x
19
38
``` toml
20
39
version = 2
21
40
[plugins ."io .containerd .grpc .v1 .cri" .containerd .runtimes .runc .options ]
@@ -51,6 +70,13 @@ kubeadm users should also see [the kubeadm documentation](https://kubernetes.io/
51
70
# ## Snapshotter
52
71
53
72
The default snapshotter is set to `overlayfs` (akin to Docker's `overlay2` storage driver) :
73
+ + In containerd 2.x
74
+ ` ` ` toml
75
+ version = 3
76
+ [plugins.'io.containerd.cri.v1.images']
77
+ snapshotter = "overlayfs"
78
+ ` ` `
79
+ + In containerd 1.x
54
80
` ` ` toml
55
81
version = 2
56
82
[plugins."io.containerd.grpc.v1.cri".containerd]
@@ -62,6 +88,25 @@ See [here](https://github.com/containerd/containerd/blob/main/docs/snapshotters)
62
88
# ## Runtime classes
63
89
64
90
The following example registers custom runtimes into containerd :
91
+ + In containerd 2.x
92
+ ` ` ` toml
93
+ version = 3
94
+ [plugins."io.containerd.cri.v1.runtime".containerd]
95
+ default_runtime_name = "crun"
96
+ [plugins."io.containerd.cri.v1.runtime".containerd.runtimes]
97
+ # crun: https://github.com/containers/crun
98
+ [plugins."io.containerd.cri.v1.runtime".containerd.runtimes.crun]
99
+ runtime_type = "io.containerd.runc.v2"
100
+ [plugins."io.containerd.cri.v1.runtime".containerd.runtimes.crun.options]
101
+ BinaryName = "/usr/local/bin/crun"
102
+ # gVisor: https://gvisor.dev/
103
+ [plugins."io.containerd.cri.v1.runtime".containerd.runtimes.gvisor]
104
+ runtime_type = "io.containerd.runsc.v1"
105
+ # Kata Containers: https://katacontainers.io/
106
+ [plugins."io.containerd.cri.v1.runtime".containerd.runtimes.kata]
107
+ runtime_type = "io.containerd.kata.v2"
108
+ ` ` `
109
+ + In containerd 1.x
65
110
` ` ` toml
66
111
version = 2
67
112
[plugins."io.containerd.grpc.v1.cri".containerd]
@@ -116,14 +161,128 @@ See also [the Kubernetes documentation](https://kubernetes.io/docs/concepts/cont
116
161
117
162
# # Full configuration
118
163
The explanation and default value of each configuration item are as follows :
164
+ + In containerd 2.x
165
+ <details>
166
+
167
+ <p>
168
+
169
+ ` ` ` toml
170
+ # containerd has several configuration versions:
171
+ # - Version 3 (Recommended for containerd 2.x): Introduced in containerd 2.0.
172
+ # Several plugin IDs have changed in this version.
173
+ # - Version 2 (Recommended for containerd 1.x): Introduced in containerd 1.3.
174
+ # Still supported in containerd v2.x.
175
+ # Plugin IDs are changed to have prefixes like "io.containerd.".
176
+ # - Version 1 (Default): Introduced in containerd 1.0. Removed in containerd 2.0.
177
+ version = 3
178
+
179
+ [plugins]
180
+ [plugins.'io.containerd.cri.v1.images']
181
+ snapshotter = 'overlayfs'
182
+ disable_snapshot_annotations = true
183
+ discard_unpacked_layers = false
184
+ max_concurrent_downloads = 3
185
+ image_pull_progress_timeout = '5m0s'
186
+ image_pull_with_sync_fs = false
187
+ stats_collect_period = 10
188
+
189
+ [plugins.'io.containerd.cri.v1.images'.pinned_images]
190
+ sandbox = 'registry.k8s.io/pause:3.10'
191
+
192
+ [plugins.'io.containerd.cri.v1.images'.registry]
193
+ config_path = ''
194
+
195
+ [plugins.'io.containerd.cri.v1.images'.image_decryption]
196
+ key_model = 'node'
197
+
198
+ [plugins.'io.containerd.cri.v1.runtime']
199
+ enable_selinux = false
200
+ selinux_category_range = 1024
201
+ max_container_log_line_size = 16384
202
+ disable_cgroup = false
203
+ disable_apparmor = false
204
+ restrict_oom_score_adj = false
205
+ disable_proc_mount = false
206
+ unset_seccomp_profile = ''
207
+ tolerate_missing_hugetlb_controller = true
208
+ disable_hugetlb_controller = true
209
+ device_ownership_from_security_context = false
210
+ ignore_image_defined_volumes = false
211
+ netns_mounts_under_state_dir = false
212
+ enable_unprivileged_ports = true
213
+ enable_unprivileged_icmp = true
214
+ enable_cdi = true
215
+ cdi_spec_dirs = ['/etc/cdi', '/var/run/cdi']
216
+ drain_exec_sync_io_timeout = '0s'
217
+ ignore_deprecation_warnings = []
218
+
219
+ [plugins.'io.containerd.cri.v1.runtime'.containerd]
220
+ default_runtime_name = 'runc'
221
+ ignore_blockio_not_enabled_errors = false
222
+ ignore_rdt_not_enabled_errors = false
223
+
224
+ [plugins.'io.containerd.cri.v1.runtime'.containerd.runtimes]
225
+ [plugins.'io.containerd.cri.v1.runtime'.containerd.runtimes.runc]
226
+ runtime_type = 'io.containerd.runc.v2'
227
+ runtime_path = ''
228
+ pod_annotations = []
229
+ container_annotations = []
230
+ privileged_without_host_devices = false
231
+ privileged_without_host_devices_all_devices_allowed = false
232
+ base_runtime_spec = ''
233
+ cni_conf_dir = ''
234
+ cni_max_conf_num = 0
235
+ snapshotter = ''
236
+ sandboxer = 'podsandbox'
237
+ io_type = ''
238
+
239
+ [plugins.'io.containerd.cri.v1.runtime'.containerd.runtimes.runc.options]
240
+ BinaryName = ''
241
+ CriuImagePath = ''
242
+ CriuWorkPath = ''
243
+ IoGid = 0
244
+ IoUid = 0
245
+ NoNewKeyring = false
246
+ Root = ''
247
+ ShimCgroup = ''
248
+
249
+ [plugins.'io.containerd.cri.v1.runtime'.cni]
250
+ bin_dir = '/opt/cni/bin'
251
+ conf_dir = '/etc/cni/net.d'
252
+ max_conf_num = 1
253
+ setup_serially = false
254
+ conf_template = ''
255
+ ip_pref = ''
256
+ use_internal_loopback = false
257
+
258
+ [plugins.'io.containerd.grpc.v1.cri']
259
+ disable_tcp_service = true
260
+ stream_server_address = '127.0.0.1'
261
+ stream_server_port = '0'
262
+ stream_idle_timeout = '4h0m0s'
263
+ enable_tls_streaming = false
264
+
265
+ [plugins.'io.containerd.grpc.v1.cri'.x509_key_pair_streaming]
266
+ tls_cert_file = ''
267
+ tls_key_file = ''
268
+ ` ` `
269
+
270
+ </p>
271
+ </details>
272
+
273
+ + In containerd 1.x
119
274
<details>
120
275
121
276
<p>
122
277
123
278
` ` ` toml
124
- # Use config version 2 to enable new configuration fields.
125
- # Config file is parsed as version 1 by default.
126
- # Version 2 uses long plugin names, i.e. "io.containerd.grpc.v1.cri" vs "cri".
279
+ # containerd has several configuration versions:
280
+ # - Version 3 (Recommended for containerd 2.x): Introduced in containerd 2.0.
281
+ # Several plugin IDs have changed in this version.
282
+ # - Version 2 (Recommended for containerd 1.x): Introduced in containerd 1.3.
283
+ # Still supported in containerd v2.x.
284
+ # Plugin IDs are changed to have prefixes like "io.containerd.".
285
+ # - Version 1 (Default): Introduced in containerd 1.0. Removed in containerd 2.0.
127
286
version = 2
128
287
129
288
# The 'plugins."io.containerd.grpc.v1.cri"' table contains all of the server options.
0 commit comments