Volumes - Kubernetes - 0 views
-
On-disk files in a Container are ephemeral,
-
when a Container crashes, kubelet will restart it, but the files will be lost - the Container starts with a clean state
- ...105 more annotations...
-
A Kubernetes volume, on the other hand, has an explicit lifetime - the same as the Pod that encloses it.
-
a volume outlives any Containers that run within the Pod, and data is preserved across Container restarts.
-
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).
-
the contents of a cephfs volume are preserved and the volume is merely unmounted.
-
volumeMounts: - name: config-vol mountPath: /etc/config volumes: - name: config-vol configMap: name: log-config items: - key: log_level path: log_level
-
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.
-
By default, emptyDir volumes are stored on whatever medium is backing the node - that might be disk or SSD or network storage, depending on your environment.
-
you can set the emptyDir.medium field to "Memory" to tell Kubernetes to mount a tmpfs (RAM-backed filesystem)
-
configure FC SAN Zoning to allocate and mask those LUNs (volumes) to the target WWNs beforehand so that Kubernetes hosts can access them.
-
Flocker is an open-source clustered Container data volume manager. It provides management and orchestration of data volumes backed by a variety of storage backends.
-
Using a PD on a Pod controlled by a ReplicationController will fail unless the PD is read-only or the replica count is 0 or 1
-
A glusterfs volume allows a Glusterfs (an open source networked filesystem) volume to be mounted into your Pod.
-
allowing a Pod to specify whether a given hostPath should exist prior to the Pod running, whether it should be created, and what it should exist as
-
Compared to hostPath volumes, local volumes can be used in a durable and portable manner without manually scheduling Pods to nodes, as the system is aware of the volume’s node constraints by looking at the node affinity on the PersistentVolume.
-
If a node becomes unhealthy, then the local volume will also become inaccessible, and a Pod using it will not be able to run.
-
PersistentVolume nodeAffinity is required when using local volumes. It enables the Kubernetes scheduler to correctly schedule Pods using local volumes to the correct node.
-
PersistentVolume volumeMode can now be set to “Block” (instead of the default value “Filesystem”) to expose the local volume as a raw block device.
-
When using local volumes, it is recommended to create a StorageClass with volumeBindingMode set to WaitForFirstConsumer
-
PersistentVolumes are a way for users to “claim” durable storage (such as a GCE PersistentDisk or an iSCSI volume) without knowing the details of the particular cloud environment.
-
All sources are required to be in the same namespace as the Pod. For more details, see the all-in-one volume design document.
-
A Container using a projected volume source as a subPath volume mount will not receive updates for those volume sources.
-
RBD volumes can only be mounted by a single consumer in read-write mode - no simultaneous writers allowed
-
secret volumes are backed by tmpfs (a RAM-backed filesystem) so they are never written to non-volatile storage.
-
StorageOS runs as a Container within your Kubernetes environment, making local or attached storage accessible from any node within the Kubernetes cluster.
-
Data can be replicated to protect against node failure. Thin provisioning and compression can improve utilization and reduce cost.
-
The volumeMounts.subPath property can be used to specify a sub-path inside the referenced volume instead of its root.
-
Use the subPathExpr field to construct subPath directory names from Downward API environment variables
-
There is no limit on how much space an emptyDir or hostPath volume can consume, and no isolation between Containers or between Pods.
-
emptyDir and hostPath volumes will be able to request a certain amount of space using a resource specification, and to select the type of media to use, for clusters that have several media types.
-
the Container Storage Interface (CSI) and Flexvolume. They enable storage vendors to create custom storage plugins without adding them to the Kubernetes repository.
-
all volume plugins (like volume types listed above) were “in-tree” meaning they were built, linked, compiled, and shipped with the core Kubernetes binaries and extend the core Kubernetes API.
-
Container Storage Interface (CSI) defines a standard interface for container orchestration systems (like Kubernetes) to expose arbitrary storage systems to their container workloads.
-
Once a CSI compatible volume driver is deployed on a Kubernetes cluster, users may use the csi volume type to attach, mount, etc. the volumes exposed by the CSI driver.
-
The csi volume type does not support direct reference from Pod and may only be referenced in a Pod via a PersistentVolumeClaim object.
-
This feature requires CSIInlineVolume feature gate to be enabled:--feature-gates=CSIInlineVolume=true
-
In-tree plugins that support CSI Migration and have a corresponding CSI driver implemented are listed in the “Types of Volumes” section above.
-
Mount propagation allows for sharing volumes mounted by a Container to other Containers in the same Pod, or even to other Pods on the same node.
-
HostToContainer - This volume mount will receive all subsequent mounts that are mounted to this volume or any of its subdirectories.
-
Bidirectional - This volume mount behaves the same the HostToContainer mount. In addition, all volume mounts created by the Container will be propagated back to the host and to all Containers of all Pods that use the same volume.