Report this

What is the reason for this report?

Volume resize doesn’t be reflected in Kubernetes

Posted on June 21, 2022

I have being using an external volume for the ElasticSearch pod’s storage and I have a question about it:

  • I did a resize to the volume but I don’t see the change reflected in the Kubernetes cluster, I don’t know if I need to do something else before to change the PVC configuration. On the volume’s options I can see that there is an option to manually mount it and also there is a guide about how to do it, but I think this is more related with the addition of new space. Is there a more simple way to do it?
  • I have being trying to connect with the droplet remotely but it always fails, this is because it is a Kubernetes node and I don’s have a way to connect with it as I will normally do with a Linux’s virtual machine, or is there another way to connect and manage the volume?

I hope anybody can help me to understand better and how is the best way to do it and also if somebody can guide me to make snapshots into certain volumes. I would really appreciate it.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi there,

What I usually do with the DigitalOcean Managed Kubernetes Clusters is to use a PVC as described here in order to attach block storage to my clusters:

https://docs.digitalocean.com/products/kubernetes/how-to/add-volumes/

Here is an example configuration:

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: my-csi-app-set
spec:
  selector:
    matchLabels:
      app: mypod
  serviceName: "my-frontend"
  replicas: 1
  template:
    metadata:
      labels:
        app: mypod
    spec:
      containers:
      - name: my-frontend
        image: busybox
        args:
        - sleep
        - infinity
        volumeMounts:
        - mountPath: "/data"
          name: csi-pvc
  volumeClaimTemplates:
  - metadata:
      name: csi-pvc
    spec:
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 5Gi
      storageClassName: do-block-storage 

After that rather than resizing the block storage itself directly, to resize the volume, you can change the storage value directly via the PVC definition.

Or you could use kubectl edit pvc <pvc-name> and then increase the requested volume size.

Best,

Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.