我想使用动态调整 PVC 大小的 Kubernetes 功能。当我将 PVC 尺寸修改为大尺寸后,只有 PV 尺寸发生了变化,但 PVC 状态仍然是FileSystemResizePending
。我的Kubernetes版本是1.15.3
,正常情况下文件系统会自动扩展。即使我重新创建 Pod,PVC 状态仍然是FileSystemResizePending
,并且大小不会改变。
CSI 驱动程序是aws-ebs-csi-driver
,版本是 alpha。Kubernetes 版本是1.15.3
.
像这样的功能门:
--feature-gates=ExpandInUsePersistentVolumes=true,CSINodeInfo=true,CSIDriverRegistry=true,CSIBlockVolume=true,VolumeSnapshotDataSource=true,ExpandCSIVolumes=true
Run Code Online (Sandbox Code Playgroud)
创建 StorageClass 文件是:
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
name: ebs-sc
provisioner: ebs.csi.aws.com
volumeBindingMode: WaitForFirstConsumer
allowVolumeExpansion: true
Run Code Online (Sandbox Code Playgroud)
光伏状态:
kubectl describe pv pvc-44bbcd26-2d7c-4e42-a426-7803efb6a5e7
Name: pvc-44bbcd26-2d7c-4e42-a426-7803efb6a5e7
Labels: <none>
Annotations: pv.kubernetes.io/provisioned-by: ebs.csi.aws.com
Finalizers: [kubernetes.io/pv-protection external-attacher/ebs-csi-aws-com]
StorageClass: ebs-sc
Status: Bound
Claim: default/test
Reclaim Policy: Delete
Access Modes: RWO
VolumeMode: Filesystem
Capacity: 25Gi
Node Affinity:
Required Terms:
Term 0: topology.ebs.csi.aws.com/zone in [ap-southeast-1b]
Message:
Source:
Type: CSI (a Container Storage Interface (CSI) volume source)
Driver: ebs.csi.aws.com
VolumeHandle: vol-0beb77489a4b06f4c
ReadOnly: false
VolumeAttributes: storage.kubernetes.io/csiProvisionerIdentity=1568278824948-8081-ebs.csi.aws.com
Events: <none>
Run Code Online (Sandbox Code Playgroud)
聚氯乙烯状态:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
annotations:
pv.kubernetes.io/bind-completed: "yes"
pv.kubernetes.io/bound-by-controller: "yes"
volume.beta.kubernetes.io/storage-provisioner: ebs.csi.aws.com
creationTimestamp: "2019-09-12T09:08:09Z"
finalizers:
- kubernetes.io/pvc-protection
labels:
app: test
name: test
namespace: default
resourceVersion: "5467113"
selfLink: /api/v1/namespaces/default/persistentvolumeclaims/test
uid: 44bbcd26-2d7c-4e42-a426-7803efb6a5e7
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 25Gi
storageClassName: ebs-sc
volumeMode: Filesystem
volumeName: pvc-44bbcd26-2d7c-4e42-a426-7803efb6a5e7
status:
accessModes:
- ReadWriteOnce
capacity:
storage: 20Gi
conditions:
- lastProbeTime: null
lastTransitionTime: "2019-09-12T09:10:29Z"
message: Waiting for user to (re-)start a pod to finish file system resize of
volume on node.
status: "True"
type: FileSystemResizePending
phase: Bound
Run Code Online (Sandbox Code Playgroud)
我预计 PVC 尺寸将更改为我指定的值。但PVC状态始终保持FileSystemResizePending
。
在您的 pvc 状态中您可以看到原因:
message: Waiting for user to (re-)start a pod to finish file system resize of
volume on node
Run Code Online (Sandbox Code Playgroud)
您应该重新启动使用该 PV 的 pod,这将导致重新挂载 PV,并且 FS 将在下次挂载之前调整大小。
并非所有文件系统都可以在运行时调整大小,因此我认为这只是一种兼容性行为。而且,无论如何,这样更安全。
归档时间: |
|
查看次数: |
6848 次 |
最近记录: |