Apps with a PostgreSQL database that were updated to the new CNPG common sometimes don't survive a reboot of TrueNAS Scale. The App then hangs on DEPLOYING and pods are in state Completed or TaintToleration.
This guide has been written with the best efforts of the staff and tested as best possible. We are not responsible if it doesn't work for every scenario or user situation or if you suffer data loss as a result. This guide has been tested with TrueNAS SCALE 22.12.4.2, Cobia beta, CNPG 1.20.2_2.0.3 and HomeAssistant 2023.10.3_20.0.12.
If you have rebooted and your Apps are hanging on DEPLOYING, check if you see pods in state Completed or TaintToleration and the apps main pod in state Init with the command k3s kubectl get all -n ix-<app-name>
.
Examples:
k3s kubectl get all -n ix-home-assistant
NAME READY STATUS RESTARTS AGE
pod/home-assistant-cnpg-main-1 0/1 TaintToleration 0 12h
pod/home-assistant-cnpg-main-2 0/1 TaintToleration 0 12h
pod/home-assistant-85865456d5-tc8h4 0/1 TaintToleration 0 12h
pod/home-assistant-85865456d5-kl96x 0/1 Init:0/2 0 12h
k3s kubectl get all -n ix-home-assistant
NAME READY STATUS RESTARTS AGE
pod/home-assistant-cnpg-main-2 0/1 Completed 0 22m
pod/home-assistant-cnpg-main-rw-df9bcbccc-s8z2n 0/1 Completed 0 23m
pod/home-assistant-cnpg-main-rw-df9bcbccc-ptltn 0/1 Completed 0 23m
pod/home-assistant-cnpg-main-rw-df9bcbccc-jbbcj 1/1 Running 0 12m
pod/home-assistant-5867d984d9-gfznd 0/1 Completed 0 23m
pod/home-assistant-cnpg-main-1 0/1 Completed 0 23m
pod/home-assistant-cnpg-main-rw-df9bcbccc-q2w2d 1/1 Running 0 12m
pod/home-assistant-5867d984d9-vcp6x 0/1 Init:0/2 0 12m
Logs from the cnpg-wait container in the main app pod show something like this:
Testing database on url: home-assistant-cnpg-main-rw
home-assistant-cnpg-main-rw:5432 - no response
To recover your app, you need to first stop it (do not click the Stop button!), delete the hanging pods and then restart the app.
heavyscript app --stop <app-name>`
k3s kubectl delete pods -n ix-<app-name> <pod name>`
e.g. k3s kubectl delete pods -n ix-home-assistant home-assistant-85865456d5-tc8h4
heavyscript app --start <app-name>
systemctl restart middlewared