如何防止两个卷声称在Kubernetes上主张相同的卷? [英] How to prevent two volume claims to claim the same volume on Kubernetes?

查看:63
本文介绍了如何防止两个卷声称在Kubernetes上主张相同的卷?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

On my Kubernetes cluster on GKE, I have the following persistent volume claims (PVCs):

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

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

Amongst others, I have the following persistent volume defined:

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

现在,两个声明所声明的卷宗数量相同:

Now, both claims claimed the same volume:

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仅了解其中一项索赔:

Funny enough, the PV knows only about one of the claims:

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

如何防止这种情况发生?

How can I prevent this from happening?

推荐答案

这是一个错误,已由 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆