update docs/volumes.md to v1beta3;

also update some details in the doc
pull/6/head
Chao Xu 2015-05-19 17:34:16 -07:00
parent a615799488
commit c688e000f1
1 changed files with 26 additions and 31 deletions

View File

@ -3,18 +3,16 @@ This document describes the current state of Volumes in kubernetes. Familiarity
A Volume is a directory, possibly with some data in it, which is accessible to a Container. Kubernetes Volumes are similar to but not the same as [Docker Volumes](https://docs.docker.com/userguide/dockervolumes/).
A Pod specifies which Volumes its containers need in its [ContainerManifest](https://developers.google.com/compute/docs/containers/container_vms#container_manifest) property.
A Pod specifies which Volumes its containers need in its [spec.volumes](http://kubernetes.io/third_party/swagger-ui/#!/v1beta3/createPod) property.
A process in a Container sees a filesystem view composed from two sources: a single Docker image and zero or more Volumes. A [Docker image](https://docs.docker.com/userguide/dockerimages/) is at the root of the file hierarchy. Any Volumes are mounted at points on the Docker image; Volumes do not mount on other Volumes and do not have hard links to other Volumes. Each container in the Pod independently specifies where on its image to mount each Volume. This is specified a VolumeMounts property.
A process in a Container sees a filesystem view composed from two sources: a single Docker image and zero or more Volumes. A [Docker image](https://docs.docker.com/userguide/dockerimages/) is at the root of the file hierarchy. Any Volumes are mounted at points on the Docker image; Volumes do not mount on other Volumes and do not have hard links to other Volumes. Each container in the Pod independently specifies where on its image to mount each Volume. This is specified in each container's VolumeMounts property.
## Resources
The storage media (Disk, SSD, or memory) of a volume is determined by the media of the filesystem holding the kubelet root dir (typically `/var/lib/kubelet`).
There is no limit on how much space an EmptyDir or PersistentDir volume can consume, and no isolation between containers or between pods.
In the future, we expect that a Volume will be able to request a certain amount of space using a [resource](./resources.md) specification,
and to select the type of media to use, for clusters that have several media types.
There is no limit on how much space an EmptyDir or HostPath volume can consume, and no isolation between containers or between pods.
In the future, we expect that EmptyDir and HostPath volumes will be able to request a certain amount of space using a [resource](./resources.md) specification, and to select the type of media to use, for clusters that have several media types.
## Types of Volumes
Kubernetes currently supports multiple types of Volumes. The community welcomes additional contributions.
@ -29,16 +27,16 @@ Some uses for an EmptyDir are:
Currently, the user cannot control what kind of media is used for an EmptyDir. If the Kubelet is configured to use a disk drive, then all EmptyDirectories will be created on that disk drive. In the future, it is expected that Pods can control whether the EmptyDir is on a disk drive, SSD, or tmpfs.
### HostDir
A Volume with a HostDir property allows access to files on the current node.
### HostPath
A Volume with a HostPath property allows access to files on the current node.
Some uses for a HostDir are:
- running a container that needs access to Docker internals; use a HostDir of /var/lib/docker.
- running cAdvisor in a container; use a HostDir of /dev/cgroups.
Some uses for a HostPath are:
- running a container that needs access to Docker internals; use a HostPath of /var/lib/docker.
- running cAdvisor in a container; use a HostPath of /dev/cgroups.
Watch out when using this type of volume, because:
- pods with identical configuration (such as created from a podTemplate) may behave differently on different nodes due to different files on different nodes.
- When Kubernetes adds resource-aware scheduling, as is planned, it will not be able to account for resources used by a HostDir.
- When Kubernetes adds resource-aware scheduling, as is planned, it will not be able to account for resources used by a HostPath.
### GCEPersistentDisk
__Important: You must create a PD using ```gcloud``` or the GCE API before you can use it__
@ -63,26 +61,23 @@ gcloud compute disks create --size=500GB --zone=us-central1-a my-data-disk
#### GCE PD Example configuration:
```yaml
apiVersion: v1beta1
desiredState:
manifest:
containers:
- image: kubernetes/pause
name: testpd
volumeMounts:
- mountPath: "/testpd"
name: "testpd"
id: testpd
version: v1beta1
volumes:
- name: testpd
source:
persistentDisk:
# This GCE PD must already exist.
pdName: test
fsType: ext4
id: testpd
apiVersion: v1beta3
kind: Pod
metadata:
name: testpd
spec:
containers:
- image: kubernetes/pause
name: testcontainer
volumeMounts:
- mountPath: /testpd
name: testvolume
volumes:
- name: testvolume
# This GCE PD must already exist.
gcePersistentDisk:
pdName: test
fsType: ext4
```
### NFS