-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add example for NFS provisioner #56
Merged
k8s-ci-robot
merged 1 commit into
kubernetes-csi:master
from
mayankshah1607:nfs-provisioner-example
Oct 10, 2020
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,18 @@ | ||
# Set up a NFS Server on a Kubernetes cluster | ||
|
||
> Note: This example is for development perspective only. Because the NFS server is sticky to the node it is scheduled on, data shall be lost if the pod is rescheduled on another node. | ||
|
||
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/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/csi-driver-nfs/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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: is there any special meaning of 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 | ||
mayankshah1607 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @msau42 , I have made the edit here mentioning that the example is for development only