<commit_before>= Persistent Volumes
{product-author}
{product-version}
:data-uri:
:icons:
:experimental:
:toc: macro
:toc-title:

toc::[]

== Overview

A *PersistentVolume* object is a storage resource in an OpenShift cluster.  It is provisioned by an administrator
and made available to users who lay claims to the resource

A *PersistentVolumeClaim* object is a request for storage resources by a pod author.  The claim is paired with a
volume that generally matches the user's request.

== Volume Provisioning

Storage is provisioned by an administrator by creating *PersistentVolume* objects from sources such as GCE Persistent Disks,
AWS Elastic Block Stores, and NFS mounts

== Sample persistent volume file

persistent-volume.json
====
----
{
  "apiVersion": "v1",
  "kind": "PersistentVolume",
  "metadata": {
    "name": "pv0003"
  },
  "spec": {
    "capacity": {
        "storage": "5Gi
    },
    "accessModes: [ "ReadWriteOnce" ],
    "nfs": {
        "path": "/tmp"
        "server": "172.17.0.2"
    }
  }
}
----
====

== Requesting Storage

Pod authors request storage by creating *PersistentVolumeClaim* objects.

== Sample persistent volume claim file

persistent-volume-claim.json
====
----
{
    "apiVersion": "v1",
    "kind": "PersistentVolumeClaim",
    "metadata": {
    "name": "myclaim"
    },
    "spec": {
        "accessModes": [ "ReadWriteOnce" ],
        "resources": {
            "requests": {
                "storage": "5Gi"
            }
        }
    }
}
----
====


== Volume and Claim Binding

A *PersistentVolume* is a specific resource.  A *PersistentVolumeClaim* is a request for a resource with specific attributes, such as storage size.
In between the two is a process that matches a claim to an available volume and binds them together.  This allows the claim to be used
  as a volume in a pod.  OpenShift finds the volume backing the claim and mounts it into the pod.

You can tell whether a claim or volume is bound by querying the CLI:

----
$ osc get pvc
NAME        LABELS    STATUS    VOLUME
myclaim     map[]     Bound     PV0003

$ osc get pv
NAME                LABELS              CAPACITY            ACCESSMODES         STATUS    CLAIM
pv0001              map[]               10737418240         RWO                 Bound     yournamespace / myclaim
----

== Claims as Volumes in Pods

A *PersistentVolumeClaim* is used by a pod as a volume.  OpenShift will find the claim with the given name in the same namespace as the pod, then use the claim
to find the corresponding volume to mount.

== Sample pod with claim

pod-with-claim.json
====
----
{
    "apiVersion": "v1",
    "kind": "Pod",
    "metadata": {
        "name": "mypod"
        "labels":[
            {"name": "frontendhttp"}
        ]
    },
    "spec": {
        "containers": [{
            "name": "myfrontend",
            "image": "dockerfile/nginx",
            "ports": [{
                "containerPort": 80,
                "name": "http-server"
            }],
            "volumeMounts": [{
                "mountPath": "/var/www/html",
                "name": "mypd"
            }]
        }],
        "volumes": [{
            "name": "mypd",
            "claimName": "myclaim"
        }]
    }
}
----
====

For more information, please see
https://github.com/GoogleCloudPlatform/kubernetes/tree/master/examples/persistent-volumes[Kubernetes Persistent Volumes README]<commit_msg>PersistentVolumes: fix JSON, pod, other tweaks<commit_after>= Persistent Volumes
{product-author}
{product-version}
:data-uri:
:icons:
:experimental:
:toc: macro
:toc-title:

toc::[]

== Overview

A *PersistentVolume* object is a storage resource in an OpenShift cluster.  It is provisioned by an administrator
and made available to users who lay claims to the resource.

A *PersistentVolumeClaim* object is a request for storage resources by a pod author.  The claim is paired with a
volume that generally matches the user's request.

== Volume Provisioning

Storage is provisioned by an administrator by creating *PersistentVolume* objects from sources such as GCE Persistent Disks,
AWS Elastic Block Stores, and NFS mounts.

== Sample persistent volume file

persistent-volume.json
====
----
{
  "apiVersion": "v1",
  "kind": "PersistentVolume",
  "metadata": {
    "name": "pv0001"
  },
  "spec": {
    "capacity": {
        "storage": "5Gi"
    },
    "accessModes": [ "ReadWriteOnce" ],
    "nfs": {
        "path": "/tmp",
        "server": "172.17.0.2"
    }
  }
}
----
====

== Requesting Storage

Pod authors request storage by creating *PersistentVolumeClaim* objects in their projects.

== Sample persistent volume claim file

persistent-volume-claim.json
====
----
{
    "apiVersion": "v1",
    "kind": "PersistentVolumeClaim",
    "metadata": {
        "name": "claim1"
    },
    "spec": {
        "accessModes": [ "ReadWriteOnce" ],
        "resources": {
            "requests": {
                "storage": "5Gi"
            }
        }
    }
}
----
====


== Volume and Claim Binding

A *PersistentVolume* is a specific resource.  A *PersistentVolumeClaim* is a request for a resource with specific attributes, such as storage size.
In between the two is a process that matches a claim to an available volume and binds them together.  This allows the claim to be used
as a volume in a pod.  OpenShift finds the volume backing the claim and mounts it into the pod.

You can tell whether a claim or volume is bound by querying the CLI:

----
$ osc get pvc
NAME        LABELS    STATUS    VOLUME
claim1      map[]     Bound     pv0001

$ osc get pv
NAME                LABELS              CAPACITY            ACCESSMODES         STATUS    CLAIM
pv0001              map[]               5368709120          RWO                 Bound     yournamespace / claim1
----

== Claims as Volumes in Pods

A *PersistentVolumeClaim* is used by a pod as a volume.  OpenShift will find the claim with the given name in the same namespace as the pod, then use the claim
to find the corresponding volume to mount.

== Sample pod with claim

pod-with-claim.json
====
----
{
    "apiVersion": "v1",
    "kind": "Pod",
    "metadata": {
        "name": "mypod",
        "labels": {
            "name": "frontendhttp"
        }
    },
    "spec": {
        "containers": [{
            "name": "myfrontend",
            "image": "nginx",
            "ports": [{
                "containerPort": 80,
                "name": "http-server"
            }],
            "volumeMounts": [{
                "mountPath": "/var/www/html",
                "name": "pvol"
            }]
        }],
        "volumes": [{
            "name": "pvol",
            "persistentVolumeClaim": {
                "claimName": "claim1"
            }
        }]
    }
}
----
====

For more information, please see
https://github.com/GoogleCloudPlatform/kubernetes/tree/master/examples/persistent-volumes[Kubernetes Persistent Volumes README]
{'fraction_non_alphanumeric': 0.11621192435397719, 'fraction_numerical': 0.011115923199076078, 'mean_word_length': 2.2373831775700936, 'pattern_counts': {'":': 78, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5287306', 'n_tokens_mistral': 2107, 'n_tokens_neox': 1974, 'n_words': 696}