【问题标题】:How to prevent two volume claims to claim the same volume on Kubernetes?如何防止两个卷声明在 Kubernetes 上声明相同的卷?
【发布时间】:2016-02-16 03:41:18
【问题描述】:

在 GKE 上的 Kubernetes 集群上,我有以下持久卷声明 (PVC):

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: registry
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Gi

和:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: postgresql-blobs
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 100Gi

除其他外,我定义了以下持久卷:

kind: PersistentVolume
apiVersion: v1
metadata:
  name: pv0003
spec:
  capacity:
    storage: 100Gi
  accessModes:
    - ReadWriteOnce
    - ReadOnlyMany
  gcePersistentDisk:
    pdName: registry
    fsType: ext4

现在,两个声明声称的数量相同:

bronger:~$ kubectl describe pvc postgresql-blobs registry
Name:           postgresql-blobs
Namespace:      default
Status:         Bound
Volume:         pv0003
Labels:         <none>
Capacity:       100Gi
Access Modes:   RWO,ROX


Name:           registry
Namespace:      default
Status:         Bound
Volume:         pv0003
Labels:         <none>
Capacity:       100Gi
Access Modes:   RWO,ROX

有趣的是,PV 只知道其中一项声明:

bronger:~$ kubectl describe pv pv0003
Name:           pv0003
Labels:         <none>
Status:         Bound
Claim:          default/postgresql-blobs
Reclaim Policy: Retain
Access Modes:   RWO,ROX
Capacity:       100Gi
Message:
Source:
    Type:       GCEPersistentDisk (a Persistent Disk resource in Google Compute Engine)
    PDName:     registry
    FSType:     ext4
    Partition:  0
    ReadOnly:   false

如何防止这种情况发生?

【问题讨论】:

    标签: volume kubernetes claims


    【解决方案1】:

    这是一个错误,已由https://github.com/kubernetes/kubernetes/pull/16432修复

    【讨论】:

    • 如果它发生在今天怎么办?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-03-28
    • 2020-11-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-11
    • 2019-02-01
    相关资源
    最近更新 更多