Running out of ephemeral storage in kubernetes?
- Category: Blog
- Published: Monday, 01 March 2021 17:49
- Written by Lars Berntzon
- Hits: 139
This is how I rescued running systems from running out of the ephemeral storage in kubernetes.
The ephemeral storage is local temporary storage used by kubermetes. most noticaly the emptyDir kind of volume. Depending of type of pods running this might not require a lot of storage, but can also need significant sizes. One particular case if you run docker-in-docker. Then all images pulled by that pod will be stored in the ephemeral space.
What i did was following on relevant nodes.
- First i stopped further scheduling with: kubectl cordon <node>
- The I made sure that none of the pods where in use anywhere in the system.
- Then run: kubectl drain --force --delete-emptydir-data --ignore-daemonsets <node>
- Stop kubelet with: systemctl stop kubelet
- Stopped all containers with : docker kill $(docker ps -aq) and docker rm $(docker ps -aq)
- Unmounted all current mounts below /var/lib/kubelet.
- Create a new lvm to keep the ephemeral storage. Copied the current ephemeral storage from /var/lib/kubelet to the new volume and mounted the new volume there instead (cleaning out the old data first).
- Then start kubelet and uncordon the node with systemctl start kubelet and kubectl uncordon <node>