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]>
@@ -6,11 +6,24 @@ A namespace wraps a global system resource in an abstraction that makes it appea
6
6
Changes to the global resource are visible to other processes that are members of the namespace, but are invisible to other processes.
7
7
For more information, see [the man page](http://man7.org/linux/man-pages/man7/namespaces.7.html).
8
8
9
-
Namespaces are specified in the spec as an array of entries.
10
-
Each entry has a type field with possible values described below and an optional path element.
9
+
Namespaces are specified as an array of entries inside the `namespaces` root field.
10
+
The following parameters can be specified to setup namespaces:
11
+
12
+
***`type`***(string, required)* - namespace type. The following namespaces types are supported:
13
+
***`pid`** processes inside the container will only be able to see other processes inside the same container
14
+
***`network`** the container will have its own network stack
15
+
***`mount`** the container will have an isolated mount table
16
+
***`ipc`** processes inside the container will only be able to communicate to other processes inside the same container via system level IPC
17
+
***`uts`** the container will be able to have its own hostname and domain name
18
+
***`user`** the container will be able to remap user and group IDs from the host to local users and groups within the container
19
+
20
+
***`path`***(string, optional)* - path to namespace file
21
+
11
22
If a path is specified, that particular file is used to join that type of namespace.
12
23
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.
13
24
25
+
###### Example
26
+
14
27
```json
15
28
"namespaces": [
16
29
{
@@ -36,32 +49,29 @@ Also, when a path is specified, a runtime MUST assume that the setup for that pa
36
49
]
37
50
```
38
51
39
-
#### Namespace types
52
+
##Devices
40
53
41
-
***`pid`** processes inside the container will only be able to see other processes inside the same container.
42
-
***`network`** the container will have its own network stack.
43
-
***`mount`** the container will have an isolated mount table.
44
-
***`ipc`** processes inside the container will only be able to communicate to other processes inside the same
45
-
container via system level IPC.
46
-
***`uts`** the container will be able to have its own hostname and domain name.
47
-
***`user`** the container will be able to remap user and group IDs from the host to local users and groups
48
-
within the container.
54
+
`devices` is an array specifying the list of devices to be created in the container.
49
55
50
-
## Devices
56
+
The following parameters can be specified:
57
+
58
+
***`type`***(char, required)* - type of device: `c`, `b`, `u` or `p`. More info in `man mknod`.
59
+
60
+
***`path`***(string, optional)* - full path to device inside container
61
+
62
+
***`major, minor`***(int64, required)* - major, minor numbers for device. More info in `man mknod`. There is a special value: `-1`, which means `*` for `device` cgroup setup.
51
63
52
-
Devices is an array specifying the list of devices to be created in the container.
53
-
Next parameters can be specified:
64
+
***`permissions`***(string, optional)* - cgroup permissions for device. A composition of `r` (*read*), `w` (*write*), and `m` (*mknod*).
54
65
55
-
***`type`** - type of device: `c`, `b`, `u` or `p`. More info in `man mknod`
56
-
***`path`** - full path to device inside container
57
-
***`major, minor`** - major, minor numbers for device. More info in `man mknod`.
58
-
There is special value: `-1`, which means `*` for `device`
59
-
cgroup setup.
60
-
***`permissions`** - cgroup permissions for device. A composition of `r`
61
-
(read), `w` (write), and `m` (mknod).
62
-
***`fileMode`** - file mode for device file
63
-
***`uid`** - uid of device owner
64
-
***`gid`** - gid of device owner
66
+
***`fileMode`***(uint32, optional)* - file mode for device file
67
+
68
+
***`uid`***(uint32, optional)* - uid of device owner
69
+
70
+
***`gid`***(uint32, optional)* - gid of device owner
71
+
72
+
**`fileMode`**, **`uid`** and **`gid`** are required if **`path`** is given and are otherwise not allowed.
73
+
74
+
###### Example
65
75
66
76
```json
67
77
"devices": [
@@ -154,12 +164,39 @@ For example, to run a new process in an existing container without updating limi
154
164
155
165
#### Disable out-of-memory killer
156
166
167
+
`disableOOMKiller` contains a boolean (`true` or `false`) that enables or disables the Out of Memory killer for a cgroup.
168
+
If enabled (`false`), tasks that attempt to consume more memory than they are allowed are immediately killed by the OOM killer.
169
+
The OOM killer is enabled by default in every cgroup using the `memory` subsystem.
170
+
To disable it, specify a value of `true`.
171
+
For more information, see [the memory cgroup man page](https://www.kernel.org/doc/Documentation/cgroups/memory.txt).
172
+
173
+
***`disableOOMKiller`***(bool, optional)* - enables or disables the OOM killer
174
+
175
+
###### Example
176
+
157
177
```json
158
178
"disableOOMKiller": false
159
179
```
160
180
161
181
#### Memory
162
182
183
+
`memory` represents the cgroup subsystem `memory` and it's used to set limits on the container's memory usage.
184
+
For more information, see [the memory cgroup man page](https://www.kernel.org/doc/Documentation/cgroups/memory.txt).
185
+
186
+
The following parameters can be specified to setup the controller:
187
+
188
+
***`limit`***(uint64, optional)* - sets limit of memory usage
189
+
190
+
***`reservation`***(uint64, optional)* - sets soft limit of memory usage
191
+
192
+
***`swap`***(uint64, optional)* - sets limit of memory+Swap usage
193
+
194
+
***`kernel`***(uint64, optional)* - sets hard limit for kernel memory
195
+
196
+
***`swappiness`***(uint64, optional)* - sets swappiness parameter of vmscan (See sysctl's vm.swappiness)
197
+
198
+
###### Example
199
+
163
200
```json
164
201
"memory": {
165
202
"limit": 0,
@@ -172,6 +209,27 @@ For example, to run a new process in an existing container without updating limi
172
209
173
210
#### CPU
174
211
212
+
`cpu` represents the cgroup subsystems `cpu` and `cpusets`.
213
+
For more information, see [the cpusets cgroup man page](https://www.kernel.org/doc/Documentation/cgroups/cpusets.txt).
214
+
215
+
The following parameters can be specified to setup the controller:
216
+
217
+
***`shares`***(uint64, optional)* - specifies a relative share of CPU time available to the tasks in a cgroup
218
+
219
+
***`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)
220
+
221
+
***`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)
222
+
223
+
***`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
224
+
225
+
***`realtimePeriod`***(uint64, optional)* - same as **`period`** but applies to realtime scheduler only
226
+
227
+
***`cpus`***(cpus, optional)* - list of CPUs the container will run in
228
+
229
+
***`mems`***(mems, optional)* - list of Memory Nodes the container will run in
230
+
231
+
###### Example
232
+
175
233
```json
176
234
"cpu": {
177
235
"shares": 0,
@@ -187,18 +245,18 @@ For example, to run a new process in an existing container without updating limi
187
245
#### Block IO Controller
188
246
189
247
`blockIO` represents the cgroup subsystem `blkio` which implements the block io controller.
190
-
For more information, see the [kernel cgroups documentation about `blkio`](https://www.kernel.org/doc/Documentation/cgroups/blkio-controller.txt).
248
+
For more information, see [the kernel cgroups documentation about blkio](https://www.kernel.org/doc/Documentation/cgroups/blkio-controller.txt).
191
249
192
-
The following parameters can be specified to setup the block io controller:
250
+
The following parameters can be specified to setup the controller:
193
251
194
252
***`blkioWeight`***(uint16, optional)* - specifies per-cgroup weight. This is default weight of the group on all devices until and unless overridden by per-device rules. The range is from 10 to 1000.
195
253
196
254
***`blkioLeafWeight`***(uint16, optional)* - equivalents of `blkioWeight` for the purpose of deciding how much weight tasks in the given cgroup has while competing with the cgroup's child cgroups. The range is from 10 to 1000.
197
255
198
256
***`blkioWeightDevice`***(array, optional)* - specifies the list of devices which will be bandwidth rate limited. The following parameters can be specified per-device:
199
257
***`major, minor`***(int64, required)* - major, minor numbers for device. More info in `man mknod`.
200
-
***`weight`***(uint16, optional)* - bandwidth rate for the device, range is from 10 to 1000.
201
-
***`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.
258
+
***`weight`***(uint16, optional)* - bandwidth rate for the device, range is from 10 to 1000
259
+
***`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
202
260
203
261
You must specify at least one of `weight` or `leafWeight` in a given entry, and can specify both.
204
262
@@ -244,6 +302,18 @@ The following parameters can be specified to setup the block io controller:
244
302
245
303
#### Huge page limits
246
304
305
+
`hugepageLimits` represents the `hugetlb` controller which allows to limit the
306
+
HugeTLB usage per control group and enforces the controller limit during page fault.
307
+
For more information, see the [kernel cgroups documentation about HugeTLB](https://www.kernel.org/doc/Documentation/cgroups/hugetlb.txt).
308
+
309
+
`hugepageLimits` is an array of entries, each having the following structure:
***`limit`***(uint64, required)* - limit in bytes of *hugepagesize* HugeTLB usage
314
+
315
+
###### Example
316
+
247
317
```json
248
318
"hugepageLimits": [
249
319
{
@@ -255,9 +325,23 @@ The following parameters can be specified to setup the block io controller:
255
325
256
326
#### Network
257
327
328
+
`network` represents the cgroup subsystems `net_cls` and `net_prio`.
329
+
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).
330
+
331
+
The following parameters can be specified to setup these cgroup controllers:
332
+
333
+
***`classID`***(string, optional)* - is the network class identifier the cgroup's network packets will be tagged with
334
+
335
+
***`priorities`***(array, optional)* - specifies a list of objects of the priorities assigned to traffic originating from
336
+
processes in the group and egressing the system on various interfaces. The following parameters can be specified per-priority:
337
+
* **`name`***(string, required)* - interface name
338
+
* **`priority`***(uint32, required)* - priority applied to the interface
339
+
340
+
###### Example
341
+
258
342
```json
259
343
"network": {
260
-
"classId": "ClassId",
344
+
"classID": "0x100001",
261
345
"priorities": [
262
346
{
263
347
"name": "eth0",
@@ -271,11 +355,31 @@ The following parameters can be specified to setup the block io controller:
271
355
}
272
356
```
273
357
358
+
#### PIDs
359
+
360
+
`pids` represents the cgroup subsystem `pids`.
361
+
For more information, see [the pids cgroup man page](https://www.kernel.org/doc/Documentation/cgroups/pids.txt
362
+
).
363
+
364
+
The following paramters can be specified to setup the controller:
365
+
366
+
***`limit`***(int64, required)* - specifies the maximum number of tasks in the cgroup
367
+
368
+
###### Example
369
+
370
+
```json
371
+
"pids": {
372
+
"limit": 32771
373
+
}
374
+
```
375
+
274
376
## Sysctl
275
377
276
378
sysctl allows kernel parameters to be modified at runtime for the container.
277
379
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).
290
394
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.
291
395
396
+
###### Example
397
+
292
398
```json
293
399
"rlimits": [
294
400
{
@@ -303,6 +409,9 @@ The kernel enforces the `soft` limit for a resource while the `hard` limit acts
303
409
304
410
SELinux process label specifies the label with which the processes in a container are run.
305
411
For more information about SELinux, see [Selinux documentation](http://selinuxproject.org/page/Main_Page)
0 commit comments