Skip to content

Commit fe22539

Browse files
committed
Add cinder volume examples
I can not find cinder examples,add in packages examples/volume and examples/persistent-volume-provisioning
1 parent fd85735 commit fe22539

File tree

4 files changed

+79
-0
lines changed

4 files changed

+79
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
kind: StorageClass
2+
apiVersion: storage.k8s.io/v1
3+
metadata:
4+
name: gold
5+
provisioner: kubernetes.io/cinder
6+
parameters:
7+
type: fast
8+
availability: nova
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: v1
2+
kind: ReplicationController
3+
metadata:
4+
name: server
5+
spec:
6+
replicas: 1
7+
selector:
8+
role: server
9+
template:
10+
metadata:
11+
labels:
12+
role: server
13+
spec:
14+
containers:
15+
- name: server
16+
image: nginx
17+
volumeMounts:
18+
- mountPath: /var/lib/www/html
19+
name: cinderpvc
20+
volumes:
21+
- name: cinderpvc
22+
persistentVolumeClaim:
23+
claimName: claim1

volumes/cinder/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
This is a simple web server pod which serves HTML from an Cinder volume.
2+
3+
Create a volume in the same tenant and zone as your node.
4+
5+
Add your volume information in the pod description file cinder-web.yaml then create the pod:
6+
7+
```shell
8+
$ kubectl create -f examples/volumes/cinder/cinder-web.yaml
9+
```
10+
11+
Add some data to the volume if is empty:
12+
13+
```sh
14+
$ echo "Hello World" >& /var/lib/kubelet/plugins/kubernetes.io/cinder/mounts/{Volume ID}/index.html
15+
```
16+
17+
You should now be able to query your web server:
18+
19+
```sh
20+
$ curl <Pod IP address>
21+
$ Hello World
22+
```
23+
24+
25+
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
26+
[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/examples/volumes/cinder/README.md?pixel)]()
27+
<!-- END MUNGE: GENERATED_ANALYTICS -->

volumes/cinder/cinder-web.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: cinder-web
5+
spec:
6+
containers:
7+
- name: web
8+
image: nginx
9+
ports:
10+
- name: web
11+
containerPort: 80
12+
protocol: tcp
13+
volumeMounts:
14+
- name: html-volume
15+
mountPath: "/usr/share/nginx/html"
16+
volumes:
17+
- name: html-volume
18+
cinder:
19+
# Enter the volume ID below
20+
volumeID: volume_ID
21+
fsType: ext4

0 commit comments

Comments
 (0)