Skip to content

Commit 645e8a7

Browse files
authored
Merge pull request #49154 from network-charles/network-charles-patch-3
Improve volumes concept page
2 parents 29b7dfa + 8766bb7 commit 645e8a7

File tree

1 file changed

+36
-9
lines changed

1 file changed

+36
-9
lines changed

content/en/docs/concepts/storage/volumes.md

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,47 @@ weight: 10
1414

1515
<!-- overview -->
1616

17-
On-disk files in a container are ephemeral, which presents some problems for
17+
Kubernetes _volumes_ provide a way for containers in a {{< glossary_tooltip text="pods" term_id="pod" >}}
18+
to access and share data via the filesystem. There are different kinds of volume that you can use for different purposes,
19+
such as:
20+
21+
- populating a configuration file based on a {{< glossary_tooltip text="ConfigMap" term_id="configmap" >}}
22+
or a {{< glossary_tooltip text="Secret" term_id="secret" >}}
23+
- providing some temporary scratch space for a pod
24+
- sharing a filesystem between two different containers in the same pod
25+
- sharing a filesystem between two different pods (even if those Pods run on different nodes)
26+
- durably storing data so that it stays available even if the Pod restarts or is replaced
27+
- passing configuration information to an app running in a container, based on details of the Pod
28+
the container is in
29+
(for example: telling a {{< glossary_tooltip text="sidecar container" term_id="sidecar-container" >}}
30+
what namespace the Pod is running in)
31+
- providing read-only access to data in a different container image
32+
33+
Data sharing can be between different local processes within a container, or between different containers,
34+
or between Pods.
35+
36+
## Why volumes are important
37+
38+
- **Data persistence:** On-disk files in a container are ephemeral, which presents some problems for
1839
non-trivial applications when running in containers. One problem occurs when
19-
a container crashes or is stopped. Container state is not saved so all of the
40+
a container crashes or is stopped, the container state is not saved so all of the
2041
files that were created or modified during the lifetime of the container are lost.
21-
During a crash, kubelet restarts the container with a clean state.
22-
Another problem occurs when multiple containers are running in a `Pod` and
42+
During a crash, kubelet restarts the container with a clean state.
43+
44+
- **Shared storage:** Another problem occurs when multiple containers are running in a `Pod` and
2345
need to share files. It can be challenging to setup
2446
and access a shared filesystem across all of the containers.
47+
2548
The Kubernetes {{< glossary_tooltip text="volume" term_id="volume" >}} abstraction
26-
solves both of these problems.
27-
Familiarity with [Pods](/docs/concepts/workloads/pods/) is suggested.
49+
can help you to solve both of these problems.
2850

51+
Before you learn about volumes, PersistentVolumes and PersistentVolumeClaims, you should read up
52+
about {{< glossary_tooltip term_id="Pod" text="Pods" >}} and make sure that you understand how
53+
Kubernetes uses Pods to run containers.
54+
2955
<!-- body -->
3056

31-
## Background
57+
## How volumes work
3258

3359
Kubernetes supports many types of volumes. A {{< glossary_tooltip term_id="pod" text="Pod" >}}
3460
can use any number of volume types simultaneously.
@@ -45,14 +71,15 @@ volume type used.
4571

4672
To use a volume, specify the volumes to provide for the Pod in `.spec.volumes`
4773
and declare where to mount those volumes into containers in `.spec.containers[*].volumeMounts`.
48-
A process in a container sees a filesystem view composed from the initial contents of
74+
75+
When a pod is launched, a process in the container sees a filesystem view composed from the initial contents of
4976
the {{< glossary_tooltip text="container image" term_id="image" >}}, plus volumes
5077
(if defined) mounted inside the container.
5178
The process sees a root filesystem that initially matches the contents of the container
5279
image.
5380
Any writes to within that filesystem hierarchy, if allowed, affect what that process views
5481
when it performs a subsequent filesystem access.
55-
Volumes mount at the [specified paths](#using-subpath) within
82+
Volumes are mounted at [specified paths](#using-subpath) within
5683
the image.
5784
For each container defined within a Pod, you must independently specify where
5885
to mount each volume that the container uses.

0 commit comments

Comments
 (0)