Skip to content

Commit

Permalink
docs: add documentation for privileged and host devices
Browse files Browse the repository at this point in the history
This commit adds documentation for privileged containers and the mounting of host devices
when privileged is used. It has instructions for disabling this functionality when using
Containerd and CRI.

Fixes kata-containers#529

Signed-off-by: Alex Price <[email protected]>
  • Loading branch information
awprice committed Aug 22, 2019
1 parent 66b3590 commit 49f225f
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Limitations.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ This is also true with using `securityContext privileged=true` with Kubernetes.
The container may also be granted full access to a subset of host devices
(https://github.com/kata-containers/runtime/issues/1568).

See [Privileged Kata Containers](how-to/privileged.md) for how to configure some of this behaviour.

# Miscellaneous

This section lists limitations where the possible solutions are uncertain.
Expand Down
1 change: 1 addition & 0 deletions how-to/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
- [Setting Sysctls with Kata](how-to-use-sysctls-with-kata.md)
- [What Is VMCache and How To Enable It](what-is-vm-cache-and-how-do-I-use-it.md)
- [What Is VM Templating and How To Enable It](what-is-vm-templating-and-how-do-I-use-it.md)
- [Privileged Kata Containers](privileged.md)
45 changes: 45 additions & 0 deletions how-to/privileged.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Privileged Kata Containers

Kata Containers supports creation of containers that are "privileged" - i.e. have additional capabilities and access
that isn't normally granted.

* [Caveats](#caveats)
* [Host Devices](#host-devices)
* [Containerd and CRI](#containerd-and-cri)

## Caveats

Whilst this functionality is supported, it can decrease the security of Kata Containers if not configured correctly.

### Host Devices

By default, when privileged is enabled for a container, all of the `/dev/*` block devices from the host are mounted
into the guest. This will allow the privileged container inside the Kata guest to gain access to mount any block device
from the host, a potentially undesirable side-effect that decreases the security of Kata.

The following sections document how to configure this behaviour in different container runtimes.

#### Containerd and CRI

The Containerd CRI allows configuring the privileged host devices behaviour for each runtime in the CRI config. This is
done with the `privileged_without_host_devices` option. Setting this to `true` will disable hot plugging of the host
devices into the guest, even when privileged is enabled.

See below example config:

```toml
[plugins]
[plugins.cri]
[plugins.cri.containerd]
[plugins.cri.containerd.default_runtime]
runtime_type = "io.containerd.runtime.v1.linux"
privileged_without_host_devices = false
[plugins.cri.containerd.runtimes.kata]
runtime_type = "io.containerd.kata.v2"
privileged_without_host_devices = true
[plugins.cri.containerd.runtimes.kata.options]
ConfigPath = "/opt/kata/share/defaults/kata-containers/configuration.toml"
```

- [Kata Containers with Containerd and CRI documentation](how-to-use-k8s-with-cri-containerd-and-kata.md)
- [Containerd CRI config documentation](https://github.com/containerd/cri/blob/master/docs/config.md)

0 comments on commit 49f225f

Please sign in to comment.