github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/website/source/docs/providers/kubernetes/r/persistent_volume.html.markdown (about)

     1  ---
     2  layout: "kubernetes"
     3  page_title: "Kubernetes: kubernetes_persistent_volume"
     4  sidebar_current: "docs-kubernetes-resource-persistent-volume"
     5  description: |-
     6    A Persistent Volume (PV) is a piece of networked storage in the cluster that has been provisioned by an administrator.
     7  ---
     8  
     9  # kubernetes_persistent_volume
    10  
    11  The resource provides a piece of networked storage in the cluster provisioned by an administrator. It is a resource in the cluster just like a node is a cluster resource. Persistent Volumes have a lifecycle independent of any individual pod that uses the PV.
    12  
    13  More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes/
    14  
    15  ## Example Usage
    16  
    17  ```hcl
    18  resource "kubernetes_persistent_volume" "example" {
    19  	metadata {
    20  		name = "terraform-example"
    21  	}
    22  	spec {
    23  		capacity {
    24  			storage = "2Gi"
    25  		}
    26  		access_modes = ["ReadWriteMany"]
    27  		persistent_volume_source {
    28  			vsphere_volume {
    29  				volume_path = "/absolute/path"
    30  			}
    31  		}
    32  	}
    33  }
    34  ```
    35  
    36  ## Argument Reference
    37  
    38  The following arguments are supported:
    39  
    40  * `metadata` - (Required) Standard persistent volume's metadata. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata
    41  * `spec` - (Required) Spec of the persistent volume owned by the cluster. See below.
    42  
    43  ## Nested Blocks
    44  
    45  ### `spec`
    46  
    47  #### Arguments
    48  
    49  * `access_modes` - (Required) Contains all ways the volume can be mounted. More info: http://kubernetes.io/docs/user-guide/persistent-volumes#access-modes
    50  * `capacity` - (Required) A description of the persistent volume's resources and capacity. More info: http://kubernetes.io/docs/user-guide/persistent-volumes#capacity
    51  * `persistent_volume_reclaim_policy` - (Optional) What happens to a persistent volume when released from its claim. Valid options are Retain (default) and Recycle. Recycling must be supported by the volume plugin underlying this persistent volume. More info: http://kubernetes.io/docs/user-guide/persistent-volumes#recycling-policy
    52  * `persistent_volume_source` - (Required) The specification of a persistent volume.
    53  
    54  ### `persistent_volume_source`
    55  
    56  #### Arguments
    57  
    58  * `aws_elastic_block_store` - (Optional) Represents an AWS Disk resource that is attached to a kubelet's host machine and then exposed to the pod. More info: http://kubernetes.io/docs/user-guide/volumes#awselasticblockstore
    59  * `azure_disk` - (Optional) Represents an Azure Data Disk mount on the host and bind mount to the pod.
    60  * `azure_file` - (Optional) Represents an Azure File Service mount on the host and bind mount to the pod.
    61  * `ceph_fs` - (Optional) Represents a Ceph FS mount on the host that shares a pod's lifetime
    62  * `cinder` - (Optional) Represents a cinder volume attached and mounted on kubelets host machine. More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md
    63  * `fc` - (Optional) Represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.
    64  * `flex_volume` - (Optional) Represents a generic volume resource that is provisioned/attached using an exec based plugin. This is an alpha feature and may change in future.
    65  * `flocker` - (Optional) Represents a Flocker volume attached to a kubelet's host machine and exposed to the pod for its usage. This depends on the Flocker control service being running
    66  * `gce_persistent_disk` - (Optional) Represents a GCE Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Provisioned by an admin. More info: http://kubernetes.io/docs/user-guide/volumes#gcepersistentdisk
    67  * `glusterfs` - (Optional) Represents a Glusterfs volume that is attached to a host and exposed to the pod. Provisioned by an admin. More info: http://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md
    68  * `host_path` - (Optional) Represents a directory on the host. Provisioned by a developer or tester. This is useful for single-node development and testing only! On-host storage is not supported in any way and WILL NOT WORK in a multi-node cluster. More info: http://kubernetes.io/docs/user-guide/volumes#hostpath
    69  * `iscsi` - (Optional) Represents an ISCSI Disk resource that is attached to a kubelet's host machine and then exposed to the pod. Provisioned by an admin.
    70  * `nfs` - (Optional) Represents an NFS mount on the host. Provisioned by an admin. More info: http://kubernetes.io/docs/user-guide/volumes#nfs
    71  * `photon_persistent_disk` - (Optional) Represents a PhotonController persistent disk attached and mounted on kubelets host machine
    72  * `quobyte` - (Optional) Quobyte represents a Quobyte mount on the host that shares a pod's lifetime
    73  * `rbd` - (Optional) Represents a Rados Block Device mount on the host that shares a pod's lifetime. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md
    74  * `vsphere_volume` - (Optional) Represents a vSphere volume attached and mounted on kubelets host machine
    75  
    76  
    77  ### `aws_elastic_block_store`
    78  
    79  #### Arguments
    80  
    81  * `fs_type` - (Optional) Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: http://kubernetes.io/docs/user-guide/volumes#awselasticblockstore
    82  * `partition` - (Optional) The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as "1". Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty).
    83  * `read_only` - (Optional) Whether to set the read-only property in VolumeMounts to "true". If omitted, the default is "false". More info: http://kubernetes.io/docs/user-guide/volumes#awselasticblockstore
    84  * `volume_id` - (Required) Unique ID of the persistent disk resource in AWS (Amazon EBS volume). More info: http://kubernetes.io/docs/user-guide/volumes#awselasticblockstore
    85  
    86  ### `azure_disk`
    87  
    88  #### Arguments
    89  
    90  * `caching_mode` - (Required) Host Caching mode: None, Read Only, Read Write.
    91  * `data_disk_uri` - (Required) The URI the data disk in the blob storage
    92  * `disk_name` - (Required) The Name of the data disk in the blob storage
    93  * `fs_type` - (Optional) Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
    94  * `read_only` - (Optional) Whether to force the read-only setting in VolumeMounts. Defaults to false (read/write).
    95  
    96  ### `azure_file`
    97  
    98  #### Arguments
    99  
   100  * `read_only` - (Optional) Whether to force the read-only setting in VolumeMounts. Defaults to false (read/write).
   101  * `secret_name` - (Required) The name of secret that contains Azure Storage Account Name and Key
   102  * `share_name` - (Required) Share Name
   103  
   104  ### `ceph_fs`
   105  
   106  #### Arguments
   107  
   108  * `monitors` - (Required) Monitors is a collection of Ceph monitors More info: http://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it
   109  * `path` - (Optional) Used as the mounted root, rather than the full Ceph tree, default is /
   110  * `read_only` - (Optional) Whether to force the read-only setting in VolumeMounts. Defaults to `false` (read/write). More info: http://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it
   111  * `secret_file` - (Optional) The path to key ring for User, default is /etc/ceph/user.secret More info: http://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it
   112  * `secret_ref` - (Optional) Reference to the authentication secret for User, default is empty. More info: http://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it
   113  * `user` - (Optional) User is the rados user name, default is admin. More info: http://releases.k8s.io/HEAD/examples/volumes/cephfs/README.md#how-to-use-it
   114  
   115  ### `cinder`
   116  
   117  #### Arguments
   118  
   119  * `fs_type` - (Optional) Filesystem type to mount. Must be a filesystem type supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md
   120  * `read_only` - (Optional) Whether to force the read-only setting in VolumeMounts. Defaults to false (read/write). More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md
   121  * `volume_id` - (Required) Volume ID used to identify the volume in Cinder. More info: http://releases.k8s.io/HEAD/examples/mysql-cinder-pd/README.md
   122  
   123  ### `fc`
   124  
   125  #### Arguments
   126  
   127  * `fs_type` - (Optional) Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
   128  * `lun` - (Required) FC target lun number
   129  * `read_only` - (Optional) Whether to force the read-only setting in VolumeMounts. Defaults to false (read/write).
   130  * `target_ww_ns` - (Required) FC target worldwide names (WWNs)
   131  
   132  ### `flex_volume`
   133  
   134  #### Arguments
   135  
   136  * `driver` - (Required) Driver is the name of the driver to use for this volume.
   137  * `fs_type` - (Optional) Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". The default filesystem depends on FlexVolume script.
   138  * `options` - (Optional) Extra command options if any.
   139  * `read_only` - (Optional) Whether to force the ReadOnly setting in VolumeMounts. Defaults to false (read/write).
   140  * `secret_ref` - (Optional) Reference to the secret object containing sensitive information to pass to the plugin scripts. This may be empty if no secret object is specified. If the secret object contains more than one secret, all secrets are passed to the plugin scripts.
   141  
   142  ### `flocker`
   143  
   144  #### Arguments
   145  
   146  * `dataset_name` - (Optional) Name of the dataset stored as metadata -> name on the dataset for Flocker should be considered as deprecated
   147  * `dataset_uuid` - (Optional) UUID of the dataset. This is unique identifier of a Flocker dataset
   148  
   149  ### `gce_persistent_disk`
   150  
   151  #### Arguments
   152  
   153  * `fs_type` - (Optional) Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: http://kubernetes.io/docs/user-guide/volumes#gcepersistentdisk
   154  * `partition` - (Optional) The partition in the volume that you want to mount. If omitted, the default is to mount by volume name. Examples: For volume /dev/sda1, you specify the partition as "1". Similarly, the volume partition for /dev/sda is "0" (or you can leave the property empty). More info: http://kubernetes.io/docs/user-guide/volumes#gcepersistentdisk
   155  * `pd_name` - (Required) Unique name of the PD resource in GCE. Used to identify the disk in GCE. More info: http://kubernetes.io/docs/user-guide/volumes#gcepersistentdisk
   156  * `read_only` - (Optional) Whether to force the ReadOnly setting in VolumeMounts. Defaults to false. More info: http://kubernetes.io/docs/user-guide/volumes#gcepersistentdisk
   157  
   158  ### `glusterfs`
   159  
   160  #### Arguments
   161  
   162  * `endpoints_name` - (Required) The endpoint name that details Glusterfs topology. More info: http://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod
   163  * `path` - (Required) The Glusterfs volume path. More info: http://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod
   164  * `read_only` - (Optional) Whether to force the Glusterfs volume to be mounted with read-only permissions. Defaults to false. More info: http://releases.k8s.io/HEAD/examples/volumes/glusterfs/README.md#create-a-pod
   165  
   166  ### `host_path`
   167  
   168  #### Arguments
   169  
   170  * `path` - (Optional) Path of the directory on the host. More info: http://kubernetes.io/docs/user-guide/volumes#hostpath
   171  
   172  ### `iscsi`
   173  
   174  #### Arguments
   175  
   176  * `fs_type` - (Optional) Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: http://kubernetes.io/docs/user-guide/volumes#iscsi
   177  * `iqn` - (Required) Target iSCSI Qualified Name.
   178  * `iscsi_interface` - (Optional) iSCSI interface name that uses an iSCSI transport. Defaults to 'default' (tcp).
   179  * `lun` - (Optional) iSCSI target lun number.
   180  * `read_only` - (Optional) Whether to force the read-only setting in VolumeMounts. Defaults to false.
   181  * `target_portal` - (Required) iSCSI target portal. The portal is either an IP or ip_addr:port if the port is other than default (typically TCP ports 860 and 3260).
   182  
   183  ### `metadata`
   184  
   185  #### Arguments
   186  
   187  * `annotations` - (Optional) An unstructured key value map stored with the persistent volume that may be used to store arbitrary metadata. More info: http://kubernetes.io/docs/user-guide/annotations
   188  * `labels` - (Optional) Map of string keys and values that can be used to organize and categorize (scope and select) the persistent volume. May match selectors of replication controllers and services. More info: http://kubernetes.io/docs/user-guide/labels
   189  * `name` - (Optional) Name of the persistent volume, must be unique. Cannot be updated. More info: http://kubernetes.io/docs/user-guide/identifiers#names
   190  
   191  #### Attributes
   192  
   193  
   194  * `generation` - A sequence number representing a specific generation of the desired state.
   195  * `resource_version` - An opaque value that represents the internal version of this persistent volume that can be used by clients to determine when persistent volume has changed. Read more: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#concurrency-control-and-consistency
   196  * `self_link` - A URL representing this persistent volume.
   197  * `uid` - The unique in time and space value for this persistent volume. More info: http://kubernetes.io/docs/user-guide/identifiers#uids
   198  
   199  ### `nfs`
   200  
   201  #### Arguments
   202  
   203  * `path` - (Required) Path that is exported by the NFS server. More info: http://kubernetes.io/docs/user-guide/volumes#nfs
   204  * `read_only` - (Optional) Whether to force the NFS export to be mounted with read-only permissions. Defaults to false. More info: http://kubernetes.io/docs/user-guide/volumes#nfs
   205  * `server` - (Required) Server is the hostname or IP address of the NFS server. More info: http://kubernetes.io/docs/user-guide/volumes#nfs
   206  
   207  ### `photon_persistent_disk`
   208  
   209  #### Arguments
   210  
   211  * `fs_type` - (Optional) Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
   212  * `pd_id` - (Required) ID that identifies Photon Controller persistent disk
   213  
   214  ### `quobyte`
   215  
   216  #### Arguments
   217  
   218  * `group` - (Optional) Group to map volume access to Default is no group
   219  * `read_only` - (Optional) Whether to force the Quobyte volume to be mounted with read-only permissions. Defaults to false.
   220  * `registry` - (Required) Registry represents a single or multiple Quobyte Registry services specified as a string as host:port pair (multiple entries are separated with commas) which acts as the central registry for volumes
   221  * `user` - (Optional) User to map volume access to Defaults to serivceaccount user
   222  * `volume` - (Required) Volume is a string that references an already created Quobyte volume by name.
   223  
   224  ### `rbd`
   225  
   226  #### Arguments
   227  
   228  * `ceph_monitors` - (Required) A collection of Ceph monitors. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it
   229  * `fs_type` - (Optional) Filesystem type of the volume that you want to mount. Tip: Ensure that the filesystem type is supported by the host operating system. Examples: "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified. More info: http://kubernetes.io/docs/user-guide/volumes#rbd
   230  * `keyring` - (Optional) Keyring is the path to key ring for RBDUser. Default is /etc/ceph/keyring. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it
   231  * `rados_user` - (Optional) The rados user name. Default is admin. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it
   232  * `rbd_image` - (Required) The rados image name. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it
   233  * `rbd_pool` - (Optional) The rados pool name. Default is rbd. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it.
   234  * `read_only` - (Optional) Whether to force the read-only setting in VolumeMounts. Defaults to false. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it
   235  * `secret_ref` - (Optional) Name of the authentication secret for RBDUser. If provided overrides keyring. Default is nil. More info: http://releases.k8s.io/HEAD/examples/volumes/rbd/README.md#how-to-use-it
   236  
   237  ### `secret_ref`
   238  
   239  #### Arguments
   240  
   241  * `name` - (Optional) Name of the referent. More info: http://kubernetes.io/docs/user-guide/identifiers#names
   242  
   243  ### `vsphere_volume`
   244  
   245  #### Arguments
   246  
   247  * `fs_type` - (Optional) Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xfs", "ntfs". Implicitly inferred to be "ext4" if unspecified.
   248  * `volume_path` - (Required) Path that identifies vSphere volume vmdk
   249  
   250  ## Import
   251  
   252  Persistent Volume can be imported using its name, e.g.
   253  
   254  ```
   255  $ terraform import kubernetes_persistent_volume.example terraform-example
   256  ```