Kubernetes新近穩定的Auto-Provisioning features看起來消除了定義PersistentVolume
的需求,並基於其StorageClass
導致PersistentVolumeClaim
滿足其需求。Kubernetes 1.6使用NFS自動配置
這一切似乎有點簡單,但我在一個小的損失,下面PVC和PV將被捆綁在一起,做什麼,當談到更新我的清單爲canonical NFS example
1.6和之前其他幾個服務可以使用ReadWriteMany PVC nfs-pvc
沒有問題
apiVersion: v1
kind: PersistentVolume
metadata:
name: nfs
namespace: staging
spec:
capacity:
storage: 1Mi
accessModes: [ "ReadWriteMany" ]
persistentVolumeReclaimPolicy: Delete
nfs:
# FIXME: use the right IP
server: 10.7.252.23
path: "/exports"
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: nfs-pvc
namespace: staging
spec:
accessModes: [ "ReadWriteMany" ]
resources:
requests:
storage: 1Mi
(請注意,只有現在我已經加入persistentVolumeReclaimPolicy
但不影響東西)
然而,在1.6,RU在此明細表中導致額外的PV pv/pvc-75f9e8d1-1f69-11e7-b065-42010a84002d
。大概這是由於自動配置。不幸的是,這不是NFS。
Matthews-iMac:gke matt$ k get pv,pvc
NAME CAPACITY ACCESSMODES RECLAIMPOLICY STATUS CLAIM STORAGECLASS REASON AGE
pv/nfs 1Mi RWX Delete Available 18m
pv/postgres-volume 100Gi RWO Retain Bound default/postgres-storage-claim fast 16h
pv/pvc-630748eb-1f69-11e7-b065-42010a84002d 100Gi RWO Delete Bound staging/nfs-server-pvc standard 18m
pv/pvc-75f9e8d1-1f69-11e7-b065-42010a84002d 1Gi RWX Delete Bound staging/nfs-pvc standard 18m
NAME STATUS VOLUME CAPACITY ACCESSMODES STORAGECLASS AGE
pvc/nfs-pvc Bound pvc-75f9e8d1-1f69-11e7-b065-42010a84002d 1Gi RWX standard 18m
pvc/nfs-server-pvc Bound pvc-630748eb-1f69-11e7-b065-42010a84002d 100Gi RWO standard 18m
我想我可能會錯過關於selector
或什麼的東西?我嘗試添加selector -> matchLabel
,但顯然GCE配置程序不支持此功能。感謝您的幫助
這篇解決方案爲您工作? –
是的,PVC和PV按預期加入 – elmpp