Skip to content
Snippets Groups Projects
Select Git revision
  • 5b3969e1d01b8520b73d933e9aa18b6a2d38a633
  • master default protected
  • 29-switch-to-upstream-docker-image
  • v0.0.27
  • v0.0.22-gh1
  • v0.0.21-gh1
  • v0.0.21
  • v0.0.20-gh1
  • v0.0.20
  • v0.0.19
  • v0.0.18
  • v0.0.17
  • v0.0.16
  • v0.0.15
  • v0.0.14
  • v0.0.13
  • v0.0.12
  • v0.0.11
  • v0.0.11-rc2
  • v0.0.11-rc1
  • v0.0.10
  • v0.0.9
  • v0.0.8
23 results

README.md

Blame
  • README.md 7.87 KiB

    Local Path Provisioner

    Overview

    Local Path Provisioner provides a way for the Kubernetes users to utilize the local storage in each node. Based on the user configuration, the Local Path Provisioner will create hostPath based persistent volume on the node automatically. It utilizes the features introduced by Kubernetes Local Persistent Volume feature, but make it a simpler solution than the built-in local volume feature in Kubernetes.

    Compare to built-in Local Persistent Volume feature in Kubernetes

    Pros

    Dynamic provisioning the volume using host path.

    Cons

    1. No support for the volume capacity limit currently.
      1. The capacity limit will be ignored for now.
    2. Only support hostPath

    Requirement

    Kubernetes v1.12+.

    Deployment

    Installation

    In this setup, the directory /opt/local-path-provisioner will be used across all the nodes as the path for provisioning (a.k.a, store the persistent volume data). The provisioner will be installed in local-path-storage namespace by default.

    kubectl apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/master/deploy/local-path-storage.yaml

    After installation, you should see something like the following:

    $ kubectl -n local-path-storage get pod
    NAME                                     READY     STATUS    RESTARTS   AGE
    local-path-provisioner-d744ccf98-xfcbk   1/1       Running   0          7m

    Check and follow the provisioner log using:

    $ kubectl -n local-path-storage logs -f local-path-provisioner-d744ccf98-xfcbk

    Usage

    Create a hostPath backed Persistent Volume and a pod uses it:

    kubectl create -f https://raw.githubusercontent.com/rancher/local-path-provisioner/master/examples/pvc.yaml
    kubectl create -f https://raw.githubusercontent.com/rancher/local-path-provisioner/master/examples/pod.yaml

    You should see the PV has been created:

    $ kubectl get pv
    NAME                                       CAPACITY   ACCESS MODES   RECLAIM POLICY   STATUS    CLAIM                    STORAGECLASS   REASON    AGE
    pvc-bc3117d9-c6d3-11e8-b36d-7a42907dda78   2Gi        RWO            Delete           Bound     default/local-path-pvc   local-path               4s

    The PVC has been bound:

    $ kubectl get pvc
    NAME             STATUS    VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
    local-path-pvc   Bound     pvc-bc3117d9-c6d3-11e8-b36d-7a42907dda78   2Gi        RWO            local-path     16s

    And the Pod started running:

    $ kubectl get pod
    NAME          READY     STATUS    RESTARTS   AGE
    volume-test   1/1       Running   0          3s

    Write something into the pod

    kubectl exec volume-test -- sh -c "echo local-path-test > /data/test"