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
Copy file name to clipboardexpand all lines: docs/concepts/storage/volumes.md
+19-2
Original file line number
Diff line number
Diff line change
@@ -141,22 +141,37 @@ spec:
141
141
### hostPath
142
142
143
143
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
145
145
powerful escape hatch for some applications.
146
146
147
147
For example, some uses for a `hostPath` are:
148
148
149
149
* running a container that needs access to Docker internals; use a `hostPath`
150
150
of `/var/lib/docker`
151
151
* 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 |
152
167
153
168
Watch out when using this type of volume, because:
154
169
155
170
* pods with identical configuration (such as created from a podTemplate) may
156
171
behave differently on different nodes due to different files on the nodes
157
172
* when Kubernetes adds resource-aware scheduling, as is planned, it will not be
158
173
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
160
175
either need to run your process as root in a
161
176
[privileged container](/docs/user-guide/security-context) or modify the file
162
177
permissions on the host to be able to write to a `hostPath` volume
0 commit comments