From bd68007f80890475372b94b7881215947250b0cd Mon Sep 17 00:00:00 2001 From: Huamin Chen Date: Mon, 7 Mar 2016 20:00:48 +0000 Subject: [PATCH 1/3] better NFS example doc Signed-off-by: Huamin Chen --- examples/nfs/README.md | 72 +++++++++++++++--- examples/nfs/nfs-data/Dockerfile | 15 +++- examples/nfs/nfs-data/README.md | 9 ++- examples/nfs/nfs-data/run_nfs.sh | 72 ++++++++++++++++++ examples/nfs/nfs-pv.png | Bin 0 -> 9379 bytes examples/nfs/nfs-pv.yaml | 4 +- examples/nfs/nfs-server-rc.yaml | 11 ++- examples/nfs/nfs-server-service.yaml | 5 +- .../nfs/provisioner/nfs-server-gce-pv.yaml | 13 ++++ 9 files changed, 180 insertions(+), 21 deletions(-) create mode 100755 examples/nfs/nfs-data/run_nfs.sh create mode 100644 examples/nfs/nfs-pv.png create mode 100644 examples/nfs/provisioner/nfs-server-gce-pv.yaml diff --git a/examples/nfs/README.md b/examples/nfs/README.md index 9eb0f7b8968..a1fa2a84556 100644 --- a/examples/nfs/README.md +++ b/examples/nfs/README.md @@ -32,9 +32,51 @@ Documentation for other releases can be found at -# Example of NFS volume +# Outline -See [nfs-web-rc.yaml](nfs-web-rc.yaml) for a quick example of how to use an NFS +This example describes how to create Web frontend server, an auto-provisioned persistent volume on GCE, and an NFS-backed persistent claim. + +Demonstrated Kubernetes Concepts: + +* [Persistent Volumes](http://kubernetes.io/docs/user-guide/persistent-volumes/) to + define persistent disks (disk lifecycle not tied to the Pods). +* [Services](http://kubernetes.io/docs/user-guide/services/) to enable Pods to + locate one another. + +![alt text][nfs pv example] + +As illustrated above, two persistent volumes are used in this example: + +- Web frontend Pod uses a persistent volume based on NFS server, and +- NFS server uses an auto provisioned [persistent volume](http://kubernetes.io/docs/user-guide/persistent-volumes/) from GCE PD or AWS EBS. + +Note, this example uses an NFS container that doesn't support NFSv4. + +[nfs pv example]: nfs-pv.png + + +## tl;dr Quickstart + +```console +$ kubectl create -f examples/nfs/provisioner/nfs-server-gce-pv.yaml +$ kubectl create -f examples/nfs/nfs-server-rc.yaml +$ kubectl create -f examples/nfs/nfs-server-service.yaml +# get the cluster IP of the server using the following command +$ kubectl describe services nfs-server +# use the NFS server IP to update nfs-pv.yaml and execute the following +$ kubectl create -f examples/nfs/nfs-pv.yaml +$ kubectl create -f examples/nfs/nfs-pvc.yaml +# run a fake backend +$ kubectl create -f examples/nfs/nfs-busybox-rc.yaml +# get pod name from this command +$ kubectl get pod -l name=nfs-busybox +# use the pod name to check the test file +$ kubectl exec nfs-busybox-jdhf3 -- cat /mnt/index.html +``` + +## Example of NFS based persistent volume + +See [NFS Service and Replication Controller](nfs-web-rc.yaml) for a quick example of how to use an NFS volume claim in a replication controller. It relies on the [NFS persistent volume](nfs-pv.yaml) and [NFS persistent volume claim](nfs-pvc.yaml) in this example as well. @@ -46,19 +88,24 @@ controller and import it into two replication controllers. ### NFS server part -Define [NFS server controller](nfs-server-rc.yaml) and +Define [the NFS Service and Replication Controller](nfs-server-rc.yaml) and [NFS service](nfs-server-service.yaml): +The NFS server exports an an auto-provisioned persistent volume backed by GCE PD: + +```console +$ kubectl create -f examples/nfs/provisioner/nfs-server-gce-pv.yaml +``` + ```console $ kubectl create -f examples/nfs/nfs-server-rc.yaml $ kubectl create -f examples/nfs/nfs-server-service.yaml ``` -The server exports `/mnt/data` directory as `/` (fsid=0). The -directory contains dummy `index.html`. Wait until the pod is running -by checking `kubectl get pods -lrole=nfs-server`. +The directory contains dummy `index.html`. Wait until the pod is running +by checking `kubectl get pods -l role=nfs-server`. -### Create the NFS claim +### Create the NFS based persistent volume claim The [NFS busybox controller](nfs-busybox-rc.yaml) uses a simple script to generate data written to the NFS server we just started. First, you'll need to @@ -95,7 +142,7 @@ Conveniently, it's also a `busybox` pod, so we can get an early check that our mounts are working now. Find a busybox pod and exec: ```console -$ kubectl get pod -lname=nfs-busybox +$ kubectl get pod -l name=nfs-busybox NAME READY STATUS RESTARTS AGE nfs-busybox-jdhf3 1/1 Running 0 25m nfs-busybox-w3s4t 1/1 Running 0 25m @@ -132,7 +179,7 @@ We can then use the busybox container we launched before to check that `nginx` is serving the data appropriately: ```console -$ kubectl get pod -lname=nfs-busybox +$ kubectl get pod -l name=nfs-busybox NAME READY STATUS RESTARTS AGE nfs-busybox-jdhf3 1/1 Running 0 1h nfs-busybox-w3s4t 1/1 Running 0 1h @@ -145,6 +192,13 @@ nfs-busybox-w3s4t ``` + + + + + + + [![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/examples/nfs/README.md?pixel)]() diff --git a/examples/nfs/nfs-data/Dockerfile b/examples/nfs/nfs-data/Dockerfile index 77735a1ed1a..ae7615b8f10 100644 --- a/examples/nfs/nfs-data/Dockerfile +++ b/examples/nfs/nfs-data/Dockerfile @@ -12,8 +12,15 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM jsafrane/nfsexporter -MAINTAINER Jan Safranek -ADD index.html /mnt/data/index.html +FROM centos +MAINTAINER Jan Safranek, jsafrane@redhat.com; Huamin Chen, hchen@redhat.com +RUN yum -y install /usr/bin/ps nfs-utils && yum clean all +RUN mkdir -p /exports +ADD run_nfs.sh /usr/local/bin/ +ADD index.html /tmp/index.html +RUN chmod 644 /tmp/index.html -ENTRYPOINT ["/usr/local/bin/run_nfs", "/mnt/data"] +# expose mountd 20048/tcp and nfsd 2049/tcp +EXPOSE 2049/tcp 20048/tcp + +ENTRYPOINT ["/usr/local/bin/run_nfs.sh", "/exports"] diff --git a/examples/nfs/nfs-data/README.md b/examples/nfs/nfs-data/README.md index 9384b531349..a2ee9092513 100644 --- a/examples/nfs/nfs-data/README.md +++ b/examples/nfs/nfs-data/README.md @@ -34,11 +34,12 @@ Documentation for other releases can be found at # NFS-exporter container with a file -This container exports /mnt/data with index.html in it via NFSv4. Based on -../exporter. +This container exports /exports with index.html in it via NFS. Based on +../exports. Since some Linux kernels have issues running NFSv4 daemons in containers, +only NFSv3 is opened in this container. + +Available as `gcr.io/google-samples/nfs-server` -Available in dockerhub as -[jsafrane/nfs-data](https://registry.hub.docker.com/u/jsafrane/nfs-data/). diff --git a/examples/nfs/nfs-data/run_nfs.sh b/examples/nfs/nfs-data/run_nfs.sh new file mode 100755 index 00000000000..1714d352597 --- /dev/null +++ b/examples/nfs/nfs-data/run_nfs.sh @@ -0,0 +1,72 @@ +#!/bin/bash + +# Copyright 2015 The Kubernetes Authors All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +function start() +{ + + # prepare /etc/exports + for i in "$@"; do + # fsid=0: needed for NFSv4 + echo "$i *(rw,fsid=0,insecure,no_root_squash)" >> /etc/exports + # move index.html to here + /bin/cp /tmp/index.html $i/ + chmod 644 $i/index.html + echo "Serving $i" + done + + # start rpcbind if it is not started yet + /usr/sbin/rpcinfo 127.0.0.1 > /dev/null; s=$? + if [ $s -ne 0 ]; then + echo "Starting rpcbind" + /usr/sbin/rpcbind -w + fi + + mount -t nfsd nfds /proc/fs/nfsd + + # -N 4.x: disable NFSv4 + # -V 3: enable NFSv3 + /usr/sbin/rpc.mountd -N 2 -V 3 -N 4 -N 4.1 + + /usr/sbin/exportfs -r + # -G 10 to reduce grace time to 10 seconds (the lowest allowed) + /usr/sbin/rpc.nfsd -G 10 -N 2 -V 3 -N 4 -N 4.1 2 + /usr/sbin/rpc.statd --no-notify + echo "NFS started" +} + +function stop() +{ + echo "Stopping NFS" + + /usr/sbin/rpc.nfsd 0 + /usr/sbin/exportfs -au + /usr/sbin/exportfs -f + + kill $( pidof rpc.mountd ) + umount /proc/fs/nfsd + echo > /etc/exports + exit 0 +} + + +trap stop TERM + +start "$@" + +# Ugly hack to do nothing and wait for SIGTERM +while true; do + sleep 5 +done diff --git a/examples/nfs/nfs-pv.png b/examples/nfs/nfs-pv.png new file mode 100644 index 0000000000000000000000000000000000000000..1ac5fc0d1ac3a2c380236195a358c9f0f3ff6386 GIT binary patch literal 9379 zcmcJV3pmsN|Mw@AbTE~o9M(Z!9UMC7OJeIlQqfm(Hj;##a+o=6rt&2brJBCNI-z89 zh+)H&qO8bqGBa`*#%RZ@b=~*ngX^=yXP@o!em!5$=i{}M zzwE5nt=_sC0)ecvIc<3X0#U$$U*AKTqolA3z}6AU2lA zFGlA~vx3W?n={En52|=E_jHtJPhYybyytYn{o6Yaq$i4+BXT1@Jbn5p`FmB7V>j`{ zd&cp#>z|XjW(ttyqw-*+0;EB_3I|!GIs}C%>{wFRb}Uhz^n7<8Wi@2k9F4fI)H!f@ z1Oo*#N`B`7!Q5OUf9*|m@{gzF)EO8hU>8~hIJM|!fA@Ed`sONlABkMZSh3mrF#83n zDMeucp1cZoBHlgX{MsP(OY*2Kvc_ZE&&|`Tf=#zWBvq*by(t>~;l^c5jozL=hR&-d z`c>cku9Of=+$`h0YrTcZebyMLlfF0rx&>I=r>ZG7wnc#ooy)J zyawkMxUig+)k{n8t<#oOd?{U7zYapbcGYMGB2>J3Dlqz9#Nn{i@olJ<_EY zyWQq4z2Umem}ilL`2%lz&g5|};71z+h?NiMbfL#2CH^(3D43Z%Cw8LrNA!p`^an08 zhbcUM_T;oBWed#f!$jnylWAP|5GbE#PqQYhoS@jjZTC4jd9;as2fnrU15$_(@v10&Flk^F&fkclIXPeBI zgyyXkIw&Mfy6&=JAaO}1Be{(YjKf<@AcHl9L$uKwSJLk5+Kj~34WRTYg7>-N=j2fn zex1fr%&xMtIgo^Aog}%AVL?Cwb%;&=eay~_<@yf_0zwMfAKcKC#oj$8NxFLgTB5Gu zBW@dukyYgRy3Pyf!dk*9ud1GTVI=pTf(hH)B(_FN`IMxC)m9MDSF%yG^_Kg5jxXUt z>rt+sZ7!!u0kTqOPT3+RZc`uMOU+8|X0L|D)t8hUvB`Ww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w#T%0T5@<9URYJWSz($ zE*I1zJq6O2!bN?XO!L}?z2WS=AxtNr_NK_}0u#NoO8->(_k%SZ#?y_s)<{Twqv3lT z(TPS5$9fm;L?;=4DPg?PwVAn41EOqv=l-U1Ti3rtMN*??L8v>e)%=zcHWu&ha)&Hq z^bSCpfWH_05^t%rE>0S0Hg~)RwWbD)k+R2lsJeIsh{JlBd`tQxFv!=tg?9h!>uMMt zc9>pHT^#SlLLTpYB`|3M2OY3K&z?EHupUlw94?qh#2KOgd#S~0)W{vnmu?Q z9nlmJGbKMYe1PZPL%%>`yt(LzaxNG^_c8cE?E}$BzBEg!-9#_|5RZ z=6BKve%#JHck}8hYYjV-+T5FQ8M)TDdgh;Nxn`pg4lTBsBhyUV+G~DPP1Opd#TVaH zLxsAdg`cD=x~&ljvBug<<1-5LKF&i%CyrtEk@tb&Dp$zQNu?!z{8?sj1Kan}pRoPr z4{E8!4e56z-RtMN!QS4ehWhF9(Gp|R>UDxL)ujg6H1B3fhNevERY+;CT|=1Gj-^co zEz-+ONOL(8jw5)Rs2+c7@oz=@(dJTIaok|9$`)A*`uOAhVy&J-0t*#wSuCL9QTZy3o2*v14xwPOp?qYH*y50;#yJKsP2u^rLLF9Um1+dttg97Z> z?Rr!Vq*kw20GnCy;|24~)ShD*7tTW@#}^QS-KJU9?0a!S3Ywz`iBOdpx$U?f)1aI{ poD!4r*y)1+)%_3i-EVTGcZK6Ki5It2gKr%{Y^>}oNhdDd{BNvlm2?0A literal 0 HcmV?d00001 diff --git a/examples/nfs/nfs-pv.yaml b/examples/nfs/nfs-pv.yaml index 1bc043f905f..258f4d4c9d4 100644 --- a/examples/nfs/nfs-pv.yaml +++ b/examples/nfs/nfs-pv.yaml @@ -9,5 +9,5 @@ spec: - ReadWriteMany nfs: # FIXME: use the right IP - server: 10.999.999.999 - path: "/" + server: 10.244.1.4 + path: "/exports" diff --git a/examples/nfs/nfs-server-rc.yaml b/examples/nfs/nfs-server-rc.yaml index 15c40140802..6c1f00ebf2c 100644 --- a/examples/nfs/nfs-server-rc.yaml +++ b/examples/nfs/nfs-server-rc.yaml @@ -13,9 +13,18 @@ spec: spec: containers: - name: nfs-server - image: gcr.io/google_containers/volume-nfs + image: gcr.io/google-samples/nfs-server:1.0 ports: - name: nfs containerPort: 2049 + - name: mountd + containerPort: 20048 securityContext: privileged: true + volumeMounts: + - mountPath: /exports + name: mypvc + volumes: + - name: mypvc + persistentVolumeClaim: + claimName: nfs-pv-provisioning-demo diff --git a/examples/nfs/nfs-server-service.yaml b/examples/nfs/nfs-server-service.yaml index a9966c3fce1..5b6ec6014e2 100644 --- a/examples/nfs/nfs-server-service.yaml +++ b/examples/nfs/nfs-server-service.yaml @@ -4,6 +4,9 @@ metadata: name: nfs-server spec: ports: - - port: 2049 + - name: nfs + port: 2049 + - name: mountd + port: 20048 selector: role: nfs-server diff --git a/examples/nfs/provisioner/nfs-server-gce-pv.yaml b/examples/nfs/provisioner/nfs-server-gce-pv.yaml new file mode 100644 index 00000000000..92f9f573584 --- /dev/null +++ b/examples/nfs/provisioner/nfs-server-gce-pv.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: nfs-pv-provisioning-demo + labels: + demo: nfs-pv-provisioning + annotations: + volume.alpha.kubernetes.io/storage-class: any +spec: + accessModes: [ "ReadWriteOnce" ] + resources: + requests: + storage: 200Gi From 3411f4349df5400f887d851850a1de8009540458 Mon Sep 17 00:00:00 2001 From: Huamin Chen Date: Tue, 10 May 2016 18:24:24 +0000 Subject: [PATCH 2/3] expose rpcbind service, so nfs client can use service IP to access NFS share Signed-off-by: Huamin Chen --- examples/nfs/nfs-data/Dockerfile | 4 ++-- examples/nfs/nfs-server-rc.yaml | 4 +++- examples/nfs/nfs-server-service.yaml | 2 ++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/examples/nfs/nfs-data/Dockerfile b/examples/nfs/nfs-data/Dockerfile index ae7615b8f10..6a9c689120f 100644 --- a/examples/nfs/nfs-data/Dockerfile +++ b/examples/nfs/nfs-data/Dockerfile @@ -20,7 +20,7 @@ ADD run_nfs.sh /usr/local/bin/ ADD index.html /tmp/index.html RUN chmod 644 /tmp/index.html -# expose mountd 20048/tcp and nfsd 2049/tcp -EXPOSE 2049/tcp 20048/tcp +# expose mountd 20048/tcp and nfsd 2049/tcp and rpcbind 111/tcp +EXPOSE 2049/tcp 20048/tcp 111/tcp 111/udp ENTRYPOINT ["/usr/local/bin/run_nfs.sh", "/exports"] diff --git a/examples/nfs/nfs-server-rc.yaml b/examples/nfs/nfs-server-rc.yaml index 6c1f00ebf2c..91649264c12 100644 --- a/examples/nfs/nfs-server-rc.yaml +++ b/examples/nfs/nfs-server-rc.yaml @@ -13,12 +13,14 @@ spec: spec: containers: - name: nfs-server - image: gcr.io/google-samples/nfs-server:1.0 + image: hchen/nfs3-server:latest #gcr.io/google-samples/nfs-server:1.0 ports: - name: nfs containerPort: 2049 - name: mountd containerPort: 20048 + - name: rpcbind + containerPort: 111 securityContext: privileged: true volumeMounts: diff --git a/examples/nfs/nfs-server-service.yaml b/examples/nfs/nfs-server-service.yaml index 5b6ec6014e2..9654d158384 100644 --- a/examples/nfs/nfs-server-service.yaml +++ b/examples/nfs/nfs-server-service.yaml @@ -8,5 +8,7 @@ spec: port: 2049 - name: mountd port: 20048 + - name: rpcbind + port: 111 selector: role: nfs-server From 722911af0b22281f2a9206fcc50bf34194cd001c Mon Sep 17 00:00:00 2001 From: Huamin Chen Date: Fri, 20 May 2016 17:40:23 -0400 Subject: [PATCH 3/3] update to latest gcr image Signed-off-by: Huamin Chen --- examples/nfs/nfs-server-rc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/nfs/nfs-server-rc.yaml b/examples/nfs/nfs-server-rc.yaml index 91649264c12..c83ed1db876 100644 --- a/examples/nfs/nfs-server-rc.yaml +++ b/examples/nfs/nfs-server-rc.yaml @@ -13,7 +13,7 @@ spec: spec: containers: - name: nfs-server - image: hchen/nfs3-server:latest #gcr.io/google-samples/nfs-server:1.0 + image: gcr.io/google-samples/nfs-server:1.1 ports: - name: nfs containerPort: 2049