You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- add information to cgroup resources controllers with examples
- add pids cgroup information and example
- reflect kernel types
Signed-off-by: Antonio Murdaca <[email protected]>
@@ -4,11 +4,24 @@ A namespace wraps a global system resource in an abstraction that makes it appea
4
4
Changes to the global resource are visible to other processes that are members of the namespace, but are invisible to other processes.
5
5
For more information, see [the man page](http://man7.org/linux/man-pages/man7/namespaces.7.html).
6
6
7
-
Namespaces are specified in the spec as an array of entries.
8
-
Each entry has a type field with possible values described below and an optional path element.
7
+
Namespaces are specified as an array of entries inside the `namespaces` root field.
8
+
The following parameters can be specified to setup namespaces:
9
+
10
+
***`type`***(string, required)* - namespace type. The following namespaces types are supported:
11
+
***`pid`** processes inside the container will only be able to see other processes inside the same container
12
+
***`network`** the container will have its own network stack
13
+
***`mount`** the container will have an isolated mount table
14
+
***`ipc`** processes inside the container will only be able to communicate to other processes inside the same container via system level IPC
15
+
***`uts`** the container will be able to have its own hostname and domain name
16
+
***`user`** the container will be able to remap user and group IDs from the host to local users and groups within the container
17
+
18
+
***`path`***(string, optional)* - path to namespace file
19
+
9
20
If a path is specified, that particular file is used to join that type of namespace.
10
21
Also, when a path is specified, a runtime MUST assume that the setup for that particular namespace has already been done and error out if the config specifies anything else related to that namespace.
11
22
23
+
###### Example
24
+
12
25
```json
13
26
"namespaces": [
14
27
{
@@ -34,32 +47,27 @@ Also, when a path is specified, a runtime MUST assume that the setup for that pa
34
47
]
35
48
```
36
49
37
-
#### Namespace types
50
+
##Devices
38
51
39
-
***pid** processes inside the container will only be able to see other processes inside the same container.
40
-
***network** the container will have its own network stack.
41
-
***mount** the container will have an isolated mount table.
42
-
***ipc** processes inside the container will only be able to communicate to other processes inside the same
43
-
container via system level IPC.
44
-
***uts** the container will be able to have its own hostname and domain name.
45
-
***user** the container will be able to remap user and group IDs from the host to local users and groups
46
-
within the container.
52
+
`devices` is an array specifying the list of devices to be created in the container.
47
53
48
-
## Devices
54
+
The following parameters can be specified:
55
+
56
+
***`path`***(string, required)* - full path to device inside container
57
+
58
+
***`type`***(char, required)* - type of device: `c`, `b`, `u` or `p`. More info in `man mknod`.
49
59
50
-
Devices is an array specifying the list of devices to be created in the container.
51
-
Next parameters can be specified:
60
+
***`major, minor`***(int64, optional)* - major, minor numbers for device. More info in `man mknod`. There is a special value: `-1`, which means `*` for `device` cgroup setup.
52
61
53
-
***type** - type of device: `c`, `b`, `u` or `p`. More info in `man mknod`
54
-
***path** - full path to device inside container
55
-
***major, minor** - major, minor numbers for device. More info in `man mknod`.
56
-
There is special value: `-1`, which means `*` for `device`
57
-
cgroup setup.
58
-
***permissions** - cgroup permissions for device. A composition of `r`
59
-
(read), `w` (write), and `m` (mknod).
60
-
***fileMode** - file mode for device file
61
-
***uid** - uid of device owner
62
-
***gid** - gid of device owner
62
+
***`permissions`***(string, optional)* - cgroup permissions for device. A composition of `r` (*read*), `w` (*write*), and `m` (*mknod*).
63
+
64
+
***`fileMode`***(uint32, optional)* - file mode for device file
65
+
66
+
***`uid`***(uint32, optional)* - uid of device owner
67
+
68
+
***`gid`***(uint32, optional)* - gid of device owner
69
+
70
+
###### Example
63
71
64
72
```json
65
73
"devices": [
@@ -152,12 +160,38 @@ For example, to run a new process in an existing container without updating limi
152
160
153
161
#### Disable out-of-memory killer
154
162
163
+
`disableOOMKiller` contains a flag (`true` or `false`) that enables or disables
164
+
the Out of Memory killer for a cgroup. If enabled (`false`), tasks that attempt
165
+
to consume more memory than they are allowed are immediately killed by the OOM killer.
166
+
The OOM killer is enabled by default in every cgroup using the `memory` subsystem.
167
+
To disable it, specify a value of `true`.
168
+
For more information, see [the memory cgroup man page](https://www.kernel.org/doc/Documentation/cgroups/memory.txt).
169
+
170
+
###### Example
171
+
155
172
```json
156
173
"disableOOMKiller": false
157
174
```
158
175
159
176
#### Memory
160
177
178
+
`memory` represents the cgroup subsystem `memory` and it's used to set limits on memory use of the container.
179
+
For more information, see [the memory cgroup man page](https://www.kernel.org/doc/Documentation/cgroups/memory.txt).
180
+
181
+
The following parameters can be specified to setup the memory controller:
182
+
183
+
***`limit`***(uint64, optional)* - set limit of memory usage
184
+
185
+
***`reservation`***(uint64, optional)* - set soft limit of memory usage
186
+
187
+
***`swap`***(uint64, optional)* - set limit of memory+Swap usage
188
+
189
+
***`kernel`***(uint64, optional)* - set hard limit for kernel memory
190
+
191
+
***`swappiness`***(uint64, optional)* - set swappiness parameter of vmscan (See sysctl's vm.swappiness)
192
+
193
+
###### Example
194
+
161
195
```json
162
196
"memory": {
163
197
"limit": 0,
@@ -170,6 +204,27 @@ For example, to run a new process in an existing container without updating limi
170
204
171
205
#### CPU
172
206
207
+
`cpu` represents the cgroup subsystems `cpu` and `cpusets`.
208
+
For more information, see [the cpusets cgroup man page](https://www.kernel.org/doc/Documentation/cgroups/cpusets.txt).
209
+
210
+
The following parameters can be specified to setup the cpu controller:
211
+
212
+
***`shares`***(uint64, optional)* - specifies a relative share of CPU time available to the tasks in a cgroup
213
+
214
+
***`quota`***(uint64, optional)* - specifies the total amount of time in microseconds for which all tasks in a cgroup can run during one period (as defined by **`period`** below)
215
+
216
+
***`period`***(uint64, optional)* - specifies a period of time in microseconds for how regularly a cgroup's access to CPU resources should be reallocated (cfs scheduler only)
217
+
218
+
***`realtimeRuntime`***(uint64, optional)* - specifies a period of time in microseconds for the longest continuous period in which the tasks in a cgroup have access to CPU resources
219
+
220
+
***`realtimePeriod`***(uint64, optional)* - same as **`period`** but applies on realtime scheduler only
221
+
222
+
***`cpus`***(cpus, optional)* - list of CPUs the container will run in
223
+
224
+
***`mems`***(mems, optional)* - list of Memory Nodes the container will run in
225
+
226
+
###### Example
227
+
173
228
```json
174
229
"cpu": {
175
230
"shares": 0,
@@ -185,7 +240,7 @@ For example, to run a new process in an existing container without updating limi
185
240
#### Block IO Controller
186
241
187
242
`blockIO` represents the cgroup subsystem `blkio` which implements the block io controller.
188
-
For more information, see the [kernel cgroups documentation about `blkio`](https://www.kernel.org/doc/Documentation/cgroups/blkio-controller.txt).
243
+
For more information, see [the kernel cgroups documentation about blkio](https://www.kernel.org/doc/Documentation/cgroups/blkio-controller.txt).
189
244
190
245
The following parameters can be specified to setup the block io controller:
191
246
@@ -195,8 +250,8 @@ The following parameters can be specified to setup the block io controller:
195
250
196
251
***`blkioWeightDevice`***(array, optional)* - specifies the list of devices which will be bandwidth rate limited. The following parameters can be specified per-device:
197
252
***`major, minor`***(int64, required)* - major, minor numbers for device. More info in `man mknod`.
198
-
***`weight`***(uint16, optional)* - bandwidth rate for the device, range is from 10 to 1000.
199
-
***`leafWeight`***(uint16, optional)* - bandwidth rate for the device while competing with the cgroup's child cgroups, range is from 10 to 1000, cfq scheduler only.
253
+
***`weight`***(uint16, optional)* - bandwidth rate for the device, range is from 10 to 1000
254
+
***`leafWeight`***(uint16, optional)* - bandwidth rate for the device while competing with the cgroup's child cgroups, range is from 10 to 1000, cfq scheduler only
200
255
201
256
You must specify at least one of `weight` or `leafWeight` in a given entry, and can specify both.
202
257
@@ -242,6 +297,18 @@ The following parameters can be specified to setup the block io controller:
242
297
243
298
#### Huge page limits
244
299
300
+
`hugepageLimits` represents the `hugetlb` controller which allows to limit the
301
+
HugeTLB usage per control group and enforces the controller limit during page fault.
302
+
For more information, see the [kernel cgroups documentation about HugeTLB](https://www.kernel.org/doc/Documentation/cgroups/hugetlb.txt).
303
+
304
+
`hugepageLimits` is an array of entries, each having the following structure:
***`limit`***(uint64, required)* - limit of *hugepagesize* hugetlb usage
309
+
310
+
###### Example
311
+
245
312
```json
246
313
"hugepageLimits": [
247
314
{
@@ -253,9 +320,23 @@ The following parameters can be specified to setup the block io controller:
253
320
254
321
#### Network
255
322
323
+
`network` represents the cgroup subsystems `net_cls` and `net_prio`.
324
+
For more information, see [the net\_cls cgroup man page](https://www.kernel.org/doc/Documentation/cgroups/net_cls.txt) and [the net\_prio cgroup man page](https://www.kernel.org/doc/Documentation/cgroups/net_prio.txt).
325
+
326
+
The following parameters can be specified to setup these cgroup controllers:
327
+
328
+
***`classID`***(string, optional)* - network class identifier the cgroup's network packets will be tagged with
329
+
330
+
***`priorities`***(array, optional)* - specifies a list of map of the priorities assigned to traffic originating from
331
+
processes in the group and egressing the system on various interfaces. The following parameters can be specified per-map:
332
+
* **`name`***(string, required)* - interface name
333
+
* **`priority`***(uint32, required)* - priority applied to the interface
334
+
335
+
###### Example
336
+
256
337
```json
257
338
"network": {
258
-
"classId": "ClassId",
339
+
"classID": "0x100001",
259
340
"priorities": [
260
341
{
261
342
"name": "eth0",
@@ -269,11 +350,31 @@ The following parameters can be specified to setup the block io controller:
269
350
}
270
351
```
271
352
353
+
#### Pids
354
+
355
+
`pids` represents the cgroup subsystem `pids`.
356
+
For more information, see [the pids cgroup man page](https://www.kernel.org/doc/Documentation/cgroups/pids.txt
357
+
).
358
+
359
+
The following paramters can be specified to setup the pids controller:
360
+
361
+
***`limit`***(int, required)* - specifies the maximum number of tasks in the cgroup
362
+
363
+
###### Example
364
+
365
+
```json
366
+
"pids": {
367
+
"limit": 32771
368
+
}
369
+
```
370
+
272
371
## Sysctl
273
372
274
373
sysctl allows kernel parameters to be modified at runtime for the container.
275
374
For more information, see [the man page](http://man7.org/linux/man-pages/man8/sysctl.8.html)
`type` is a string with a value from those defined in [the man page](http://man7.org/linux/man-pages/man2/setrlimit.2.html).
288
389
The kernel enforces the `soft` limit for a resource while the `hard` limit acts as a ceiling for that value that could be set by an unprivileged process.
289
390
391
+
###### Example
392
+
290
393
```json
291
394
"rlimits": [
292
395
{
@@ -301,6 +404,9 @@ The kernel enforces the `soft` limit for a resource while the `hard` limit acts
301
404
302
405
SELinux process label specifies the label with which the processes in a container are run.
303
406
For more information about SELinux, see [Selinux documentation](http://selinuxproject.org/page/Main_Page)
@@ -310,6 +416,8 @@ For more information about SELinux, see [Selinux documentation](http://selinuxp
310
416
Apparmor profile specifies the name of the apparmor profile that will be used for the container.
311
417
For more information about Apparmor, see [Apparmor documentation](https://wiki.ubuntu.com/AppArmor)
312
418
419
+
###### Example
420
+
313
421
```json
314
422
"apparmorProfile": "acme_secure_profile"
315
423
```
@@ -321,6 +429,8 @@ Seccomp configuration allows one to configure actions to take for matched syscal
321
429
For more information about Seccomp, see [Seccomp kernel documentation](https://www.kernel.org/doc/Documentation/prctl/seccomp_filter.txt)
322
430
The actions and operators are strings that match the definitions in seccomp.h from [libseccomp](https://github.com/seccomp/libseccomp) and are translated to corresponding values.
323
431
432
+
###### Example
433
+
324
434
```json
325
435
"seccomp": {
326
436
"defaultAction": "SCMP_ACT_ALLOW",
@@ -339,6 +449,8 @@ rootfsPropagation sets the rootfs's mount propagation.
339
449
Its value is either slave, private, or shared.
340
450
[The kernel doc](https://www.kernel.org/doc/Documentation/filesystems/sharedsubtree.txt) has more information about mount propagation.
0 commit comments