Improves the README.md for nfs-client
This commit elaborates on how to deploy nfs-client as well as modify and
doing changes to the files before said deployment, updating the
README.md to make deployment easier.
(cherry picked from commit e2bee920ee)
This commit is contained in:
parent
0600d20ecc
commit
df0026975d
124
README.md
124
README.md
|
|
@ -1,50 +1,106 @@
|
||||||
# kubernetes nfs-client-provisioner
|
# Kubernetes NFS-Client Provisioner
|
||||||
|
|
||||||
[](https://quay.io/repository/external_storage/nfs-client-provisioner)
|
[](https://quay.io/repository/external_storage/nfs-client-provisioner)
|
||||||
|
|
||||||
- pv provisioned as ${namespace}-${pvcName}-${pvName}
|
|
||||||
- pv recycled as archieved-${namespace}-${pvcName}-${pvName}
|
|
||||||
|
|
||||||
# deploy
|
`nfs-client` is an automatic provisioner that used your *already configured* NFS server, automatically creating Persistent Volumes.
|
||||||
- modify and deploy `deploy/deployment.yaml`
|
|
||||||
- modify and deploy `deploy/class.yaml`
|
|
||||||
|
|
||||||
## ARM based
|
- Persistent volumes are provisioned as ${namespace}-${pvcName}-${pvName}
|
||||||
To deploy on ARM based (Raspberry PI) use `deploy/deployment-arm.yaml` instead of `deploy/deployment.yaml`
|
- Persistent volumes which are recycled as archieved-${namespace}-${pvcName}-${pvName}
|
||||||
|
|
||||||
# authorization
|
# How to deploy nfs-client to your cluster.
|
||||||
|
|
||||||
If your cluster has RBAC enabled or you are running OpenShift you must
|
To note, you must *already* have an NFS Server.
|
||||||
authorize the provisioner. If you are in a namespace/project other than
|
|
||||||
"default" either edit `deploy/auth/clusterrolebinding.yaml` or edit the `oadm
|
|
||||||
policy` command accordingly.
|
|
||||||
|
|
||||||
## RBAC
|
1. Editing:
|
||||||
```console
|
|
||||||
$ kubectl create -f deploy/auth/serviceaccount.yaml
|
Note: To deploy to an ARM-based environment, use: `deploy/deployment-arm.yaml` instead, otherwise use `deploy/deployment.yaml`.
|
||||||
serviceaccount "nfs-client-provisioner" created
|
Modify `deploy/deployment.yaml` and change the values to your own NFS server:
|
||||||
$ kubectl create -f deploy/auth/clusterrole.yaml
|
|
||||||
clusterrole "nfs-client-provisioner-runner" created
|
|
||||||
$ kubectl create -f deploy/auth/clusterrolebinding.yaml
|
```yaml
|
||||||
clusterrolebinding "run-nfs-client-provisioner" created
|
env:
|
||||||
$ kubectl patch deployment nfs-client-provisioner -p '{"spec":{"template":{"spec":{"serviceAccount":"nfs-client-provisioner"}}}}'
|
- name: PROVISIONER_NAME
|
||||||
|
value: fuseim.pri/ifs
|
||||||
|
- name: NFS_SERVER
|
||||||
|
value: 10.10.10.60
|
||||||
|
- name: NFS_PATH
|
||||||
|
value: /ifs/kubernetes
|
||||||
|
volumes:
|
||||||
|
- name: nfs-client-root
|
||||||
|
nfs:
|
||||||
|
server: 10.10.10.60
|
||||||
|
path: /ifs/kubernetes
|
||||||
```
|
```
|
||||||
|
|
||||||
## OpenShift
|
Modify `deploy/class.yaml` to match the same value indicated by `PROVISIONER_NAME`:
|
||||||
```console
|
|
||||||
$ oc create -f deploy/auth/serviceaccount.yaml
|
```yaml
|
||||||
|
apiVersion: storage.k8s.io/v1
|
||||||
|
kind: StorageClass
|
||||||
|
metadata:
|
||||||
|
name: managed-nfs-storage
|
||||||
|
provisioner: fuseim.pri/ifs # or choose another name, must match deployment's env PROVISIONER_NAME'
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Authorization
|
||||||
|
|
||||||
|
If your cluster has RBAC enabled or you are running OpenShift you must authorize the provisioner. If you are in a namespace/project other than "default" either edit `deploy/auth/clusterrolebinding.yaml` or edit the `oadm policy` command accordingly.
|
||||||
|
|
||||||
|
Kubernetes:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ kubectl create -f deploy/auth/serviceaccount.yaml -f deploy/auth/clusterrole.yaml -f deploy/auth/clusterrolebinding.yaml
|
||||||
|
serviceaccount "nfs-client-provisioner" created
|
||||||
|
clusterrole "nfs-client-provisioner-runner" created
|
||||||
|
clusterrolebinding "run-nfs-client-provisioner" created
|
||||||
|
```
|
||||||
|
|
||||||
|
OpenShift:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
$ oc create -f deploy/auth/openshift-clusterrole.yaml -f deploy/auth/serviceaccount.yaml
|
||||||
serviceaccount "nfs-client-provisioner" created
|
serviceaccount "nfs-client-provisioner" created
|
||||||
$ oc create -f deploy/auth/openshift-clusterrole.yaml
|
|
||||||
clusterrole "nfs-client-provisioner-runner" created
|
clusterrole "nfs-client-provisioner-runner" created
|
||||||
$ oadm policy add-scc-to-user hostmount-anyuid system:serviceaccount:default:nfs-client-provisioner
|
$ oadm policy add-scc-to-user hostmount-anyuid system:serviceaccount:default:nfs-client-provisioner
|
||||||
$ oadm policy add-cluster-role-to-user nfs-client-provisioner-runner system:serviceaccount:default:nfs-client-provisioner
|
$ oadm policy add-cluster-role-to-user nfs-client-provisioner-runner system:serviceaccount:default:nfs-client-provisioner
|
||||||
$ oc patch deployment nfs-client-provisioner -p '{"spec":{"template":{"spec":{"serviceAccount":"nfs-client-provisioner"}}}}'
|
|
||||||
```
|
```
|
||||||
|
|
||||||
# test
|
3. Finally, test your environment!
|
||||||
- `kubectl create -f deploy/test-claim.yaml`
|
|
||||||
- `kubectl create -f deploy/test-pod.yaml`
|
Now we'll test your NFS provisioner.
|
||||||
- check the folder and file "SUCCESS" created
|
|
||||||
- `kubectl delete -f deploy/test-pod.yaml`
|
Deploy:
|
||||||
- `kubectl delete -f deploy/test-claim.yaml`
|
|
||||||
- check the folder renamed to `archived-???`
|
```sh
|
||||||
|
$ kubectl create -f deploy/test-claim.yaml -f deploy/test-pod.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
Now check your NFS Server for the file `SUCCESS`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
kubectl delete -f deploy/test-pod.yaml -f deploy/test-claim.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
Now check the folder renamed to `archived-???`.
|
||||||
|
|
||||||
|
4. Deploying your own PersistentVolumeClaim
|
||||||
|
|
||||||
|
To deploy your own PVC, make sure that you have the correct `storage-class` as indicated by your `deploy/class.yaml` file.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
name: test-claim
|
||||||
|
annotations:
|
||||||
|
volume.beta.kubernetes.io/storage-class: "managed-nfs-storage"
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 1Mi
|
||||||
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue