Skip to content

Commit

Permalink
Merge pull request kubernetes#367 from natealcedo/update-glusterfs
Browse files Browse the repository at this point in the history
Update glusterfs volume example
  • Loading branch information
k8s-ci-robot authored Mar 8, 2020
2 parents 629c901 + 8129168 commit 7685f4e
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 105 deletions.
53 changes: 24 additions & 29 deletions volumes/glusterfs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,18 @@ have a working GlusterFS volume ready to use in the containers.
#### Create endpoints

The first step is to create the GlusterFS endpoints definition in Kubernetes.
Here is a snippet of [glusterfs-endpoints.json](glusterfs-endpoints.json):

```
"subsets": [
{
"addresses": [{ "ip": "10.240.106.152" }],
"ports": [{ "port": 1 }]
},
{
"addresses": [{ "ip": "10.240.79.157" }],
"ports": [{ "port": 1 }]
}
]
Here is a snippet of [glusterfs-endpoints.yaml](glusterfs-endpoints.yaml):

```yaml
subsets:
- addresses:
- ip: 10.240.106.152
ports:
- port: 1
- addresses:
- ip: 10.240.79.157
ports:
- port: 1
```
The `subsets` field should be populated with the addresses of the nodes in the
Expand All @@ -40,7 +39,7 @@ the `port` field.
Create the endpoints:

```sh
$ kubectl create -f examples/volumes/glusterfs/glusterfs-endpoints.json
$ kubectl create -f examples/volumes/glusterfs/glusterfs-endpoints.yaml
```

You can verify that the endpoints are successfully created by running
Expand All @@ -54,31 +53,27 @@ glusterfs-cluster 10.240.106.152:1,10.240.79.157:1
We also need to create a service for these endpoints, so that they will
persist. We will add this service without a selector to tell Kubernetes we want
to add its endpoints manually. You can see
[glusterfs-service.json](glusterfs-service.json) for details.
[glusterfs-service.yaml](glusterfs-service.yaml) for details.

Use this command to create the service:

```sh
$ kubectl create -f examples/volumes/glusterfs/glusterfs-service.json
$ kubectl create -f examples/volumes/glusterfs/glusterfs-service.yaml
```


#### Create a Pod

The following *volume* spec in [glusterfs-pod.json](glusterfs-pod.json)
The following *volume* spec in [glusterfs-pod.yaml](glusterfs-pod.yaml)
illustrates a sample configuration:

```json
"volumes": [
{
"name": "glusterfsvol",
"glusterfs": {
"endpoints": "glusterfs-cluster",
"path": "kube_vol",
"readOnly": true
}
}
]
```yaml
volumes:
- name: glusterfsvol
glusterfs:
endpoints: glusterfs-cluster
path: kube_vol
readOnly: true
```

The parameters are explained as the followings.
Expand All @@ -93,7 +88,7 @@ The parameters are explained as the followings.
Create a pod that has a container using Glusterfs volume,

```sh
$ kubectl create -f examples/volumes/glusterfs/glusterfs-pod.json
$ kubectl create -f examples/volumes/glusterfs/glusterfs-pod.yaml
```

You can verify that the pod is running:
Expand Down
33 changes: 0 additions & 33 deletions volumes/glusterfs/glusterfs-endpoints.json

This file was deleted.

31 changes: 0 additions & 31 deletions volumes/glusterfs/glusterfs-pod.json

This file was deleted.

17 changes: 17 additions & 0 deletions volumes/glusterfs/glusterfs-pod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Pod
metadata:
name: glusterfs
spec:
containers:
- name: glusterfs
image: nginx
volumeMounts:
- mountPath: "/mnt/glusterfs"
name: glusterfsvol
volumes:
- name: glusterfsvol
glusterfs:
endpoints: glusterfs-cluster
path: kube_vol
readOnly: true
12 changes: 0 additions & 12 deletions volumes/glusterfs/glusterfs-service.json

This file was deleted.

7 changes: 7 additions & 0 deletions volumes/glusterfs/glusterfs-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Service
metadata:
name: glusterfs-cluster
spec:
ports:
- port: 1
13 changes: 13 additions & 0 deletions volumes/glusterfs/gsluterfs-endpoints.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Endpoints
metadata:
name: glusterfs-cluster
subsets:
- addresses:
- ip: 10.240.106.152
ports:
- port: 1
- addresses:
- ip: 10.240.79.157
ports:
- port: 1

0 comments on commit 7685f4e

Please sign in to comment.