kubernetes in action - Volumes

栏目: 编程工具 · 发布时间: 6年前

内容简介:Volume解决Kubernetes的存储的问题对于Pod使用的存储,抽象为volume,volume伴随着Pod的创建而创建,消失而同时消失,不能单独的创建这样的好处,是存储的塑胶不会因为某个container重启而丢失,因为volume是pod级别的

Volume解决Kubernetes的存储的问题

对于Pod使用的存储,抽象为volume,volume伴随着Pod的创建而创建,消失而同时消失,不能单独的创建

这样的好处,是存储的塑胶不会因为某个container重启而丢失,因为volume是pod级别的

还有好处是,volume是pod资源,所以所有Pod中的container都可以共享访问这个volume,这样非常的方便

但是需要在contain中去mount这个volume,可以mount到任意目录,比如下面这个例子,

ContentAgent会产生内容html到/var/html,这个目录对应于Volume publicHtml,

WebServer会通过/var/htdocs读取Volume publicHtml中的数据,并把日志通过/var/logs/写到Volume logVol中

最后LogRotator会从Volume logVol消费logs

kubernetes in action - Volumes

volume有很多种类型,

- emptyDir —A simple empty directory used for storing transient data.

- hostPath —Used for mounting directories from the worker node’s filesystem into the pod.

- gitRepo —A volume initialized by checking out the contents of a Git repository.

- nfs —An NFS share mounted into the pod.

- gcePersistentDisk (Google Compute Engine Persistent Disk), awsElastic-

- BlockStore (Amazon Web Services Elastic Block Store Volume), azureDisk (Microsoft Azure Disk Volume)—Used for mounting cloud provider-specific storage.

- cinder, cephfs, iscsi, flocker, glusterfs, quobyte, rbd, flexVolume, vsphere-Volume, photonPersistentDisk, scaleIO—Used for mounting other types of network storage.

- configMap, secret, downwardAPI—Special types of volumes used to expose certain Kubernetes resources and cluster information to the pod.

- persistentVolumeClaim —A way to use a pre- or dynamically provisioned persistent storage. (We’ll talk about them in the last section of this chapter.)

其中,

emptyDir最常用,特点是pod删除后数据会丢失,用户container间交互数据或者纯计算的中间结果

kubernetes in action - Volumes

hostPath,mount到node的目录,这样数据就不会因为pod删除而丢失

kubernetes in action - Volumes

当然,如果要跨节点的恢复数据,就需要用到分布式的volume,比如,gcePersistentDisk

PersistentVolumeClaims,提供一种抽象来封装底层各种具体的存储

kubernetes in action - Volumes kubernetes in action - Volumes

这样的好处,user不需要了解和配置具体的存储,可以直接使用,那些事情交给Admin去做

Dynamic provisioning of PersistentVolumes

提前配置好,Persistent Volume Provisioner和Storage Class,仅仅在需要的时候才会自动产生Persistent Volume

kubernetes in action - Volumes


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Python基础教程(第2版)

Python基础教程(第2版)

Magnus Lie Hetland / 司维、曾军崴、谭颖华 / 人民邮电出版社 / 2010-7 / 69.00元

本书是经典教程的全新改版,作者根据Python 3.0版本的种种变化,全面改写了书中内容,做到既能“瞻前”也能“顾后”。本书层次鲜明、结构严谨、内容翔实,特别是在最后几章,作者将前面讲述的内容应用到了10个引人入胜的项目中,并以模板的形式介绍了项目的开发过程。本书既适合初学者夯实基础,又能帮助Python程序员提升技能,即使是 Python方面的技术专家,也能从书里找到令你耳目一新的东西。一起来看看 《Python基础教程(第2版)》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

随机密码生成器
随机密码生成器

多种字符组合密码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具