Skip to content

[Bug]: Detected low-disk space condition #7150

Closed as not planned
Closed as not planned

Description

@thearperson

Is there an existing issue already for this bug?

  • I have searched for an existing issue, and could not find anything. I believe this is a new bug.

I have read the troubleshooting guide

  • I have read the troubleshooting guide and I think this is a new bug.

I am running a supported version of CloudNativePG

  • I have read the troubleshooting guide and I think this is a new bug.

Contact Details

No response

Version

1.25 (latest patch)

What version of Kubernetes are you using?

1.32

What is your Kubernetes environment?

Cloud: Azure AKS

How did you install the operator?

Helm

What happened?

The cluster was running fine for more than a week, but suddenly the primary instances runs out of WAL disk space.

dev@zeta-gpu:/code/zeta$ kubectl cnpg status zeta-main-k8s-beta-postgres -n zeta-postgres
Cluster Summary
Name                 zeta-postgres/zeta-main-k8s-beta-postgres
System ID:           7455388899635355666
PostgreSQL Image:    cloudzeta/zeta-postgres:15.1.1.78-42f0588b
Primary instance:    zeta-main-k8s-beta-postgres-2
Primary start time:  2025-03-15 06:04:31 +0000 UTC (uptime 14m56s)
Status:              Not enough disk space Insufficient disk space detected in one or more pods is preventing PostgreSQL from running.Please verify your storage settings. Further information inside .status.instancesReportedState
Instances:           2
Ready instances:     1
Size:                1.2G
Current Write LSN:   18/D5008250 (Timeline: 10 - WAL File: 0000000A00000018000000D5)

Continuous Backup status
First Point of Recoverability:  2025-03-08T00:42:02Z
Working WAL archiving:          OK
WALs waiting to be archived:    0
Last Archived WAL:              0000000A00000018000000D4   @   2025-03-15T06:09:32.305248Z
Last Failed WAL:                0000000A.history           @   2025-03-15T06:04:30.636916Z

Streaming Replication status
Not available yet

Instances status
Name                           Current LSN  Replication role  Status  QoS                 Manager Version  Node
----                           -----------  ----------------  ------  ---                 ---------------  ----
zeta-main-k8s-beta-postgres-2  18/D5008250  Primary           OK      Burstable           1.25.1           aks-postgres-13560037-vmss000003
zeta-main-k8s-beta-postgres-1  -            -                 -       ServiceUnavailable  Burstable        -  aks-postgres-13560037-vmss000004


Error(s) extracting status
-----------------------------------
failed to get status by proxying to the pod, you might lack permissions to get pods/proxy: the server is currently unable to handle the request (get pods https:zeta-main-k8s-beta-postgres-1:8000)
dev@zeta-gpu:/code/zeta$ kubectl logs zeta-main-k8s-beta-postgres-1 -n zeta-postgres

{"level":"info","ts":"2025-03-15T06:13:01.027910586Z","msg":"Starting CloudNativePG Instance Manager","logger":"instance-manager","logging_pod":"zeta-main-k8s-beta-postgres-1","version":"1.25.1","build":{"Version":"1.25.1","Commit":"c56e00d4","Date":"2025-02-28"}}
{"level":"info","ts":"2025-03-15T06:13:01.027927091Z","msg":"Checking for free disk space for WALs before starting PostgreSQL","logger":"instance-manager","logging_pod":"zeta-main-k8s-beta-postgres-1"}
{"level":"info","ts":"2025-03-15T06:13:01.030911362Z","msg":"Detected low-disk space condition, avoid starting the instance","logger":"instance-manager","logging_pod":"zeta-main-k8s-beta-postgres-1"}
dev@zeta-gpu:/code/zeta$ kubectl get backup -n zeta-postgres 
zeta-main-k8s-beta-postgres-hourly-backup-20250314224200   7h41m   zeta-main-k8s-beta-postgres   barmanObjectStore   completed             
zeta-main-k8s-beta-postgres-hourly-backup-20250314234200   6h41m   zeta-main-k8s-beta-postgres   barmanObjectStore   completed             
zeta-main-k8s-beta-postgres-hourly-backup-20250315004200   5h41m   zeta-main-k8s-beta-postgres   barmanObjectStore   completed             
zeta-main-k8s-beta-postgres-hourly-backup-20250315014200   4h41m   zeta-main-k8s-beta-postgres   barmanObjectStore   walArchivingFailing   
zeta-main-k8s-beta-postgres-hourly-backup-20250315024200   3h41m   zeta-main-k8s-beta-postgres   barmanObjectStore   walArchivingFailing   
zeta-main-k8s-beta-postgres-hourly-backup-20250315034200   161m    zeta-main-k8s-beta-postgres   barmanObjectStore   walArchivingFailing   
zeta-main-k8s-beta-postgres-hourly-backup-20250315044200   101m    zeta-main-k8s-beta-postgres   barmanObjectStore   walArchivingFailing   
zeta-main-k8s-beta-postgres-hourly-backup-20250315054200   41m     zeta-main-k8s-beta-postgres   barmanObjectStore   walArchivingFailing 

Originally, we thought this was related to #6544

However, it happened again in 1.25.1

Cluster resource

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. gbartolini commented on Mar 17, 2025

    @gbartolini
    Contributor

    Hi @thearperson, thank you for contacting us. Could you clarify whether you ran out of disk space, as indicated by the log excerpt?

  2. thearperson commented on Mar 18, 2025

    @thearperson
    Author

    Yeah, we ran out of disk space. However, it turns out we cannot really access the pod:

    dev@zeta-gpu:/code/zeta$ kubectl exec -it zeta-main-k8s-beta-postgres-1 -n zeta-postgres -- /bin/bash
    Defaulted container "postgres" out of: postgres, bootstrap-controller (init)
    error: Internal error occurred: unable to upgrade connection: container not found ("postgres")
    
    
    dev@zeta-gpu:/code/zeta$ kubectl exec -it zeta-main-k8s-beta-postgres-2 -n zeta-postgres -- /bin/bash
    Defaulted container "postgres" out of: postgres, bootstrap-controller (init)
    postgres@zeta-main-k8s-beta-postgres-2:/$ 
    

    so it's hard to tell the true disk usage situation.

  3. thearperson commented on Mar 21, 2025

    @thearperson
    Author

    No, we haven't tried to increate the PVC size. Will try that next time it happens.

    What we did isn't to helm uninstall the cluster and use barman to recover.

  4. gbartolini commented on Mar 24, 2025

    @gbartolini
    Contributor

    Thank you. Given that the behaviour is expected, I am closing this bug.

  5. thearperson commented on Apr 4, 2025

    @thearperson
    Author

    @gbartolini this issue occurred again today and we managed to get the system recovered with:

    ubectl patch pvc zeta-main-k8s-prod-postgres-2-wal -n zeta-postgres -p '{"spec":{"resources":{"requests":{"storage":"32Gi"}}}}'
    

    However, after the pod recovers, we inspect the storage usage:

    (base) dev@zeta-gpu:/code/zeta$ kubectl exec -it zeta-main-k8s-prod-postgres-2 -n zeta-postgres -- df -h
    Defaulted container "postgres" out of: postgres, bootstrap-controller (init)
    Filesystem      Size  Used Avail Use% Mounted on
    overlay          62G   31G   32G  50% /
    tmpfs            64M     0   64M   0% /dev
    /dev/root        62G   31G   32G  50% /run
    tmpfs           2.0G  1.1M  2.0G   1% /dev/shm
    /dev/nvme0n2     32G  204M   31G   1% /var/lib/postgresql/data
    /dev/nvme0n3     32G  1.2G   31G   4% /var/lib/postgresql/wal
    tmpfs           2.0G   12K  2.0G   1% /run/secrets/kubernetes.io/serviceaccount
    tmpfs           2.0G  4.0K  2.0G   1% /run/secrets/azure/tokens
    tmpfs           7.9G     0  7.9G   0% /proc/acpi
    tmpfs           7.9G     0  7.9G   0% /proc/scsi
    tmpfs           7.9G     0  7.9G   0% /sys/firmware
    

    It seems the usage is indeed really low. Wondering whether it's possible that something triggered a spike in the storage usage?

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

Metadata

Metadata

Assignees

Labels

triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions