PersistentVolume存儲卷結構體

PersistentVolume

// PersistentVolume struct captures the details of the implementation of PV storage
type PersistentVolume struct {
    metav1.TypeMeta
    // +optional
    metav1.ObjectMeta

    //Spec defines a persistent volume owned by the cluster
    // +optional
    Spec PersistentVolumeSpec

    // Status represents the current information about persistent volume.
    // +optional
    Status PersistentVolumeStatus
}

PersistentVolumeSpec

定義持久卷所需的大部分細節(jié)

// PersistentVolumeSpec has most of the details required to define a persistent volume
type PersistentVolumeSpec struct {
    // Resources represents the actual resources of the volume
    Capacity ResourceList
    // Source represents the location and type of a volume to mount.
    PersistentVolumeSource
    // AccessModes contains all ways the volume can be mounted
    //三種訪問方式分別為ReadWriteOnce(RWO),ReadOnlyMany(ROX),ReadWriteMany(RWX)
    // RWO, 那么只能被掛載在某一個Kubernetes的工作節(jié)點上,當再次嘗試在其他節(jié)點掛載的時候,系統會報Multi-Attach的錯誤(可以同一個節(jié)點上多個Pod同時讀寫)
    // ROX,name可以同時在多個節(jié)點上掛載且為只讀
    // RMX, 那么可以同時在多個節(jié)點上掛載并被不同的Pod讀寫。
    // +optional
    AccessModes []PersistentVolumeAccessMode
    // ClaimRef is part of a bi-directional binding between PersistentVolume and PersistentVolumeClaim.
    // ClaimRef is expected to be non-nil when bound.
    // claim.VolumeName is the authoritative bind between PV and PVC.
    // When set to non-nil value, PVC.Spec.Selector of the referenced PVC is
    // ignored, i.e. labels of this PV do not need to match PVC selector.
    // +optional
    ClaimRef *ObjectReference
    // Optional: what happens to a persistent volume when released from its claim.包含三種策略"Recycle","Delete","Retain"。默認策略為"Retain"
    //"Recycle",當該存儲卷從聲明中被釋放后將被回收至未綁定的存儲卷池中,DEPRECATED: The PersistentVolumeReclaimRecycle called Recycle is being deprecated. See announcement here: https://groups.google.com/forum/#!topic/kubernetes-dev/uexugCza84I
    // "Delete", 當該存儲卷從聲明中釋放后將在kubernetes中刪除
    // "Retain",默認策略,意味著卷將停留在當前階段(已釋放),供管理員手動回收
    // +optional
    PersistentVolumeReclaimPolicy PersistentVolumeReclaimPolicy
    // Name of StorageClass to which this persistent volume belongs. Empty value
    // means that this volume does not belong to any StorageClass.
    // +optional
    StorageClassName string
    // A list of mount options, e.g. ["ro", "soft"]. Not validated - mount will
    // simply fail if one is invalid.
    // +optional
    MountOptions []string
    // volumeMode defines if a volume is intended to be used with a formatted filesystem
    // or to remain in raw block state. Value of Filesystem is implied when not included in spec. "Block"或"Filesystem"
    // +optional
    VolumeMode *PersistentVolumeMode
    // NodeAffinity 定義約束通過NodeSelector限制可以從哪些節(jié)點訪問此存儲卷
    // This field influences the scheduling of pods that use this volume.
    // +optional
    NodeAffinity *VolumeNodeAffinity
}

PersistentVolumeStatus

// PersistentVolumeStatus represents the status of PV storage
type PersistentVolumeStatus struct {
    // Phase indicates if a volume is available, bound to a claim, or released by a claim。階段包括"Pending","Available","Bound", "Released", "Failed"。
    // Pending, 代表該存儲卷暫不可用
    // Available,代表存儲卷暫未被綁定,可用的卷由綁定器所持有,并與PVC(PersistentVolumeClaim)相匹配
    // Bound,代表存儲卷已經被綁定
    // Released,代表存儲卷綁定的PVC(PersistentVolumeClaim)已被刪除,一個已釋放的存儲卷在再次可用之前必須進行回收,這個階段由PVC綁定器通知另一個進程回收資源
    // Failed,代表存儲卷從PVC中釋放后未能被正確回收或刪除
    // +optional
    Phase PersistentVolumePhase
    // A human-readable message indicating details about why the volume is in this state.
    // +optional
    Message string
    // Reason is a brief CamelCase string that describes any failure and is meant for machine parsing and tidy display in the CLI
    // +optional
    Reason string
}

PersistentVolumeSource

// PersistentVolumeSource is similar to VolumeSource but meant for the administrator who creates PVs.
// Exactly one of its members must be set.
type PersistentVolumeSource struct {
    // GCEPersistentDisk represents a GCE Disk resource that is attached to a
    // kubelet's host machine and then exposed to the pod.
    // +optional
    GCEPersistentDisk *GCEPersistentDiskVolumeSource
    // AWSElasticBlockStore represents an AWS EBS disk that is attached to a
    // kubelet's host machine and then exposed to the pod.
    // +optional
    AWSElasticBlockStore *AWSElasticBlockStoreVolumeSource
    // HostPath represents a directory on the host.
    // Provisioned by a developer or tester.
    // This is useful for single-node development and testing only!
    // On-host storage is not supported in any way and WILL NOT WORK in a multi-node cluster.
    // +optional
    HostPath *HostPathVolumeSource
    // Glusterfs represents a Glusterfs volume that is attached to a host and exposed to the pod
    // +optional
    Glusterfs *GlusterfsPersistentVolumeSource
    // NFS represents an NFS mount on the host that shares a pod's lifetime
    // +optional
    NFS *NFSVolumeSource
    // RBD represents a Rados Block Device mount on the host that shares a pod's lifetime
    // +optional
    RBD *RBDPersistentVolumeSource
    // Quobyte represents a Quobyte mount on the host that shares a pod's lifetime
    // +optional
    Quobyte *QuobyteVolumeSource
    // ISCSIPersistentVolumeSource represents an ISCSI resource that is attached to a
    // kubelet's host machine and then exposed to the pod.
    // +optional
    ISCSI *ISCSIPersistentVolumeSource
    // FlexVolume represents a generic volume resource that is
    // provisioned/attached using an exec based plugin.
    // +optional
    FlexVolume *FlexPersistentVolumeSource
    // Cinder represents a cinder volume attached and mounted on kubelets host machine.
    // +optional
    Cinder *CinderPersistentVolumeSource
    // CephFS represents a Ceph FS mount on the host that shares a pod's lifetime
    // +optional
    CephFS *CephFSPersistentVolumeSource
    // FC represents a Fibre Channel resource that is attached to a kubelet's host machine and then exposed to the pod.
    // +optional
    FC *FCVolumeSource
    // Flocker represents a Flocker volume attached to a kubelet's host machine. This depends on the Flocker control service being running
    // +optional
    Flocker *FlockerVolumeSource
    // AzureFile represents an Azure File Service mount on the host and bind mount to the pod.
    // +optional
    AzureFile *AzureFilePersistentVolumeSource
    // VsphereVolume represents a vSphere volume attached and mounted on kubelets host machine
    // +optional
    VsphereVolume *VsphereVirtualDiskVolumeSource
    // AzureDisk represents an Azure Data Disk mount on the host and bind mount to the pod.
    // +optional
    AzureDisk *AzureDiskVolumeSource
    // PhotonPersistentDisk represents a Photon Controller persistent disk attached and mounted on kubelets host machine
    PhotonPersistentDisk *PhotonPersistentDiskVolumeSource
    // PortworxVolume represents a portworx volume attached and mounted on kubelets host machine
    // +optional
    PortworxVolume *PortworxVolumeSource
    // ScaleIO represents a ScaleIO persistent volume attached and mounted on Kubernetes nodes.
    // +optional
    ScaleIO *ScaleIOPersistentVolumeSource
    // Local represents directly-attached storage with node affinity
    // +optional
    Local *LocalVolumeSource
    // StorageOS represents a StorageOS volume that is attached to the kubelet's host machine and mounted into the pod
    // More info: https://examples.k8s.io/volumes/storageos/README.md
    // +optional
    StorageOS *StorageOSPersistentVolumeSource
    // CSI (Container Storage Interface) represents storage that is handled by an external CSI driver.
    // +optional
    CSI *CSIPersistentVolumeSource
}
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

  • 最近要考試了,綜合了一下老師的PPT和其他同學整理的資料。如果存在什么問題,可以留評論 1.各種性能指標的定義及如...
    constantine丶閱讀 12,048評論 4 18
  • 內存溢出和內存泄漏的區(qū)別 內存溢出:out of memory,是指程序在申請內存時,沒有足夠的內存空間供其使用,...
    Aimerwhy閱讀 800評論 0 1
  • 推薦指數: 6.0 書籍主旨關鍵詞:特權、焦點、注意力、語言聯想、情景聯想 觀點: 1.統計學現在叫數據分析,社會...
    Jenaral閱讀 5,967評論 0 5
  • 昨天,在回家的路上,坐在車里悠哉悠哉地看著三毛的《撒哈拉沙漠的故事》,我被里面的內容深深吸引住了,盡管上學時...
    夜闌曉語閱讀 3,935評論 2 9
  • 一。匹配。 判斷一個字符串是否符合我們制定的規(guī)則? 二…捕獲 字符串中符合我們正則表達式,規(guī)則的,內容捕獲到。 三...
    時修七年閱讀 1,060評論 2 0

友情鏈接更多精彩內容