In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Overview
Volume is the abstraction and virtualization of various storage resources. Provide a unified interface for the management, control and use of storage resources. Volume in Openstack provides storage for virtual machines, and volume in Docker provides storage for containers. Because the smallest unit that can be deployed and run in kubernetes is pod, kubernetes's volume provides storage for pod. Of course, when deploying pod, you don't have to provide the container in volume,pod to use the hard disk of the node where you are located. The place where you can read and write data at the same time is called read / write layer. This storage is container-level temporary storage, not pod-level storage. Its life cycle is the same as that of the container. If the container is restarted after crash, that is, the old container is deleted and the new container is started, the read / write layer of the old container is deleted together with the container, and the data on it is lost. Similarly, if pod migrates scheduling between nodes, the read / write layer of the container does not migrate scheduling. Therefore, kubernetes needs to provide pod-level volume, and the volume in this article refers specifically to kubernetes.
Volume Typ
Volume is an abstract concept, and there are many concrete implementations, each of which has its own purpose, characteristics and characteristics. Almost anything can be regarded as a volume, and the types are as follows:
AwsElasticBlockStoreazureDiskazureFilecephfsconfigMapcsidownwardAPIemptyDirfc (fibre channel) flockergcePersistentDiskgitRepo (deprecated) glusterfshostPathiscsilocalnfspersistentVolumeClaimprojectedportworxVolumequobyterbdscaleIOsecretstorageosvsphereVolume does not introduce all the above types here, but only gives a brief introduction to the local disk storage and distributed storage that may be used at present.
Description and examples of common storage types
Cephfs
Cephfs is an excellent and popular storage solution for cloud environment because of its open source, high availability, flexible scalability, no special requirements for operating system and hardware, easy for users to build, and no special requirements for nodes that use it. It has all the features stated by awsElasticBlockStore, and a single voluem can be used by multiple nodes at the same time. Users first build their own cephfs environment, then configure the kubernetes cluster to dock with it, and finally use the volume provided in pod. For more information, please see here.
ConfigMap
The user first creates a configMap and creates data to save in it. At this time, the data is saved in kubernetes's etcd database, and volume does not yet exist. When the user references the created configMap in the pod, the system first creates the volume on the node and saves the data in it, and the volume takes up the storage space occupied by the section. You can then use it just like you would with a normal volume.
ConfigMap is an object type in kubernetes. The core essence is to pass separately managed configuration information to containers in pod in the way of volume, not to store persistent data. Refer to here for details.
DownwardAPI
Similar to configMap, information is passed to containers in pod in a volume manner. The information in configMap is transmitted by the user when creating the object, and the information of downwardAPI comes from the pod object itself. DownwardAPI does not need to be created. It is a field in pod Spec, and the content points to other fields of the pod object itself, such as pod's metadata, image and so on. When creating a pod, the system first extracts the pointing fields, then creates a volume, saves the extracted fields and mounts them, and the container can read these fields.
The purpose of downwardAPI is to pass the field information of pod itself, such as label, annotation, and so on, to the container. Refer to here for details.
EmptyDir
The emptyDir volume is only created when the pod instance is running on the node. First of all, it is an empty directory on the node, and any container in pod can be mounted and used in the form of volume. If the container is deleted and restarted for some reason, the created emptyDir will not be deleted or emptied. When the pod instance leaves the node to be dispatched to another node or is deleted due to capacity reduction, the emptyDir is deleted, which means that the pod is still there but the data is lost. Example:
ApiVersion: v1kind: Podmetadata: name: test-pdspec: containers:-image: k8s.gcr.io/test-webserver name: test-container volumeMounts:-mountPath: / cache name: cache-volume volumes:-name: cache-volume emptyDir: {}
Glusterfs
Like cephfs, popular storage solutions in the cloud
HostPath
ApiVersion: v1kind: Podmetadata: name: test-pdspec: containers:-image: k8s.gcr.io/test-webserver name: test-container volumeMounts:-mountPath: / test-pd name: test-volume volumes:-name: test-volume hostPath: # directory location on host path: / data # this field is optional type: Directory
Iscsi
Internet minicomputer system interface, which is characterized by low cost.
Local
Similar to emptyDir, it also takes up the storage space of nodes. The difference is that it is an object type in kubernetes, and users can manage it as if they were normal objects. EmptyDir is assigned when the pod instance is running and deleted when the pod leaves the node. The volume of local type is created by the user, the system allocates resources to it on the appropriate node, the pod scheduled to this node can mount it, and it will not disappear when the pod leaves, unless the user deletes it. Example:
ApiVersion: v1kind: PersistentVolumemetadata: name: example-pvspec: capacity: storage: 100Gi # volumeMode field requires BlockVolume Alpha feature gate to be enabled. VolumeMode: Filesystem accessModes:-ReadWriteOnce persistentVolumeReclaimPolicy: Delete storageClassName: local-storage local: path: / mnt/disks/ssd1 nodeAffinity: required: nodeSelectorTerms:-matchExpressions:-key: kubernetes.io/hostname operator: In values:-example-node
Nfs
Nfs
Network file system
PersistentVolumeClaim
Similar to flocker, it is used to shield different cloud environments
Projected
If a container needs to mount multiple existing volume, such as Secret, ConfigMap, DownwardAPI, etc., each volume of this type needs to occupy a mount directory, but projected can integrate them together and hang them into only one directory. Example:
ApiVersion: v1kind: Podmetadata: name: volume-testspec: containers:-name: container-test image: busybox volumeMounts:-name: all-in-one mountPath: "/ projected-volume" readOnly: true volumes:-name: all-in-one projected: sources:-secret: name: mysecret items:-key: username path: my-group/my-username-downwardAPI: items:-path: "labels" fieldRef : fieldPath: metadata.labels-path: "cpu_limit" resourceFieldRef: containerName: container-test resource: limits.cpu-configMap: name: myconfigmap items:-key: config path: my-group/my-config
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.