Satyam Pandey
Satyam Pandey

Reputation: 743

Increasing PVC size for statefull set in kubernetes

I am want to increase the size of my pvc from 50 GB to 100GB, can you please help on this.

EFK is deployed on Azure kubernetes Cluster and storage type is azurefile-standard-zrs

i have deployed Elasticsearch as a statefullset using helm, tried updating values.yaml file however its not happening .

NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                   APP VERSION
logging-es      es              6               2021-02-23 16:01:17.013698 +0000 UTC    deployed        opendistro-es-1.13.0    1.13.0
[@ .kube]$ kubectl get pvc -n es
NAME                                     STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS             AGE
data-logging-es-opendistro-es-data-0     Bound    pvc-e926bbfc-a873-4543-9867-234bc508977c   50Gi       RWO            azurefile-standard-zrs   53d
data-logging-es-opendistro-es-data-1     Bound    pvc-0f5e7e46-5138-45da-90e6-0dfbe0aadff3   50Gi       RWO            azurefile-standard-zrs   53d
data-logging-es-opendistro-es-master-0   Bound    pvc-e8a57019-5eeb-4a93-ba02-3f1b5c2e8fc8   20Gi       RWO            azurefile-standard-zrs   53d
data-logging-es-opendistro-es-master-1   Bound    pvc-2ea1845d-7d08-4fca-b3c4-5b067559af3c   20Gi       RWO            azurefile-standard-zrs   53d
[@ .kube]$ kubectl get pvc data-logging-es-opendistro-es-data-0 -n es -o yaml
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: kubernetes.io/azure-file
    volume.kubernetes.io/selected-node: azwe-wvm-0
  creationTimestamp: "2021-01-15T07:25:20Z"
  finalizers:
  - kubernetes.io/pvc-protection
  labels:
    app: logging-es-opendistro-es
    heritage: Helm
    release: logging-es
    role: data
  name: data-logging-es-opendistro-es-data-0
  namespace: es
  resourceVersion: "33101689"
  selfLink: /api/v1/namespaces/es/persistentvolumeclaims/data-logging-es-opendistro-es-data-0
  uid: e926bbfc-a873-4543-9867-234bc508977c
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 50Gi
  storageClassName: azurefile-standard-zrs
  volumeMode: Filesystem
  volumeName: pvc-e926bbfc-a873-234bc508977c
status:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 50Gi
  phase: Bound

Error on trying helm upgrade

$ helm upgrade -f values_runtime.yaml logging-es infrastructure/opendistro-es -n es --kubeconfig=/home/tsiadm/qa_fmo_config
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/tsiadm/qa_fmo_config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /home/tsiadm/qa_fmo_config
Error: UPGRADE FAILED: cannot patch "logging-es-opendistro-es-data" with kind StatefulSet: StatefulSet.apps "logging-es-opendistro-es-data" is invalid: spec: Forbidden: updates to statefulset spec for fields other than 'replicas', 'template', and 'updateStrategy' are forbidden```

Upvotes: 0

Views: 1187

Answers (1)

4c74356b41
4c74356b41

Reputation: 72181

couple of things:

  1. ensure storageclass used for this pvc is enabled for volume expansion
  2. edit the pvc to request more space
  3. scale down your stateful set to 0 replicas
  4. wait for the pvc to scale up
  5. scale your stateful set back to whatever replicas it requires

Upvotes: 2

Related Questions