Coder Social home page Coder Social logo

k3d-nfs-dynamic-volumes's Introduction

NFS Dynamic Volumes with K3D

This shows how to setup dynamic provisioning of nfs volumes with k3d allowing you to have ReadWriteMany volumes in your k3d cluster. The nfs PV's are provisioned using the nfs-ganesha-serverand-external-provisioner which is backed by an initial PV created with local-path-provisioner. The instructions below show how to configure this setup using the default settings from the nfs-ganesha-server. The README on the nfs-ganesha-server has more details if you wish to modify the config of the nfs server or provisioner.

Instructions

  • Create a k3d cluster
docker volume create kube-nfs-volume
k3d cluster create nfs --agents 2 --volume kube-nfs-volume:/opt/local-path-provisioner --wait
k3d kubeconfig merge nfs -d
  • Install the local-path storage provisioner (will create a pvc to host the nfs share with this)
kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml
  • Install the nfs-ganesha provisioner
# create the rbac rules needed
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/nfs-ganesha-server-and-external-provisioner/master/deploy/kubernetes/rbac.yaml
# create the base pvc
kubectl create -f pvc.yaml
# create the deployment
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/nfs-ganesha-server-and-external-provisioner/master/deploy/kubernetes/deployment.yaml
# patch the deployment to use the pvc instead of the default hostPath volume
k patch deploy nfs-provisioner --type=json -p='[{"op": "replace", "path": "/spec/template/spec/volumes", "value": [{ "name": "export-volume", "persistentVolumeClaim": {"claimName": "ganesha-pvc"}}]}]'
# create the storage class
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/nfs-ganesha-server-and-external-provisioner/master/deploy/kubernetes/class.yaml

Now the nfs-provisioner deployment failed to start due to not being able to pull the image from quay.io. I tried pulling it locally to no avail. The image can be build locally but i used a mirror of it that was uploaded to Dockerhub here and pushed it into the cluster directly.

docker pull kvaps/nfs-ganesha-server-and-provisioner:latest
docker tag kvaps/nfs-ganesha-server-and-provisioner:latest quay.io/external_storage/nfs-ganesha-server-and-provisioner:latest
k3d image import quay.io/external_storage/nfs-ganesha-server-and-provisioner:latest -c nfs

The nfs-provisioner should now start. You can test the pvc creation and usage with:

kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/nfs-ganesha-server-and-external-provisioner/master/deploy/kubernetes/claim.yaml
kubectl create -f https://raw.githubusercontent.com/kubernetes-sigs/nfs-ganesha-server-and-external-provisioner/master/deploy/kubernetes/write-pod.yaml

k3d-nfs-dynamic-volumes's People

Contributors

kbristow avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.