Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1deb0d8

Browse files
committedSep 19, 2017
add doc for hostpath type
1 parent 99fbc2b commit 1deb0d8

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed
 

‎docs/concepts/storage/volumes.md

+19-2
Original file line numberDiff line numberDiff line change
@@ -141,22 +141,37 @@ spec:
141141
### hostPath
142142
143143
A `hostPath` volume mounts a file or directory from the host node's filesystem
144-
into your pod. This is not something that most Pods will need, but it offers a
144+
into your pod. This is not something that most Pods will need, but it offers a
145145
powerful escape hatch for some applications.
146146

147147
For example, some uses for a `hostPath` are:
148148

149149
* running a container that needs access to Docker internals; use a `hostPath`
150150
of `/var/lib/docker`
151151
* running cAdvisor in a container; use a `hostPath` of `/dev/cgroups`
152+
* allowing a pod to specify whether a given hostPath should exist prior to the
153+
pod running, whether it should be created, and what it should exist as
154+
155+
Supported HostPath Types are:
156+
157+
| Value | Behavior |
158+
|:------|:---------|
159+
| *unset* | For backwards compatible, leave it empty if unset. **Default value**. |
160+
| `DirectoryOrCreate` | If nothing exists at the given path, an empty directory will be created there as needed with file mode 0755, having the same group and ownership with Kubelet. |
161+
| `Directory` | A directory must exist at the given path |
162+
| `FileOrCreate` | If nothing exists at the given path, an empty file will be created there as needed with file mode 0644, having the same group and ownership with Kubelet. |
163+
| `File` | A file must exist at the given path |
164+
| `Socket` | A UNIX socket must exist at the given path |
165+
| `CharDevice` | A character device must exist at the given path |
166+
| `BlockDevice` | A block device must exist at the given path |
152167

153168
Watch out when using this type of volume, because:
154169

155170
* pods with identical configuration (such as created from a podTemplate) may
156171
behave differently on different nodes due to different files on the nodes
157172
* when Kubernetes adds resource-aware scheduling, as is planned, it will not be
158173
able to account for resources used by a `hostPath`
159-
* the directories created on the underlying hosts are only writable by root. You
174+
* the files or directories created on the underlying hosts are only writable by root. You
160175
either need to run your process as root in a
161176
[privileged container](/docs/user-guide/security-context) or modify the file
162177
permissions on the host to be able to write to a `hostPath` volume
@@ -180,6 +195,8 @@ spec:
180195
hostPath:
181196
# directory location on host
182197
path: /data
198+
# this field is optional
199+
type: Directory
183200
```
184201

185202
### gcePersistentDisk

0 commit comments

Comments
 (0)
Please sign in to comment.