@Generated(value="jsii-pacmak/1.43.0 (build b69a797)", date="2021-11-15T00:20:49.025Z") @Stability(value=Stable) public class Volume extends software.amazon.jsii.JsiiObject
Docker also has a concept of volumes, though it is somewhat looser and less managed. In Docker, a volume is simply a directory on disk or in another Container. Lifetimes are not managed and until very recently there were only local-disk-backed volumes. Docker now provides volume drivers, but the functionality is very limited for now (e.g. as of Docker 1.7 only one volume driver is allowed per Container and there is no way to pass parameters to volumes).
A Kubernetes volume, on the other hand, has an explicit lifetime - the same as the Pod that encloses it. Consequently, a volume outlives any Containers that run within the Pod, and data is preserved across Container restarts. Of course, when a Pod ceases to exist, the volume will cease to exist, too. Perhaps more importantly than this, Kubernetes supports many types of volumes, and a Pod can use any number of them simultaneously.
At its core, a volume is just a directory, possibly with some data in it, which is accessible to the Containers in a Pod. How that directory comes to be, the medium that backs it, and the contents of it are determined by the particular volume type used.
To use a volume, a Pod specifies what volumes to provide for the Pod (the .spec.volumes field) and where to mount those into Containers (the .spec.containers[*].volumeMounts field).
A process in a container sees a filesystem view composed from their Docker image and volumes. The Docker image is at the root of the filesystem hierarchy, and any volumes are mounted at the specified paths within the image. Volumes can not mount onto other volumes
| Modifier | Constructor and Description |
|---|---|
protected |
Volume(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Volume(software.amazon.jsii.JsiiObjectRef objRef) |
protected |
Volume(String name,
Object config) |
| Modifier and Type | Method and Description |
|---|---|
static Volume |
fromConfigMap(IConfigMap configMap)
Populate the volume from a ConfigMap.
|
static Volume |
fromConfigMap(IConfigMap configMap,
ConfigMapVolumeOptions options)
Populate the volume from a ConfigMap.
|
static Volume |
fromEmptyDir(String name)
An emptyDir volume is first created when a Pod is assigned to a Node, and exists as long as that Pod is running on that node.
|
static Volume |
fromEmptyDir(String name,
EmptyDirVolumeOptions options)
An emptyDir volume is first created when a Pod is assigned to a Node, and exists as long as that Pod is running on that node.
|
String |
getName() |
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected Volume(software.amazon.jsii.JsiiObjectRef objRef)
protected Volume(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable) @NotNull public static Volume fromConfigMap(@NotNull IConfigMap configMap, @Nullable ConfigMapVolumeOptions options)
The configMap resource provides a way to inject configuration data into Pods. The data stored in a ConfigMap object can be referenced in a volume of type configMap and then consumed by containerized applications running in a Pod.
When referencing a configMap object, you can simply provide its name in the volume to reference it. You can also customize the path to use for a specific entry in the ConfigMap.
configMap - The config map to use to populate the volume. This parameter is required.options - Options.@Stability(value=Stable) @NotNull public static Volume fromConfigMap(@NotNull IConfigMap configMap)
The configMap resource provides a way to inject configuration data into Pods. The data stored in a ConfigMap object can be referenced in a volume of type configMap and then consumed by containerized applications running in a Pod.
When referencing a configMap object, you can simply provide its name in the volume to reference it. You can also customize the path to use for a specific entry in the ConfigMap.
configMap - The config map to use to populate the volume. This parameter is required.@Stability(value=Stable) @NotNull public static Volume fromEmptyDir(@NotNull String name, @Nullable EmptyDirVolumeOptions options)
As the name says, it is initially empty. Containers in the Pod can all read and write the same files in the emptyDir volume, though that volume can be mounted at the same or different paths in each Container. When a Pod is removed from a node for any reason, the data in the emptyDir is deleted forever.
name - This parameter is required.options - - Additional options.http://kubernetes.io/docs/user-guide/volumes#emptydir@Stability(value=Stable) @NotNull public static Volume fromEmptyDir(@NotNull String name)
As the name says, it is initially empty. Containers in the Pod can all read and write the same files in the emptyDir volume, though that volume can be mounted at the same or different paths in each Container. When a Pod is removed from a node for any reason, the data in the emptyDir is deleted forever.
name - This parameter is required.http://kubernetes.io/docs/user-guide/volumes#emptydir@Stability(value=Stable) @NotNull public String getName()
Copyright © 2021. All rights reserved.