Basic concepts of Kubernetes (K8s): Volume (storage volume), Persistent Volume

The basic concept of Kubernetes (K8s): Volume (storage volume)

One, Volume (storage volume)

Volume is a shared directory in Pod that can be accessed by multiple containers.

  • The Volume in K8s is defined on the Pod, and then is mounted to a specific file directory by multiple containers in a Pod.
  • The life cycle of Volume in K8s is the same as that of Pod, but it is not related to the life cycle of the container. When the container is terminated or restarted, the data in the Volume will not be lost.
  • K8s supports multiple types of volumes, such as advanced distributed file systems such as GlusterFS and Ceph.

The use of Volume is also relatively simple. In most cases, a Volume is declared on the Pod first, and then the Volume is referenced in the container and mounted to a directory in the container.

For example, if you want to add a Volume named datavol to Tomcat Pod and Mount it to the /mydata-data directory of the container, you only need to define the following in the Pod definition file:

apiVersion: v1
kind: ReplicationController
metadata:
  name:

Guess you like

Origin blog.csdn.net/zhengzaifeidelushang/article/details/113820363