GKE持久卷大小调整:文件系统大小调整未完成

时间:2019-03-26 15:43:31

标签: kubernetes google-kubernetes-engine persistent-volumes persistent-volume-claims

我想扩展我的持久卷,以便在运行v1.12.5的GKE群集上进行部署。我更改了存储类以启用卷扩展:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: standard
parameters:
  type: pd-standard
provisioner: kubernetes.io/gce-pd
allowVolumeExpansion: true
reclaimPolicy: Delete

此后,我更改了PVC的大小:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: webcontent
  namespace: k8s-test
  annotations:
    volume.alpha.kubernetes.io/storage-class: default
spec:
  accessModes: [ReadWriteOnce]
  resources:
    requests:
      storage: 2Gi  ---> Old size was 1Gi

删除了pod后,我像这样检查了pvc的状态。然后在几秒钟内通过部署中的副本设置重新启动Pod:

kubectl get pvc -n k8s-test -o yaml
apiVersion: v1
items:
- apiVersion: v1
  kind: PersistentVolumeClaim
  metadata:
    annotations:
      kubectl.kubernetes.io/last-applied-configuration: |
        {"apiVersion":"v1","kind":"PersistentVolumeClaim","metadata":{"annotations":{"volume.alpha.kubernetes.io/storage-class":"default"},"name":"webcontent","namespace":"k8s-test"},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"2Gi"}}}}
      pv.kubernetes.io/bind-completed: "yes"
      pv.kubernetes.io/bound-by-controller: "yes"
      volume.alpha.kubernetes.io/storage-class: default
      volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/gce-pd
    creationTimestamp: "2019-03-26T13:32:22Z"
    finalizers:
    - kubernetes.io/pvc-protection
    name: webcontent
    namespace: k8s-test
    resourceVersion: "12957822"
    selfLink: /api/v1/namespaces/k8s-test/persistentvolumeclaims/webcontent
    uid: 95dcdcba-4fcb-11e9-97fd-42010aa400b9
  spec:
    accessModes:
    - ReadWriteOnce
    dataSource: null
    resources:
      requests:
        storage: 2Gi
    storageClassName: standard
    volumeName: pvc-95dcdcba-4fcb-11e9-97fd-42010aa400b9
  status:
    accessModes:
    - ReadWriteOnce
    capacity:
      storage: 1Gi
    conditions:
    - lastProbeTime: null
      lastTransitionTime: "2019-03-26T15:35:28Z"
      message: Waiting for user to (re-)start a pod to finish file system resize of
        volume on node.
      status: "True"
      type: FileSystemResizePending
    phase: Bound
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""

因此,它似乎仅等待文件系统调整大小。如前所述,我多次删除了Pod,并将副本的值设置为0以终止Pod,但是文件系统调整大小没有生效。

我在做什么错?

1 个答案:

答案 0 :(得分:0)

您提到在删除该广告连播后 后检查了状态。根据Kubernetes documentation,状态必须首先为FileSystemResizePending,然后可以通过删除或按比例缩小部署然后按比例扩大来重新启动Pod。