Skip to content

Create a Network File System(NFS) Server with Google Compute Engine persistent disks and mount them to GKE containers.

License

Notifications You must be signed in to change notification settings

reisbel/gke-nfs-persistence-volume

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

gke-nfs-persistence-volume

Create a Network File System(NFS) Server with Google Compute Engine persistent disks and mount them to GKE containers.

Steps

Clone repository

git clone https://github.com/reisbel/gke-nfs-persistence-volume.git && cd gke-nfs-persistence-volume

Set variables

NAME=gke-cluster01
ZONE=us-central1-c
NUM_NODES=2
MACHINE_TYPE=n1-standard-1

Create GKE cluster

gcloud container clusters create $NAME \
--zone $ZONE \
--username "admin" \
--cluster-version "latest" \
--machine-type $MACHINE_TYPE \
--disk-type "pd-ssd" \
--disk-size "100" \
--num-nodes $NUM_NODES \
--enable-cloud-logging \
--enable-cloud-monitoring \
--network "default" \
--addons HorizontalPodAutoscaling,HttpLoadBalancing,KubernetesDashboard

Get cluster

gcloud container clusters get-credentials $NAME --zone $ZONE

Create persistence disk

gcloud compute disks create --size=50GB --zone=$ZONE gce-nfs-disk --type=pd-ssd

Create NFS Server

kubectl apply -f config/nfs-server.yaml

Create NFS service

kubectl apply -f config/nfs-server-service.yaml

Create Volume

kubectl apply -f config/pv-and-pvc-nfs.yaml

Connect to nfs to create dummy content

kubectl exec -it nfs-server-76c5f866d8-b5vq4 -- /bin/bash

Write content

cd /nfsshare
echo "<h1>Welcome to NFS</h1>" > index.html
exit

Deploy Nginx server

kubectl apply -f config/nginx-deployment.yaml

Create service for Nginx

kubectl apply -f config/nginx-service.yaml

References

https://medium.com/platformer-blog/nfs-persistent-volumes-with-kubernetes-a-case-study-ce1ed6e2c266

License

MIT - See LICENSE for more information.

About

Create a Network File System(NFS) Server with Google Compute Engine persistent disks and mount them to GKE containers.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published