Skip to content

Latest commit

 

History

History
82 lines (57 loc) · 2.38 KB

File metadata and controls

82 lines (57 loc) · 2.38 KB

NFS External Storage Provisioner

Introduction

This provisioner requires an External NFS Server to work. It dynamically creates Directories in the remote NFS Server

A guide to setting up dynamic NFS provisioning in Kubernetes

NFS Server Setup

Learn how to Mount and Use Block Volumes

This assumes that you have a storage Server with a block volume mounted on /mnt/external

You can look at the the Full Guide

  1. Install NFS Server and Create Directory to Shar
# Install the NFS Server
sudo apt update
sudo apt install nfs-kernel-server

# Create Volume
sudo mkdir /mnt/external/nfs -p
sudo chown nobody:nogroup /mnt/external/nfs
  1. Add the following to /etc/exports, Note that * shares to all clients. If you want to lock this down, you can put specific IPAddress
/mnt/external/nfs  *(rw,sync,no_subtree_check,no_root_squash,no_all_squash,insecure)
  1. Restart NFS Server
# export nfs share
sudo exportfs -rav
# restart server
sudo systemctl restart nfs-kernel-server

# Verify that it was exported
sudo showmount -e localhost
  1. Verify that all nodes can mount the NFS Server
# Install the NFS utils
sudo apt update
sudo apt install nfs-common

# Create Mount Point
sudo mkdir -p /mnt/nfs_clientshare

# Mount the NFS Share
mount 192.168.43.234:/mnt/external/nfs  /mnt/nfs_clientshare

# You can test with creating a file
touch sample-test.txt

# Then you cna verify it by checking /mnt/external/nfs on the storage server to see if you can see the file

# And finally, you can unmount with
umount /mnt/nfs_clientshare

NFS Storage Deployment

To Deploy the storage provisioner, After cloning the repository, simply update /storage/nfs-storage/deployment.yaml and replace the values labeled <<nfs-server-ip>> and optionally the path /mnt/external/nfs if you used something else

If you have no other storage class in your cluster and want to make this the default storage, simply uncomment the lines in /storage/nfs-storage/class.yaml

  # annotations:
  #   storageclass.kubernetes.io/is-default-class: "true"

And then you can deploy it simply using

kubectl create ns nfs-storage
kubectl apply -k nfs-storage