Skip to content

Get top large files #348

Closed
Closed
@devopsmash

Description

I have a scenario where one of my Kubernetes nodes is experiencing disk pressure. Due to my use of the Bottlerocket OS, it's somewhat challenging to run utilities that are not containerized.

I tried to use the gdu docker image and get the files that cause the disk pressure, unfortunately without any success.

It would be amazing if I could run a k8s job like this and get the top X large files

apiVersion: batch/v1
kind: Job
metadata:
  name: disk-space-checker
  labels:
    app: disk-space-checker
    release: disk-space-checker
spec:
  backoffLimit: 0
  parallelism: 1
  ttlSecondsAfterFinished: 3600 # keep job for 1 hour 
  activeDeadlineSeconds: 900 # timeout after 15 min   
  template:
    metadata:
      labels:
        app: disk-space-checker
    spec:
      restartPolicy: Never
      containers:
      - name: disk-space-checker
        image: ghcr.io/dundee/gdu:v5.28.0
        imagePullPolicy: IfNotPresent
        securityContext:
          runAsUser: 0
        resources:
          requests:
            cpu: 250m
        args: ["--non-interactive","--show-apparent-size","--show-item-count","--max-cores","4","--no-delete","--ignore-dirs","/host/proc,/host/dev,/host/sys,/host/run,/host/local,/host/mnt,/host/etc,/host/boot","--no-cross","/host"]
        volumeMounts:
        - name: host
          mountPath: "/host"
          readOnly: true
      volumes:
        - name: host
          hostPath:
            path: "/"

With this k8s job I gets only root directories without getting sub directories and files.

Any chance to have additional parameter that can sort top X files by size?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions