【问题标题】:Technical details on where GKE persistent volumes有关 GKE 持久卷所在位置的技术细节
【发布时间】:2023-01-24 06:41:00
【问题描述】:

任何人都可以提供有关 GKE 持久卷实际存储位置的技术细节,以及如果节点在 Google Kubernetes Engine 上出现故障会发生什么情况?

Google 提供了有关使用的文档,但没有提供注释,我需要知道是否出于任何原因 PV 可能存储在托管 pod 本身的节点上

【问题讨论】:

    标签: google-kubernetes-engine


    【解决方案1】:

    当节点宕机或被删除时,GKE 持久卷也将被删除。这是因为 GKE 中默认的 storageclass 设置为 ReclaimPolicy: Delete

    您可以运行命令kubectl get sc 来检查存储类和 通过运行命令 kubectl describe sc standard-rwo 描述存储类

    阅读link 了解有关持久卷和动态配置的更多信息。

    如果您想在节点关闭或被删除时保留您的持久卷。您可以创建您的存储类并设置ReclaimPolicy: Retain,请参见下面的示例:

    存储类

    apiVersion: storage.k8s.io/v1
    kind: StorageClass
    metadata:
      name: mystorageclass
    provisioner: kubernetes.io/gce-pd
    parameters:
      type: pd-standard
      fstype: ext4
      replication-type: none
    reclaimPolicy: Retain
    

    然后创建 PVC 以自动配置您的持久卷并在您的部署中使用它。请参见下面的 PVC 示例:

    PersistentVolumeClaims

    apiVersion: v1
    kind: PersistentVolumeClaim
    metadata:
      name: mypvc
    spec:
      accessModes:
        - ReadWriteOnce
      volumeMode: Filesystem
      resources:
        requests:
          storage: 8Gi
      storageClassName: mystorageclass
    

    【讨论】:

      猜你喜欢
      • 2018-12-09
      • 2014-10-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-16
      • 2018-11-15
      • 1970-01-01
      相关资源
      最近更新 更多