diff --git a/volumes/glusterfs/README.md b/volumes/glusterfs/README.md index 6b951340c..76ff1759c 100644 --- a/volumes/glusterfs/README.md +++ b/volumes/glusterfs/README.md @@ -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 @@ -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 @@ -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. @@ -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: diff --git a/volumes/glusterfs/glusterfs-endpoints.json b/volumes/glusterfs/glusterfs-endpoints.json deleted file mode 100644 index 740ce4258..000000000 --- a/volumes/glusterfs/glusterfs-endpoints.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "kind": "Endpoints", - "apiVersion": "v1", - "metadata": { - "name": "glusterfs-cluster" - }, - "subsets": [ - { - "addresses": [ - { - "ip": "10.240.106.152" - } - ], - "ports": [ - { - "port": 1 - } - ] - }, - { - "addresses": [ - { - "ip": "10.240.79.157" - } - ], - "ports": [ - { - "port": 1 - } - ] - } - ] -} diff --git a/volumes/glusterfs/glusterfs-pod.json b/volumes/glusterfs/glusterfs-pod.json deleted file mode 100644 index 63c075be6..000000000 --- a/volumes/glusterfs/glusterfs-pod.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "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 - } - } - ] - } -} diff --git a/volumes/glusterfs/glusterfs-pod.yaml b/volumes/glusterfs/glusterfs-pod.yaml new file mode 100644 index 000000000..79606c604 --- /dev/null +++ b/volumes/glusterfs/glusterfs-pod.yaml @@ -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 diff --git a/volumes/glusterfs/glusterfs-service.json b/volumes/glusterfs/glusterfs-service.json deleted file mode 100644 index 79139febd..000000000 --- a/volumes/glusterfs/glusterfs-service.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "kind": "Service", - "apiVersion": "v1", - "metadata": { - "name": "glusterfs-cluster" - }, - "spec": { - "ports": [ - {"port": 1} - ] - } -} diff --git a/volumes/glusterfs/glusterfs-service.yaml b/volumes/glusterfs/glusterfs-service.yaml new file mode 100644 index 000000000..0ec98aebd --- /dev/null +++ b/volumes/glusterfs/glusterfs-service.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: Service +metadata: + name: glusterfs-cluster +spec: + ports: + - port: 1 diff --git a/volumes/glusterfs/gsluterfs-endpoints.yaml b/volumes/glusterfs/gsluterfs-endpoints.yaml new file mode 100644 index 000000000..18bd5fc3e --- /dev/null +++ b/volumes/glusterfs/gsluterfs-endpoints.yaml @@ -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