October 19, 2024

Trouble occurred in Kubernetes. Most of the pods ended up in the “evicted” status. When checking the pod’s state with “kubectl describe,” it was found to be in a state called “StoragePressing,” meaning there is a shortage of disk space. This is despite not having installed any applications other than Kubernetes.

Checking the disk space with the “du” command reveals that there is only about 100GB available.

du -h /
Filesystem Size Used Avail Use% Mounted on
udev
/dev/mapper/ubuntu–vg-ubuntu–lv 100G 97GB 3G 97% /

Moreover, almost all of the capacity is occupied with no free space, even though it’s equipped with 500GB of storage.

When checking the disk allocation with the “vgdisplay” command, it was discovered that there is 400GB of capacity marked as “Free.”

kevin@ubuntu:~$ sudo vgdisplay
— Volume group —
Alloc PE / Size ***** / 100.00 GiB
Free PE / Size ***** / <400 GiB

So, in other words, there should have been 500GB of storage available, but the partitions weren’t created.

You can use the following command to expand the partition to its maximum size.

lvextend -l +100%FREE

To check storage such as device, partition, or virtual device, below command is also useful.

$lablk

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 50G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 49.5G 0 part [SWAP]
sdb 8:16 0 50G 0 disk
└─sdb1 8:17 0 50G 0 part /data

“lsblk” provides information about physical devices and their partitions, while “vgdisplay” offers details about volume groups.

Anyway, but the setting is not reflected to file system. to do this,

$ sudo resize2fs /dev/ubuntu-vg/ubuntu-lv

Reference

https://note.com/billy_init/n/nff75ae1e77ae