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
    • vSphere:

      $ wget
      After downloading the vSphere StorageClass spec, replace the contents of the file with the following to create the correct StorageClass:

        kind: StorageClass
          name: thin
            diskformat: thin
    • AWS:

      $ wget

  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

  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