Skip to content

Commit 7e8cf77

Browse files
committed
ephemeral volumes in Kubernetes 1.16
The CSIDriverInfo object was extended and the feature changed from alpha to beta.
1 parent 0e72d96 commit 7e8cf77

File tree

2 files changed

+39
-17
lines changed

2 files changed

+39
-17
lines changed

book/src/csi-driver-object.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ metadata:
2626
spec:
2727
attachRequired: true
2828
podInfoOnMount: true
29+
volumeLifecycleModes: # added in Kubernetes 1.16
30+
- Persistent
31+
- Ephemeral
2932
```
3033
3134
There are three important fields:
@@ -45,6 +48,13 @@ There are three important fields:
4548
* `"csi.storage.k8s.io/pod.namespace": pod.Namespace`
4649
* `"csi.storage.k8s.io/pod.uid": string(pod.UID)`
4750
* For more information see [Pod Info on Mount](pod-info.md).
51+
* `volumeLifecycleModes`
52+
* This field was added in Kubernetes 1.16 and cannot be set when using an older Kubernetes release.
53+
* It informs Kubernetes about the volume modes that are supported by the driver.
54+
This ensures that the driver [is not used incorrectly](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/20190122-csi-inline-volumes.md#support-for-inline-csi-volumes) by Kubernetes.
55+
The default is `Persistent`, which is the normal PVC/PV mechanism. `Ephemeral` enables
56+
[inline ephemeral volumes](ephemeral-local-volumes.md) in addition (when both
57+
are listed) or instead of normal volumes (when it is the only entry in the list).
4858

4959
## What creates the CSIDriver object?
5060

@@ -64,28 +74,31 @@ Using the `CSIDriver` object, it is now possible to query Kubernetes to get a li
6474

6575
```
6676
$> kubectl get csidrivers.storage.k8s.io
67-
NAME AGE
68-
csi-hostpath 2m
77+
NAME CREATED AT
78+
hostpath.csi.k8s.io 2019-09-13T09:58:43Z
6979
```
7080
Or get a more detailed view of your registered driver with:
7181
```
7282
$> kubectl describe csidrivers.storage.k8s.io
73-
Name: csi-hostpath
74-
Namespace:
83+
Name: hostpath.csi.k8s.io
84+
Namespace:
7585
Labels: <none>
76-
Annotations: <none>
86+
Annotations: kubectl.kubernetes.io/last-applied-configuration:
87+
{"apiVersion":"storage.k8s.io/v1beta1","kind":"CSIDriver","metadata":{"annotations":{},"name":"hostpath.csi.k8s.io"},"spec":{"podInfoOnMou...
7788
API Version: storage.k8s.io/v1beta1
7889
Kind: CSIDriver
7990
Metadata:
80-
Creation Timestamp: 2018-10-04T21:15:30Z
81-
Generation: 1
82-
Resource Version: 390
83-
Self Link: /apis/storage.k8s.io/v1beta1/csidrivers/csi-hostpath
84-
UID: 9f854aa6-c81a-11e8-bdce-000c29e88ff1
91+
Creation Timestamp: 2019-09-13T09:58:43Z
92+
Resource Version: 341
93+
Self Link: /apis/storage.k8s.io/v1beta1/csidrivers/hostpath.csi.k8s.io
94+
UID: 1860f2a1-85f8-4357-a933-c45e54f0c8e0
8595
Spec:
86-
Attach Required: true
87-
Pod Info On Mount: false
88-
Events: <none>
96+
Attach Required: true
97+
Pod Info On Mount: true
98+
Volume Lifecycle Modes:
99+
Persistent
100+
Ephemeral
101+
Events: <none>
89102
```
90103

91104
## Changes from Alpha to Beta

book/src/ephemeral-local-volumes.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
Status | Min K8s Version | Max K8s Version
66
--|--|--
7-
Alpha | 1.15 | -
7+
Alpha | 1.15 | 1.15
8+
Beta | 1.16 | -
89

910
## Overview
1011
Traditionally, volumes that are backed by CSI drivers can only be used with a `PersistentVolume` and `PersistentVolumeClaim` object combination. This feature supports ephemeral storage use cases and allows CSI volumes to be specified directly in the pod specification. At runtime, nested inline volumes follow the ephemeral lifecycle of their associated pods where the driver handles all phases of volume operations as pods are created and destroyed.
@@ -38,12 +39,20 @@ Drivers must be modified (or implemented specifically) to support inline ephemer
3839
- Identity service
3940
- Node service
4041

42+
Kubernetes 1.16 only allows using a CSI driver for an inline volume if
43+
its [`CSIDriverInfo`](csi-driver-object.md) object explicitly declares
44+
that the driver supports that kind of usage in its
45+
`volumeLifecycleModes` field. This is a safeguard against accidentally
46+
[using a driver the wrong way](https://github.com/kubernetes/enhancements/blob/master/keps/sig-storage/20190122-csi-inline-volumes.md#support-for-inline-csi-volumes).
47+
4148
### Feature gates
42-
To use inline volume, Kubernetes binaries must start with the `CSIInlineVolume` feature gate enabled:
49+
To use inline volume, Kubernetes 1.15 binaries must start with the `CSIInlineVolume` feature gate enabled:
4350
```
4451
--feature-gates=CSIInlineVolume=true
4552
```
4653

54+
Kubernetes >= 1.16 no longer needs this as the feature is enabled by default.
55+
4756
### Example implementation
48-
- [CSI Hostpath driver](https://github.com/kubernetes-csi/csi-driver-host-path) - an example driver that can be configured to support either PVC/PV or inline ephemeral volumes at runtime.
49-
- [Image populator plugin](https://github.com/kubernetes-csi/csi-driver-image-populator) - an example CSI driver plugin that uses a container image as a volume.
57+
- [CSI Hostpath driver](https://github.com/kubernetes-csi/csi-driver-host-path) - an example driver that supports both modes and determines the mode on a case-by-case basis (for Kubernetes 1.16) or can be deployed with support for just one of the two modes (for Kubernetes 1.15).
58+
- [Image populator plugin](https://github.com/kubernetes-csi/csi-driver-image-populator) - an example CSI driver plugin that uses a container image as a volume.

0 commit comments

Comments
 (0)