![]() |
8 年之前 | |
---|---|---|
.. | ||
README.md | 8 年之前 | |
glusterfs-endpoints.json | 8 年之前 | |
glusterfs-pod.json | 8 年之前 | |
glusterfs-service.json | 8 年之前 |
Glusterfs is an open source scale-out filesystem. These examples provide information about how to allow containers use Glusterfs volumes.
The example assumes that you have already set up a Glusterfs server cluster and the Glusterfs client package is installed on all Kubernetes nodes.
Set up Glusterfs server cluster; install Glusterfs client package on the Kubernetes nodes. (Guide)
Here is a snippet of glusterfs-endpoints.json,
"addresses": [
{
"IP": "10.240.106.152"
}
],
"ports": [
{
"port": 1
}
]
The "IP" field should be filled with the address of a node in the Glusterfs server cluster. In this example, it is fine to give any valid value (from 1 to 65535) to the "port" field.
Create the endpoints,
$ kubectl create -f examples/volumes/glusterfs/glusterfs-endpoints.json
You can verify that the endpoints are successfully created by running
$ kubectl get endpoints
NAME ENDPOINTS
glusterfs-cluster 10.240.106.152:1,10.240.79.157:1
We need also create a service for this endpoints, so that the endpoints will be persistented. We will add this service without a selector to tell Kubernetes we want to add its endpoints manually. You can see glusterfs-service.json for details.
Use this command to create the service:
$ kubectl create -f examples/volumes/glusterfs/glusterfs-service.json
The following volume spec in glusterfs-pod.json illustrates a sample configuration.
{
"name": "glusterfsvol",
"glusterfs": {
"endpoints": "glusterfs-cluster",
"path": "kube_vol",
"readOnly": true
}
}
The parameters are explained as the followings.
Create a pod that has a container using Glusterfs volume,
$ kubectl create -f examples/volumes/glusterfs/glusterfs-pod.json
You can verify that the pod is running:
$ kubectl get pods
NAME READY STATUS RESTARTS AGE
glusterfs 1/1 Running 0 3m
$ kubectl get pods glusterfs -t '{{.status.hostIP}}{{"\n"}}'
10.240.169.172
You may ssh to the host (the hostIP) and run 'mount' to see if the Glusterfs volume is mounted,
$ mount | grep kube_vol
10.240.106.152:kube_vol on /var/lib/kubelet/pods/f164a571-fa68-11e4-ad5c-42010af019b7/volumes/kubernetes.io~glusterfs/glusterfsvol type fuse.glusterfs (rw,relatime,user_id=0,group_id=0,default_permissions,allow_other,max_read=131072)
You may also run docker ps
on the host to see the actual container.