Skip to content

Commit a3d84a1

Browse files
committed
docs: update for containerd v2
Fix issue 10132 Signed-off-by: Akihiro Suda <[email protected]>
1 parent f5d5407 commit a3d84a1

File tree

4 files changed

+215
-44
lines changed

4 files changed

+215
-44
lines changed

docs/PLUGINS.md

+17-5
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,24 @@ If you want to get the configuration combined with your configuration, run `cont
262262

263263
##### Version header
264264

265-
containerd has two configuration versions:
266-
- Version 2 (Recommended): Introduced in containerd 1.3.
267-
- Version 1 (Default): Introduced in containerd 1.0. Removed in containerd 2.0.
268-
269-
A configuration with Version 2 must have `version = 2` header, and must have
265+
containerd has several configuration versions:
266+
- Version 3 (Recommended for containerd 2.x): Introduced in containerd 2.0.
267+
Several plugin IDs have changed in this version.
268+
- Version 2 (Recommended for containerd 1.x): Introduced in containerd 1.3.
269+
Still supported in containerd v2.x.
270+
Plugin IDs are changed to have prefixes like "io.containerd.".
271+
- Version 1: Introduced in containerd 1.0. Removed in containerd 2.0.
272+
273+
A configuration for Version 2 or 3 must specify the version `version = 2` or `version = 3` in the header, and must have
270274
fully qualified plugin IDs in the `[plugins]` section:
275+
```toml
276+
version = 3
277+
278+
[plugins]
279+
[plugins.'io.containerd.monitor.task.v1.cgroups']
280+
no_prometheus = false
281+
```
282+
271283
```toml
272284
version = 2
273285

docs/cri/config.md

+162-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,32 @@ for more information about containerd config.
99
Note that the `[plugins."io.containerd.grpc.v1.cri"]` section is specific to CRI,
1010
and not recognized by other containerd clients such as `ctr`, `nerdctl`, and Docker/Moby.
1111

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+
1224
## Basic configuration
1325
### Cgroup Driver
1426
While containerd and Kubernetes use the legacy `cgroupfs` driver for managing cgroups by default,
1527
it is recommended to use the `systemd` driver on systemd-based hosts for compliance of
1628
[the "single-writer" rule](https://systemd.io/CGROUP_DELEGATION/) of cgroups.
1729

1830
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
1938
```toml
2039
version = 2
2140
[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/
5170
### Snapshotter
5271

5372
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
5480
```toml
5581
version = 2
5682
[plugins."io.containerd.grpc.v1.cri".containerd]
@@ -62,6 +88,25 @@ See [here](https://github.com/containerd/containerd/blob/main/docs/snapshotters)
6288
### Runtime classes
6389

6490
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
65110
```toml
66111
version = 2
67112
[plugins."io.containerd.grpc.v1.cri".containerd]
@@ -116,14 +161,128 @@ See also [the Kubernetes documentation](https://kubernetes.io/docs/concepts/cont
116161

117162
## Full configuration
118163
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
119274
<details>
120275

121276
<p>
122277

123278
```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.
127286
version = 2
128287
129288
# The 'plugins."io.containerd.grpc.v1.cri"' table contains all of the server options.

docs/cri/registry.md

+28-28
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ This document describes the method to configure the image registry for `containe
55
> **_NOTE:_** registry.mirrors and registry.configs as previously described in this document
66
> have been DEPRECATED. As described in [the cri config](./config.md#registry-configuration) you
77
> should now use the following configuration
8-
+ Before containerd 2.0
8+
+ In containerd 2.x
99
```toml
10-
[plugins."io.containerd.grpc.v1.cri".registry]
10+
[plugins."io.containerd.cri.v1.images".registry]
1111
config_path = "/etc/containerd/certs.d"
1212
```
13-
+ In containerd 2.0
13+
+ In containerd 1.x
1414
```toml
15-
[plugins."io.containerd.cri.v1.images".registry]
15+
[plugins."io.containerd.grpc.v1.cri".registry]
1616
config_path = "/etc/containerd/certs.d"
1717
```
1818

@@ -26,27 +26,27 @@ This document describes the method to configure the image registry for `containe
2626
To configure a credential for a specific registry, create/modify the
2727
`/etc/containerd/config.toml` as follows:
2828

29-
+ Before containerd 2.0
29+
+ In containerd 2.x
3030
```toml
31-
# explicitly use v2 config format
32-
version = 2
31+
# explicitly use v3 config format
32+
version = 3
3333

3434
# The registry host has to be a domain name or IP. Port number is also
3535
# needed if the default HTTPS or HTTP port is not used.
36-
[plugins."io.containerd.grpc.v1.cri".registry.configs."gcr.io".auth]
36+
[plugins."io.containerd.cri.v1.images".registry.configs."gcr.io".auth]
3737
username = ""
3838
password = ""
3939
auth = ""
4040
identitytoken = ""
4141
```
42-
+ In containerd 2.0
42+
+ In containerd 1.x
4343
```toml
44-
# explicitly use v3 config format
45-
version = 3
44+
# explicitly use v2 config format
45+
version = 2
4646

4747
# The registry host has to be a domain name or IP. Port number is also
4848
# needed if the default HTTPS or HTTP port is not used.
49-
[plugins."io.containerd.cri.v1.images".registry.configs."gcr.io".auth]
49+
[plugins."io.containerd.grpc.v1.cri".registry.configs."gcr.io".auth]
5050
username = ""
5151
password = ""
5252
auth = ""
@@ -95,22 +95,7 @@ Now that you know you can access your GCR from your terminal, it is now time to
9595
Edit the containerd config (default location is at `/etc/containerd/config.toml`)
9696
to add your JSON key for `gcr.io` domain image pull
9797
requests:
98-
+ Before containerd 2.0
99-
```toml
100-
version = 2
101-
102-
[plugins."io.containerd.grpc.v1.cri".registry]
103-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
104-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
105-
endpoint = ["https://registry-1.docker.io"]
106-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."gcr.io"]
107-
endpoint = ["https://gcr.io"]
108-
[plugins."io.containerd.grpc.v1.cri".registry.configs]
109-
[plugins."io.containerd.grpc.v1.cri".registry.configs."gcr.io".auth]
110-
username = "_json_key"
111-
password = 'paste output from jq'
112-
```
113-
+ In containerd 2.0
98+
+ In containerd 2.x
11499
```toml
115100
version = 3
116101

@@ -125,6 +110,21 @@ version = 3
125110
username = "_json_key"
126111
password = 'paste output from jq'
127112
```
113+
+ In containerd 1.x
114+
```toml
115+
version = 2
116+
117+
[plugins."io.containerd.grpc.v1.cri".registry]
118+
[plugins."io.containerd.grpc.v1.cri".registry.mirrors]
119+
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."docker.io"]
120+
endpoint = ["https://registry-1.docker.io"]
121+
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."gcr.io"]
122+
endpoint = ["https://gcr.io"]
123+
[plugins."io.containerd.grpc.v1.cri".registry.configs]
124+
[plugins."io.containerd.grpc.v1.cri".registry.configs."gcr.io".auth]
125+
username = "_json_key"
126+
password = 'paste output from jq'
127+
```
128128

129129
> Note: `username` of `_json_key` signifies that JSON key authentication will be used.
130130

docs/hosts.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@ been **DEPRECATED**._ You should now point your registry `config_path` to the pa
3333
`hosts.toml` files are located.
3434

3535
Modify your `config.toml` (default location: `/etc/containerd/config.toml`) as follows:
36-
+ Before containerd 2.0
37-
```toml
38-
version = 2
39-
40-
[plugins."io.containerd.grpc.v1.cri".registry]
41-
config_path = "/etc/containerd/certs.d"
42-
```
43-
+ In containerd 2.0
36+
+ In containerd 2.x
4437
```
4538
version = 3
4639
4740
[plugins."io.containerd.cri.v1.images".registry]
4841
config_path = "/etc/containerd/certs.d"
4942
```
43+
+ In containerd 1.x
44+
```toml
45+
version = 2
46+
47+
[plugins."io.containerd.grpc.v1.cri".registry]
48+
config_path = "/etc/containerd/certs.d"
49+
```
5050

5151
## Support for Docker's Certificate File Pattern
5252

0 commit comments

Comments
 (0)