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: book/src/ephemeral-local-volumes.md
+24-1Lines changed: 24 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,9 @@ Beta | >=1.16 | -
13
13
14
14
Status | Min K8s Version | Max K8s Version
15
15
--|--|--
16
-
Alpha | 1.19 | -
16
+
Alpha | 1.19 | 1.20
17
+
Beta | 1.21 | 1.22
18
+
GA | 1.23
17
19
18
20
## Overview
19
21
Traditionally, volumes that are backed by CSI drivers can only be used
@@ -116,6 +118,16 @@ supports dynamic provisioning of volumes. No other changes are needed
116
118
in the driver in that case. Such a driver can also support CSI
117
119
ephemeral inline volumes if desired.
118
120
121
+
## Security Considerations
122
+
123
+
CSI driver vendors that choose to support ephemeral inline volumes are responsible for secure handling of these volumes, and special consideration needs to be given to what volumeAttributes are supported by the driver. As noted above, a CSI driver is not suitable for CSI ephemeral inline volumes when volume creation requires volumeAttributes that should be restricted to an administrator. These attributes are set directly in the Pod spec, and therefore are not automatically restricted to an administrator when used as an inline volume.
124
+
125
+
CSI inline volumes are only intended to be used for ephemeral storage, and driver vendors should NOT allow usage of inline volumes for persistent storage unless they also provide a third party pod admission plugin to restrict usage of these volumes.
126
+
127
+
Cluster administrators that wish to restrict which CSI drivers are allowed to be used as inline volumes within a Pod spec may do so by:
128
+
- removing `Ephemeral` from `volumeLifecycleModes` in the CSIDriver spec
129
+
- using a third party pod admission plugin
130
+
119
131
## Implementing CSI ephemeral inline support
120
132
121
133
Drivers must be modified (or implemented specifically) to support CSI inline
@@ -176,6 +188,17 @@ The driver is responsible of deleting the ephemeral volume once it has
176
188
unpublished the volume. It MAY delete the volume before finishing the request,
177
189
or after the request to unpublish is returned.
178
190
191
+
### Read-Only Volumes
192
+
193
+
It is possible for a CSI driver to provide volumes to Pods as read-only while allowing them to be writeable on the node for kubelet, the driver, and the container runtime. This allows the CSI driver to dynamically update contents of the volume without exposing issues like [CVE-2017-1002102](https://github.com/kubernetes/kubernetes/issues/60814), since the volume is read-only for the end user. It also allows the `fsGroup` and SELinux context of files to be applied on the node so the Pod gets the volume with the expected permissions and SELinux label.
194
+
195
+
To benefit from this behavior, the following can be implemented in the CSI driver:
196
+
- The driver provides an admission plugin that sets `ReadOnly: true` to all volumeMounts of such volumes. We can't trust that this will be done by every user on every pod.
197
+
- The driver checks that the `readonly` flag is set in all NodePublish requests. We can't trust that the admission plugin above is deployed on every cluster.
198
+
- When both conditions above are satisfied, the driver MAY ignore the `readonly` flag in [NodePublish](https://github.com/container-storage-interface/spec/blob/5b0d4540158a260cb3347ef1c87ede8600afb9bf/csi.proto#L1375) and set up the volume as read-write. Ignoring the `readonly` flag in NodePublish is considered valid CSI driver behavior for inline ephemeral volumes.
199
+
200
+
The presence of `ReadOnly: true` in the Pod spec tells kubelet to bind-mount the volume to the container as read-only, while the underlying mount is read-write on the host. This is the same behavior used for projected volumes like Secrets and ConfigMaps.
201
+
179
202
### CSIDriver
180
203
181
204
Kubernetes 1.16 only allows using a CSI driver for an inline volume if
0 commit comments