当前位置:首页 > 编程笔记 > 正文
已解决

k8s储存卷

来自网友在路上 172872提问 提问时间:2023-09-20 07:33:18阅读次数: 72

最佳答案 问答题库728位专家为你答疑解惑

卷的类型

In-Tree存储卷插件
◼ 临时存储卷
◆emptyDir
◼ 节点本地存储卷
◆hostPath, local
◼ 网络存储卷
◆文件系统:NFS、GlusterFS、CephFS和Cinder
◆块设备:iSCSI、FC、RBD和vSphereVolume
◆存储平台:Quobyte、PortworxVolume、StorageOS和ScaleIO
◆云存储:awsElasticBlockStore、gcePersistentDisk、azureDisk和azureFile
◼ 特殊存储卷
◆Secret、ConfigMap、DownwardAPI和Projected
◼ 扩展接口
◆CSI和FlexVolume
Out-of-Tree存储卷插件
◼ 经由CSI或FlexVolume接口扩展出的存储系统称为Out-of-Tree类的存储插件

cat pods-with-emptyDir-vol.yaml 
apiVersion: v1
kind: Pod
metadata:name: pods-with-emptydir-vol
spec:containers:- image: ikubernetes/admin-box:v1.2name: admincommand: ["/bin/sh","-c"]args: ["sleep 99999d"]resources: {}volumeMounts: - name: datamountPath: /data- image: ikubernetes/demoapp:v1.0name: demonappresources: {}volumeMounts: - name: datamountPath: /luo/htmlvolumes:- name: dataemptyDir:medium: MemorysizeLimit: 16MidnsPolicy: ClusterFirstrestartPolicy: Always

hostPath

不能跨节点,

kubectl explain pods.spec.volumes.hostPath

cat pod-with-hostpath-vol.yaml 
apiVersion: v1
kind: Pod
metadata: name: redis
spec:containers:- name: redisimage: redis:6imagePullPolicy: IfNotPresentvolumeMounts:- name: redisdatamountPath: /datavolumes:- name: redisdatahostPath:type: DirectoryOrCreatepath: /data/redis 

root@server01:~/k8s/yaml# kubectl get pods -owide
redis 1/1 Running 0 2m2s 192.168.24.18 server02

登录容器产生数据

root@server01:~/k8s/yaml# kubectl exec -it redis – sh
#redis-cli
127.0.0.1:6379> set name luohuiwen
OK
127.0.0.1:6379> save
OK

root@server02:/data/redis# ls
dump.rdb

查看全文

99%的人还看了

猜你感兴趣

版权申明

本文"k8s储存卷":http://eshow365.cn/6-9867-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!