-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from songjiaxun/fix_doc
doc: improve documentations following SMB driver repo
- Loading branch information
Showing
19 changed files
with
341 additions
and
210 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# CSI driver example | ||
|
||
After the NFS CSI Driver is deployed in your cluster, you can follow this documentation to quickly deploy some examples. | ||
|
||
You can use NFS CSI Driver to provision Persistent Volumes statically or dynamically. Please read [Kubernetes Persistent Volumes documentation](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) for more information about Static and Dynamic provisioning. | ||
|
||
Please refer to [driver parameters](../../docs/driver-parameters.md) for more detailed usage. | ||
|
||
## Prerequisite | ||
|
||
- [Set up a NFS Server on a Kubernetes cluster](./nfs-provisioner/README.md) | ||
- [Install NFS CSI Driver](../../docs/install-csi-driver.md) | ||
|
||
## Storage Class Usage (Dynamic Provisioning) | ||
|
||
- Follow the folling command to create a `StorageClass`, and then `PersistentVolume` and `PersistentVolumeClaim` dynamically. | ||
|
||
```bash | ||
# create StorageClass | ||
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/storageclass-nfs.yaml | ||
|
||
# create PVC | ||
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/pvc-nfs-csi-dynamic.yaml | ||
``` | ||
|
||
## PV/PVC Usage (Static Provisioning) | ||
|
||
- Follow the folling command to create `PersistentVolume` and `PersistentVolumeClaim` statically. | ||
|
||
```bash | ||
# create PV | ||
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/pv-nfs-csi.yaml | ||
|
||
# create PVC | ||
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/pvc-nfs-csi-static.yaml | ||
``` |
86 changes: 43 additions & 43 deletions
86
examples/deployment.yaml → deploy/example/deployment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,43 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: pvc-deployment-nfs | ||
spec: | ||
accessModes: | ||
- ReadWriteMany # In this example, multiple Pods consume the same PVC. | ||
resources: | ||
requests: | ||
storage: 10Gi | ||
storageClassName: nfs-csi | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: deployment-nfs-rwm | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
name: deployment-nfs-rwm | ||
template: | ||
metadata: | ||
name: deployment-nfs-rwm | ||
labels: | ||
name: deployment-nfs-rwm | ||
spec: | ||
containers: | ||
containers: | ||
- name: deployment-nfs-rwm | ||
image: mcr.microsoft.com/oss/nginx/nginx:1.17.3-alpine | ||
command: | ||
- "/bin/sh" | ||
- "-c" | ||
- while true; do echo $(hostname) $(date) >> /mnt/nfs/outfile; sleep 1; done | ||
volumeMounts: | ||
- name: nfs | ||
mountPath: "/mnt/nfs" | ||
volumes: | ||
- name: nfs | ||
persistentVolumeClaim: | ||
claimName: pvc-deployment-nfs | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: pvc-deployment-nfs | ||
spec: | ||
accessModes: | ||
- ReadWriteMany # In this example, multiple Pods consume the same PVC. | ||
resources: | ||
requests: | ||
storage: 10Gi | ||
storageClassName: nfs-csi | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: deployment-nfs | ||
spec: | ||
replicas: 3 | ||
selector: | ||
matchLabels: | ||
name: deployment-nfs | ||
template: | ||
metadata: | ||
name: deployment-nfs | ||
labels: | ||
name: deployment-nfs | ||
spec: | ||
containers: | ||
containers: | ||
- name: deployment-nfs | ||
image: mcr.microsoft.com/oss/nginx/nginx:1.17.3-alpine | ||
command: | ||
- "/bin/sh" | ||
- "-c" | ||
- while true; do echo $(hostname) $(date) >> /mnt/nfs/outfile; sleep 1; done | ||
volumeMounts: | ||
- name: nfs | ||
mountPath: "/mnt/nfs" | ||
volumes: | ||
- name: nfs | ||
persistentVolumeClaim: | ||
claimName: pvc-deployment-nfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Set up a NFS Server on a Kubernetes cluster | ||
|
||
After the NFS CSI Driver is deployed in your cluster, you can follow this documentation to quickly deploy some example applications. You can use NFS CSI Driver to provision Persistent Volumes statically or dynamically. Please read Kubernetes Persistent Volumes for more information about Static and Dynamic provisioning. | ||
|
||
There are multiple different NFS servers you can use for testing of | ||
the plugin, the major versions of the protocol v2, v3 and v4 should be supported | ||
by the current implementation. This page will show you how to set up a NFS Server deployment on a Kubernetes cluster. | ||
|
||
- To create a NFS provisioner on your Kubernetes cluster, run the following command. | ||
|
||
```bash | ||
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/nfs-provisioner/nfs-server.yaml | ||
``` | ||
|
||
- During the deployment, a new service `nfs-server` will be created which exposes the NFS server endpoint `nfs-server.default.svc.cluster.local` and the share path `/`. You can specify `PersistentVolume` or `StorageClass` using these information. | ||
|
||
- Deploy the NFS CSI driver, please refer to [install NFS CSI driver](../../../docs/install-csi-driver.md). | ||
|
||
- To check if the NFS server is working, we can statically create a PersistentVolume and a PersistentVolumeClaim, and mount it onto a sample pod: | ||
|
||
```bash | ||
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/csi-driver-nfs/master/deploy/example/nfs-provisioner/nginx-pod.yaml | ||
``` | ||
|
||
- Verify if the NFS server is functional, you can check the mount point from the example pod. | ||
|
||
```bash | ||
kubectl exec nginx-nfs-example -- bash -c "findmnt /var/www -o TARGET,SOURCE,FSTYPE" | ||
``` | ||
|
||
- The output should look like the following: | ||
|
||
```bash | ||
TARGET SOURCE FSTYPE | ||
/var/www nfs-server.default.svc.cluster.local:/ nfs4 | ||
``` |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
name: pv-nginx | ||
spec: | ||
capacity: | ||
storage: 10Gi | ||
accessModes: | ||
- ReadWriteOnce | ||
persistentVolumeReclaimPolicy: Delete | ||
mountOptions: | ||
- hard | ||
- nfsvers=4.1 | ||
csi: | ||
driver: nfs.csi.k8s.io | ||
readOnly: false | ||
volumeHandle: unique-volumeid # make sure it's a unique id in the cluster | ||
volumeAttributes: | ||
server: nfs-server.default.svc.cluster.local | ||
share: / | ||
--- | ||
kind: PersistentVolumeClaim | ||
apiVersion: v1 | ||
metadata: | ||
name: pvc-nginx | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: 10Gi | ||
volumeName: pv-nginx | ||
storageClassName: "" | ||
--- | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: nginx-nfs-example | ||
spec: | ||
containers: | ||
- image: nginx | ||
name: nginx | ||
ports: | ||
- containerPort: 80 | ||
protocol: TCP | ||
volumeMounts: | ||
- mountPath: /var/www | ||
name: pvc-nginx | ||
volumes: | ||
- name: pvc-nginx | ||
persistentVolumeClaim: | ||
claimName: pvc-nginx |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.