Class Volume
- java.lang.Object
-
- software.amazon.jsii.JsiiObject
-
- org.cdk8s.plus20.Volume
-
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.50.0 (build d1830a4)", date="2022-01-03T09:09:28.091Z") @Stability(Stable) public class Volume extends software.amazon.jsii.JsiiObject
Volume represents a named volume in a pod that may be accessed by any container in the pod.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
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static VolumefromConfigMap(IConfigMap configMap)Populate the volume from a ConfigMap.static VolumefromConfigMap(IConfigMap configMap, ConfigMapVolumeOptions options)Populate the volume from a ConfigMap.static VolumefromEmptyDir(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 VolumefromEmptyDir(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.StringgetName()-
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
-
-
-
-
Method Detail
-
fromConfigMap
@Stability(Stable) @NotNull public static Volume fromConfigMap(@NotNull IConfigMap configMap, @Nullable ConfigMapVolumeOptions options)
Populate the volume from a 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.
- Parameters:
configMap- The config map to use to populate the volume. This parameter is required.options- Options.
-
fromConfigMap
@Stability(Stable) @NotNull public static Volume fromConfigMap(@NotNull IConfigMap configMap)
Populate the volume from a 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.
- Parameters:
configMap- The config map to use to populate the volume. This parameter is required.
-
fromEmptyDir
@Stability(Stable) @NotNull public static Volume fromEmptyDir(@NotNull String name, @Nullable 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.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.
- Parameters:
name- This parameter is required.options- - Additional options.
-
fromEmptyDir
@Stability(Stable) @NotNull public static Volume fromEmptyDir(@NotNull 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.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.
- Parameters:
name- This parameter is required.
-
getName
@Stability(Stable) @NotNull public String getName()
-
-