-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Mayank Shah <[email protected]>
- Loading branch information
1 parent
7fdf127
commit 22bb5db
Showing
4 changed files
with
119 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Set up a NFS Server 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/nfs-driver-smb/master/examples/kubernetes/nfs-provisioner/nfs-server.yaml | ||
``` | ||
|
||
After deploying, a new service `nfs-server` is created. The file share path is accessible at `nfs-server.default.svc.cluster.local/nfsshare`. | ||
|
||
To obtain a public IP for the service, run the following command instead | ||
|
||
```bash | ||
kubectl create -f https://raw.githubusercontent.com/kubernetes-csi/nfs-driver-smb/master/examples/kubernetes/nfs-provisioner/nfs-server-lb.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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
--- | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: nfs-server | ||
labels: | ||
app: nfs-server | ||
spec: | ||
type: LoadBalancer | ||
selector: | ||
app: nfs-server | ||
ports: | ||
- port: 2049 | ||
name: nfs-server | ||
--- | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: nfs-server | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: nfs-server | ||
template: | ||
metadata: | ||
name: nfs-server | ||
labels: | ||
app: nfs-server | ||
spec: | ||
containers: | ||
- name: nfs-server | ||
image: gcr.io/kubernetes-e2e-test-images/volume/nfs:1.0 | ||
ports: | ||
- containerPort: 2049 | ||
volumeMounts: | ||
- mountPath: /nfsshare | ||
name: data-volume | ||
volumes: | ||
name: data-volume | ||
hostPath: /nfsshare-volume | ||
type: DirectoryOrCreate |
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,42 @@ | ||
--- | ||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: nfs-server | ||
labels: | ||
app: nfs-server | ||
spec: | ||
type: ClusterIP # use "LoadBalancer" to get a public ip | ||
selector: | ||
app: nfs-server | ||
ports: | ||
- port: 2049 | ||
name: nfs-server | ||
--- | ||
kind: Deployment | ||
apiVersion: apps/v1 | ||
metadata: | ||
name: nfs-server | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: nfs-server | ||
template: | ||
metadata: | ||
name: nfs-server | ||
labels: | ||
app: nfs-server | ||
spec: | ||
containers: | ||
- name: nfs-server | ||
image: gcr.io/kubernetes-e2e-test-images/volume/nfs:1.0 | ||
ports: | ||
- containerPort: 2049 | ||
volumeMounts: | ||
- mountPath: /nfsshare | ||
name: data-volume | ||
volumes: | ||
name: data-volume | ||
hostPath: /nfsshare-volume | ||
type: DirectoryOrCreate |
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,20 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
name: pv-nfs | ||
spec: | ||
capacity: | ||
storage: 1Gi | ||
accessModes: | ||
- ReadWriteMany | ||
persistentVolumeReclaimPolicy: Retain | ||
mountOptions: | ||
- vers=3.0 | ||
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: /nfsshare |