LATEST VERSION: v1.2 - RELEASE NOTES
Pivotal Container Service v1.2

Using Dynamic PersistentVolumes

Page last updated:

When using PKS, you can choose to pre-provision persistent storage or create on-demand PersistentVolumes (PVs). Refer to the Kubernetes documentation for more information about storage management.

Perform the steps in this section to define a PersistentVolumeClaim (PVC) that you can apply to newly-created pods.

  1. Download the StorageClass spec for your cloud provider.

    • GCP:
      $ wget https://raw.githubusercontent.com/cloudfoundry-incubator/kubo-ci/master/specs/storage-class-gcp.yml
    • vSphere:

      $ wget https://raw.githubusercontent.com/cloudfoundry-incubator/kubo-ci/master/specs/storage-class-vsphere.yml
      After downloading the vSphere StorageClass spec, replace the contents of the file with the following to create the correct StorageClass:

        kind: StorageClass
        apiVersion: storage.k8s.io/v1
        metadata:
          name: thin
          annotations:
            storageclass.kubernetes.io/is-default-class: "true"
        provisioner: kubernetes.io/vsphere-volume
        parameters:
            diskformat: thin
      
    • AWS:

      $ wget https://raw.githubusercontent.com/cloudfoundry-incubator/kubo-ci/master/specs/storage-class-aws.yml

  2. Apply the spec by running kubectl create -f STORAGE-CLASS-SPEC.yml. Replace STORAGE-CLASS-SPEC with the name of the file you downloaded in the previous step. For example:

    $ kubectl create -f storage-class-gcp.yml

  3. Run the following command to download the example PVC:

    $ wget https://raw.githubusercontent.com/cloudfoundry-incubator/kubo-ci/master/specs/persistent-volume-claim.yml
    

  4. Run the following command to apply the PVC:

    $ kubectl create -f persistent-volume-claim.yml
    

    • To confirm you applied the PVC, run the following command:
      $ kubectl get pvc -o wide
      
  5. To use the dynamic PV, create a pod that uses the PVC. See the pv-guestbook.yml configuration file as an example.


Please send any feedback you have to pks-feedback@pivotal.io.

Create a pull request or raise an issue on the source for this page in GitHub