zoukankan      html  css  js  c++  java
  • Kubernetes-PV/PVC

    PV (Persistent Volume)

    和Volume的区别

    • 只能是网络存储
    • 独立于Pod之外

    PV支持的主流存储方案:

    • GCEPersistentDisk
    • AWSElasticBlockStore
    • AzureFile
    • AzureDisk
    • FC (Fibre Channel)
    • Flocker
    • NFS
    • iSCSI
    • RBD (Ceph Block Device)
    • CephFS
    • Cinder (OpenStack block storage)
    • Glusterfs
    • VsphereVolume
    • Quobyte Volumes
    • HostPath (single node testing only – local storage is not supported in any way and WILL NOT WORK in a multi-node cluster)
    • VMware Photon

    创建PV

    apiVersion: v1
    kind: PersistentVolume
    metadata:
      name: pv001
    spec:
      capacity:
        storage: 10Gi
      accessModes:
        - ReadWriteMany
      persistentVolumeReclaimPolicy: Recycle 
      nfs:
        path: /data/k8s/
        server: 172.16.1.131
    

    accessModes

    • ReadWriteOnce – PV以 read-write 挂载到一个节点
    • ReadOnlyMany – PV以read-only方式挂载到多个节点
    • ReadWriteMany – PV以read-write方式挂载到多个节点

    Reclaim

    当前支持的回收策略:

    • Retain – 允许用户手动回收
    • Recycle – 删除PV上的数据 (“rm -rf /thevolume/*”)
    • Delete – 删除PV

    Phase

    • Available – PV可以被使用
    • Bound – PV被绑定到PVC
    • Released – 被绑定的PVC被删除,可以被Reclaim
    • Failed – 自动回收失败

    PVC (Persistent Volume Claim)

    创建PVC

    kind: PersistentVolumeClaim
    apiVersion: v1
    metadata:
      name: myclaim
    spec:
      accessModes:
        - ReadWriteMany
      resources:
        requests:
          storage: 8Gi
    

    Phase

    Pending – 等待可用的PV
    Bound – PV被绑定到PVC
    Lost – 找不到绑定的PV

    在Pod中使用

    kind: Pod
    apiVersion: v1
    metadata:
    name: mypod
    spec:
    containers:
    - name: myfrontend
      image: dockerfile/nginx
      volumeMounts:
      - mountPath: "/var/www/html"
        name: mypd
    volumes:
    - name: mypd
      persistentVolumeClaim:
        claimName: myclaim
    
  • 相关阅读:
    www.a.shifen.com
    gstack pstack strace
    性能分析 函数粒度 函数里的一条语句 汇编 反编译 机器指令 %rbx,%rbp
    taocrypt
    sign
    Python 3.8.0 final¶ Release date: 2019-10-14
    超线程
    Python classes to extract information from the Linux kernel /proc files.
    借助中间件优化代码 将请求RequestId在服务端接收到请求在处理业务逻辑之前生成
    JVM CPU Profiler技术原理及源码深度解析
  • 原文地址:https://www.cnblogs.com/wangyiyang/p/12194759.html
Copyright © 2011-2022 走看看