NFS Server Provisioner with RWX PVC Support for Scaling Web Front-ends

NFS Server Provisioner deploys a NFS server to the Kubernetes cluster, exposing shared-storage via the NFS volume plugin.  Unlike the VsphereVolume plugin, the NFS plugin supports ReadWriteMany (RMX) access-modes, regardless of whether the pods are colocated on a common node.  This allows users to scale out web front-ends while maintaining content consistancy from a central, persistant data source.

Example NFS Server Provisioner and RWM PVC for Scaling Web Frontends

Enter kube-system namespace

$ kubectl config set-context $(kubectl config current-context) --namespace=kube-system

Create a Default Storage Class

$ kubectl apply -f default-sc.yaml

Install Helm Client or

$ curl >

$ chmod 700

$ ./

Create the Tiller RBAC Policy

$ kubectl apply -f tiller-rbac.yaml

Initialize Tiller

$ helm init --service-account tiller

Edit the chart values.yaml (custom override)

Edited defaults to add persistance with a vsphere-volume, defined in the default storage class.

Note: Review sizes for both values.yml and corpweb-nfs-pvc.yaml before deploying.

Current values.yml - 120Gi

Current corpweb-nfs-pvc.yaml - 10Gi

Install the NFS Server Provisioner Chart

$ helm install stable/nfs-server-provisioner --name k8s-nfs-server -f values.yaml

Create the Namespace

$ kubectl create ns corp-lab

$ kubectl config set-context $(kubectl config current-context) --namespace=corp-lab

Create Persistent Volume Claim

$ kubectl apply -f corpweb-nfs-pvc.yaml

Apply Deployment, Service, and Ingress (Note: Will fail until PVC contains data)

$ kubectl apply -f corpweb-app.yaml

Copy Web Content to NFS volume

$ kubectl get pods

$ kubectl cp html <podname>:/usr/share/nginx/

$ kubectl exec -it <podname> /bin/bash

$ ls /usr/share/nginx/html/

$ exit

Scale out Deployment

$ kubectl scale --replicas=3 deploy/corpweb-deploy

$ kubectl get pods

Pick one of the new pods to verify the webcontent is available to it through the mounted NFS share

$ kubectl exec -it <2nd podname> /bin/bash

$ ls /usr/share/nginx/html/

$ exit

Get Ingress Path

$ kubectl get ingress

Test Browser Access

Example: http://corpweb.k8s01-app.lab.local

Replace image source

$ kubectl cp htmlv2/vmware_luv.jpg <2nd podname>:/usr/share/nginx/html

Refresh the browser to view the updated image

Sign in to be able to add comments.

Comments 0