Repository: https://github.com/sharedvolume/nfs-server-controllerβ
Releases: https://github.com/sharedvolume/nfs-server-controller/releasesβ
A professional-grade Kubernetes operator that manages NFS servers as custom resources, providing dynamic provisioning and comprehensive lifecycle management of NFS services within your cluster. Part of the SharedVolume ecosystem for enterprise storage solutions.
NFS Server Controller is a professional-grade Kubernetes operator that provides enterprise-ready NFS server management through custom resources. It enables organizations to deploy and manage NFS servers declaratively within their Kubernetes clusters, offering a cloud-native approach to shared storage provisioning designed for production environments at scale.
Traditional NFS server deployment in Kubernetes environments involves:
The NFS Server Controller addresses these challenges by:
Define NFS servers using familiar Kubernetes YAML manifests with simple, intuitive specifications.
Complete automation of NFS server deployment, scaling, updates, and cleanup operations.
Support for both StorageClass-based dynamic provisioning and pre-existing PersistentVolume binding.
Configurable replica count for redundancy and improved availability of NFS services.
Real-time status updates, health checks, and comprehensive observability features.
Security-focused design with proper RBAC, network policies, and container security practices.
π Note: cert-manager is only required if you plan to enable webhook validation or secure metrics with TLS certificates. For basic NFS Server Controller functionality, cert-manager is not needed.
Install the CRDs and operator:
kubectl apply -f https://github.com/sharedvolume/nfs-server-controller/releases/latest/download/install.yaml
Or using kustomize:
kubectl apply -k config/default
Verify the installation:
kubectl get deployment -n nfs-server-controller-system
kubectl get crd nfsservers.sharedvolume.io
Create an NFS server using a StorageClass:
apiVersion: sharedvolume.io/v1alpha1
kind: NfsServer
metadata:
name: my-nfs-server
namespace: default
spec:
storage:
capacity: "10Gi"
storageClassName: "fast-ssd"
replicas: 2
path: "/shared"
Apply the configuration:
kubectl apply -f nfs-server.yaml
Once the NFS server is running, you can mount it in your pods:
apiVersion: v1
kind: Pod
metadata:
name: nfs-client
spec:
containers:
- name: app
image: nginx
volumeMounts:
- name: nfs-storage
mountPath: /data
volumes:
- name: nfs-storage
nfs:
server: my-nfs-server.default.svc.cluster.local
path: /shared
| Field | Type | Description | Required |
|---|---|---|---|
storage.capacity | string | Storage capacity (e.g., "10Gi") | Yes |
storage.storageClassName | string | StorageClass name for dynamic provisioning | No* |
storage.persistentVolume | string | Pre-existing PersistentVolume name | No* |
replicas | int32 | Number of NFS server replicas (default: 2) | No |
path | string | NFS export path (default: "/nfs") | No |
image | string | NFS server image (default: auto-detected) | No |
*Either storageClassName or persistentVolume must be specified, but not both.
apiVersion: sharedvolume.io/v1alpha1
kind: NfsServer
metadata:
name: nfs-with-pv
spec:
storage:
capacity: "50Gi"
persistentVolume: "my-existing-pv"
replicas: 1
apiVersion: sharedvolume.io/v1alpha1
kind: NfsServer
metadata:
name: custom-nfs
spec:
storage:
capacity: "20Gi"
storageClassName: "standard"
image: "sharedvolume/nfs-server:custom"
path: "/exports"
replicas: 3
Clone the repository:
git clone https://github.com/sharedvolume/nfs-server-controller.git
cd nfs-server-controller
Install dependencies:
go mod download
Install Kubebuilder tools:
make controller-gen kustomize
Build the manager:
make build
Run tests:
make test
Build Docker image:
make docker-build IMG=nfs-server-controller:dev
The NFS Server Controller is built using the Kubebuilderβ framework, providing a comprehensive toolkit for building Kubernetes operators and controllers in Go.
nfs-server-controller/
βββ api/ # API definitions (CRDs)
β βββ v1alpha1/
βββ cmd/ # Main application
βββ config/ # Kubernetes manifests
β βββ crd/ # Custom Resource Definitions
β βββ rbac/ # RBAC permissions
β βββ samples/ # Sample configurations
βββ internal/ # Internal packages
β βββ controller/ # Controller logic
βββ test/ # Test suites
Install CRDs:
make install
Run the controller locally:
make run
Apply sample configurations:
kubectl apply -f config/samples/
Run tests with Kind:
make test-e2e
| Field | Type | Description | Required | Default |
|---|---|---|---|---|
storage.capacity | string | Storage capacity (e.g., "10Gi") | Yes | - |
storage.storageClassName | string | StorageClass name for dynamic provisioning | No* | - |
storage.persistentVolume | string | Pre-existing PersistentVolume name | No* | - |
replicas | *int32 | Number of NFS server replicas | No | 2 |
path | string | NFS export path | No | "/nfs" |
image | string | Container image for NFS server | No | Auto-detected |
*Either storageClassName or persistentVolume must be specified, but not both.
# Run unit tests
make test
# Run with coverage
go test ./... -coverprofile cover.out
go tool cover -html=cover.out
# Run end-to-end tests
make test-e2e
# Deploy to cluster
make deploy IMG=sharedvolume/nfs-server-controller:latest
# Undeploy
make undeploy
Controller Not Starting:
# Check deployment status
kubectl describe deployment -n nfs-server-controller-system nfs-server-controller-manager
# Check controller logs
kubectl logs -n nfs-server-controller-system deployment/nfs-server-controller-manager -f
NFS Server Not Ready:
# Check NFS server status
kubectl describe nfsserver <name>
# Check related resources
kubectl get pods,svc,pvc -l app=<nfs-server-name>
Mount Issues:
# Test connectivity
kubectl run nfs-test --image=alpine:latest --rm -it -- /bin/sh
# Inside pod: apk add nfs-utils && showmount -e <service-name>.<namespace>.svc.cluster.local
# Enable debug logging
kubectl patch deployment -n nfs-server-controller-system nfs-server-controller-manager \
-p '{"spec":{"template":{"spec":{"containers":[{"name":"manager","args":["--log-level=debug"]}]}}}}'
We welcome contributions from the community! Whether it's:
See our Contributing Guidelinesβ for details on:
Built with β€οΈ using open source technologies and inspired by the Kubernetes community's best practices for operators and controllers.
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β kubectl/API β β NFS Controller β β NFS Server β
β βββββΆβ βββββΆβ Pods β
β apply nfs.yaml β β Reconcile Loop β β β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β
βΌ βΌ
ββββββββββββββββββββ βββββββββββββββββββ
β PVC β β Service β
β (Storage) β β (Discovery) β
ββββββββββββββββββββ βββββββββββββββββββ
The NFS Server Controller consists of:
NfsServer resource schemaNfsServer resources and manages their lifecycleThe controller provides the following status information:
kubectl get nfsservers
NAME READY ADDRESS CAPACITY
my-nfs-server true my-nfs-server.default.svc.cluster.local 10Gi
For detailed status:
kubectl describe nfsserver my-nfs-server
NFS Server not ready:
kubectl get pvckubectl get storageclasskubectl logs -l app=my-nfs-serverMount issues from clients:
kubectl get endpoints my-nfs-serverPermission issues:
View controller logs:
kubectl logs -n nfs-server-controller-system deployment/nfs-server-controller-manager
This project is licensed under the Apache License 2.0 - see the LICENSEβ file for details.
The NFS Server Controller is part of the SharedVolume ecosystem, a comprehensive suite of storage solutions for Kubernetes environments. SharedVolume provides enterprise-grade storage orchestration tools designed for production workloads at scale.
Built with Kubebuilderβ and inspired by the Kubernetes community's best practices for operators.
Content type
Image
Digest
sha256:564019bedβ¦
Size
33 MB
Last updated
about 1 year ago
docker pull sharedvolume/nfs-server-controller