Local Path Provisioner
Purpose: Dynamic local storage provisioner
Version: v0.0.34
Namespace: local-path-storage
Description
Provides dynamic provisioning of PersistentVolumes (PVs) using local storage on each node. Ideal for development and testing environments.
Installation
Installed via ArgoCD from Helm chart: rancher/local-path-provisioner
Configuration
- Storage Class Name:
local-path(default) - Provisioner:
rancher.io/local-path - Volume Mode: Filesystem
- Reclaim Policy: Delete
- Binding Mode: WaitForFirstConsumer
Usage
Create a PVC
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-data
namespace: default
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path
resources:
requests:
storage: 10Gi
Use in a Pod
apiVersion: v1
kind: Pod
metadata:
name: my-app
namespace: default
spec:
containers:
- name: app
image: nginx
volumeMounts:
- name: data
mountPath: /usr/share/nginx/html
volumes:
- name: data
persistentVolumeClaim:
claimName: my-data
How It Works
- User creates a PVC with
storageClassName: local-path - Local Path Provisioner creates a directory on a node
- A PV is created pointing to that directory
- The PV is bound to the PVC
- When a pod is scheduled on that node, the directory is mounted
Storage Location
- Default Path:
/opt/local-path-provisioner - Location: On each worker node's filesystem
- Format:
pvc-<namespace>-<pvc-name>-<uuid>
Limitations
| Limitation | Description |
|---|---|
| Node Affinity | PVs are tied to specific nodes |
| No Replication | Data loss if node fails |
| No Snapshots | Local storage doesn't support snapshots |
| Capacity | Limited by node disk space |
warning
Local Path Provisioner is suitable for development/testing. For production, use a replicated storage solution.
Troubleshooting
Check Storage Class
kubectl get storageclass local-path
kubectl describe storageclass local-path
Check PVC Status
kubectl get pvc -A
kubectl describe pvc <name> -n <namespace>
Check Provisioner Logs
kubectl logs -n local-path-storage -l app=local-path-provisioner
Common Issues
- PVC pending - No nodes available or insufficient disk space
- Pod pending - Pod can't be scheduled on the node with the PV
- Disk full - Check node disk usage with
df -h