|
1 | 1 | # Example
|
2 | 2 |
|
3 | 3 | The [Hostpath CSI driver](https://github.com/kubernetes-csi/csi-driver-host-path) is a simple sample driver that provisions a directory on the host. It can be used as an example to get started writing a driver, however it is not meant for production use.
|
4 |
| -The [deployment example](https://github.com/kubernetes-csi/csi-driver-host-path/tree/master/deploy) shows how to deploy and use that driver in Kubernetes. |
5 |
| - |
6 |
| -Deployment has been tested with Kubernetes v1.13 |
| 4 | +The [deployment example](https://github.com/kubernetes-csi/csi-driver-host-path#deployment) shows how to deploy and use that driver in Kubernetes. |
7 | 5 |
|
8 | 6 | The example deployment uses the original RBAC rule files that are maintained together with sidecar apps and deploys into the default namespace. A real production should copy the RBAC files and customize them as explained in the comments of those files.
|
9 | 7 |
|
10 |
| -The example deployment includes livenessprobe side-container provided by the CSI community, using configuration derived from [using-livenessprobe](https://github.com/kubernetes-csi/livenessprobe#using-livenessprobe). |
11 |
| - |
12 |
| -## Snapshot support |
13 |
| - |
14 |
| -Deployment example starts the snapshotter pod. |
15 |
| - |
16 |
| -> |
17 |
| -> $ kubectl get volumesnapshotclass |
18 |
| -> ``` |
19 |
| -> NAME AGE |
20 |
| -> csi-hostpath-snapclass 11s |
21 |
| -> ``` |
22 |
| -> |
23 |
| -> $ kubectl describe volumesnapshotclass |
24 |
| -> ``` |
25 |
| -> Name: csi-hostpath-snapclass |
26 |
| -> Namespace: |
27 |
| -> Labels: <none> |
28 |
| -> Annotations: <none> |
29 |
| -> API Version: snapshot.storage.k8s.io/v1alpha1 |
30 |
| -> Kind: VolumeSnapshotClass |
31 |
| -> Metadata: |
32 |
| -> Creation Timestamp: 2018-10-03T14:15:30Z |
33 |
| -> Generation: 1 |
34 |
| -> Resource Version: 2418 |
35 |
| -> Self Link: /apis/snapshot.storage.k8s.io/v1alpha1/volumesnapshotclasses/csi-hostpath-snapclass |
36 |
| -> UID: c8f5bc47-c716-11e8-8911-000c2967769a |
37 |
| -> Snapshotter: csi-hostpath |
38 |
| -> Events: <none> |
39 |
| -> ``` |
40 |
| -
|
41 |
| -Use the volume snapshot class to dynamically create a volume snapshot: |
42 |
| -
|
43 |
| -> $ kubectl create -f [https://raw.githubusercontent.com/kubernetes-csi/docs/387dce893e59c1fcf3f4192cbea254440b6f0f07/book/src/example/snapshot/csi-snapshot.yaml](https://github.com/kubernetes-csi/docs/blob/387dce893e59c1fcf3f4192cbea254440b6f0f07/book/src/example/snapshot/csi-snapshot.yaml) |
44 |
| -> `volumesnapshot.snapshot.storage.k8s.io/new-snapshot-demo created` |
45 |
| -> |
46 |
| -> $ kubectl get volumesnapshot |
47 |
| -> ``` |
48 |
| -> NAME AGE |
49 |
| -> new-snapshot-demo 12s |
50 |
| -> ``` |
51 |
| -> |
52 |
| -> $ kubectl get volumesnapshotcontent |
53 |
| ->``` |
54 |
| -> NAME AGE |
55 |
| -> snapcontent-f55db632-c716-11e8-8911-000c2967769a 14s |
56 |
| -> ``` |
57 |
| -> |
58 |
| -> $ kubectl describe volumesnapshot |
59 |
| -> ``` |
60 |
| -> Name: new-snapshot-demo |
61 |
| -> Namespace: default |
62 |
| -> Labels: <none> |
63 |
| -> Annotations: <none> |
64 |
| -> API Version: snapshot.storage.k8s.io/v1alpha1 |
65 |
| -> Kind: VolumeSnapshot |
66 |
| -> Metadata: |
67 |
| -> Creation Timestamp: 2018-10-03T14:16:45Z |
68 |
| -> Generation: 1 |
69 |
| -> Resource Version: 2476 |
70 |
| -> Self Link: /apis/snapshot.storage.k8s.io/v1alpha1/namespaces/default/volumesnapshots/new-snapshot-demo |
71 |
| -> UID: f55db632-c716-11e8-8911-000c2967769a |
72 |
| -> Spec: |
73 |
| -> Snapshot Class Name: csi-hostpath-snapclass |
74 |
| -> Snapshot Content Name: snapcontent-f55db632-c716-11e8-8911-000c2967769a |
75 |
| -> Source: |
76 |
| -> Kind: PersistentVolumeClaim |
77 |
| -> Name: csi-pvc |
78 |
| -> Status: |
79 |
| -> Creation Time: 2018-10-03T14:16:45Z |
80 |
| -> Ready: true |
81 |
| -> Restore Size: 1Gi |
82 |
| -> Events: <none> |
83 |
| -> ``` |
84 |
| -> |
85 |
| -> $ kubectl describe volumesnapshotcontent |
86 |
| -> ``` |
87 |
| -> Name: snapcontent-f55db632-c716-11e8-8911-000c2967769a |
88 |
| -> Namespace: |
89 |
| -> Labels: <none> |
90 |
| -> Annotations: <none> |
91 |
| -> API Version: snapshot.storage.k8s.io/v1alpha1 |
92 |
| -> Kind: VolumeSnapshotContent |
93 |
| -> Metadata: |
94 |
| -> Creation Timestamp: 2018-10-03T14:16:45Z |
95 |
| -> Generation: 1 |
96 |
| -> Resource Version: 2474 |
97 |
| -> Self Link: /apis/snapshot.storage.k8s.io/v1alpha1/volumesnapshotcontents/snapcontent-f55db632-c716-11e8-8911-000c2967769a |
98 |
| -> UID: f561411f-c716-11e8-8911-000c2967769a |
99 |
| -> Spec: |
100 |
| -> Csi Volume Snapshot Source: |
101 |
| -> Creation Time: 1538576205471577525 |
102 |
| -> Driver: csi-hostpath |
103 |
| -> Restore Size: 1073741824 |
104 |
| -> Snapshot Handle: f55ff979-c716-11e8-bb16-000c2967769a |
105 |
| -> Persistent Volume Ref: |
106 |
| -> API Version: v1 |
107 |
| -> Kind: PersistentVolume |
108 |
| -> Name: pvc-0571cc14-c714-11e8-8911-000c2967769a |
109 |
| -> Resource Version: 1573 |
110 |
| -> UID: 0575b966-c714-11e8-8911-000c2967769a |
111 |
| -> Snapshot Class Name: csi-hostpath-snapclass |
112 |
| -> Volume Snapshot Ref: |
113 |
| -> API Version: snapshot.storage.k8s.io/v1alpha1 |
114 |
| -> Kind: VolumeSnapshot |
115 |
| -> Name: new-snapshot-demo |
116 |
| -> Namespace: default |
117 |
| -> Resource Version: 2472 |
118 |
| -> UID: f55db632-c716-11e8-8911-000c2967769a |
119 |
| -> Events: <none> |
120 |
| -> ``` |
121 |
| -
|
122 |
| -## Restore volume from snapshot support |
123 |
| -
|
124 |
| -Follow the following example to create a volume from a volume snapshot: |
125 |
| -
|
126 |
| -> $ kubectl create -f [https://raw.githubusercontent.com/kubernetes-csi/docs/387dce893e59c1fcf3f4192cbea254440b6f0f07/book/src/example/snapshot/csi-restore.yaml](https://github.com/kubernetes-csi/docs/blob/387dce893e59c1fcf3f4192cbea254440b6f0f07/book/src/example/snapshot/csi-restore.yaml) |
127 |
| -> `persistentvolumeclaim/hpvc-restore created` |
128 |
| -> |
129 |
| -> $ kubectl get pvc |
130 |
| -> ``` |
131 |
| -> NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE |
132 |
| -> csi-pvc Bound pvc-0571cc14-c714-11e8-8911-000c2967769a 1Gi RWO csi-hostpath-sc 24m |
133 |
| -> hpvc-restore Bound pvc-77324684-c717-11e8-8911-000c2967769a 1Gi RWO csi-hostpath-sc 6s |
134 |
| -> ``` |
135 |
| -> |
136 |
| -> $ kubectl get pv |
137 |
| -> ``` |
138 |
| -> NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE |
139 |
| -> pvc-0571cc14-c714-11e8-8911-000c2967769a 1Gi RWO Delete Bound default/csi-pvc csi-hostpath-sc 25m |
140 |
| -> pvc-77324684-c717-11e8-8911-000c2967769a 1Gi RWO Delete Bound default/hpvc-restore csi-hostpath-sc 33s |
141 |
| -> ``` |
142 |
| -
|
143 |
| -If you encounter any problems, please check the [Troubleshooting page](Troubleshooting.html). |
| 8 | +If you encounter any problems, please check the [Troubleshooting page](troubleshooting.html). |
0 commit comments