Backup, Restore and Uninstall
Tiphys's persistence backend (default: SQLite on a PVC) holds reports, approvals, snoozes, the audit trail, and conversations. Lose the PVC and you lose every operator-visible artifact in those stores. Backup is operator-managed; this doc captures the recommended patterns, and how to remove Tiphys completely.
The commands below assume the install from
Getting started: release tiphys in namespace
tiphys. Then the StatefulSet is tiphys, its pod tiphys-0, and the
state PVC state-tiphys-0. With another release name, the StatefulSet
is the release name if it contains tiphys, otherwise
<release>-tiphys, and the PVC is state-<statefulset>-0. Check with:
kubectl -n tiphys get statefulset,pvc
The database lives at /var/lib/tiphys/state.db inside the pod,
mounted from that PVC.
What's in the database
| Store | Purpose | Recovery if lost |
|---|---|---|
reports | Health reports + diffs | Re-runs on next scheduled scan |
approvals | Pending + decided approvals | Pending lost (operator restages); decided history lost |
snoozes | Per-finding acknowledgement state | Operator re-acknowledges noisy findings |
audit_events | The audit trail: changes, approvals, reads, sign-ins | Lost for good; export it first (Audit page, Export) if you need it |
audit | The earlier audit log, kept read only | Lost for good |
conversations | Chat threads with the agent | Lost for good |
auth_accounts | The built-in sign-in's admin account and password hash | admin is recreated on next start, with a new one-time password or the one in auth.builtin.existingSecret |
auth_sessions | Signed-in sessions | Everyone signs in again |
tour_seen | Who has seen the guided tour of the app | The tour shows once more, in browsers that don't remember it |
The audit trail and conversations are the load-bearing reason to back up. Reports and snoozes regenerate; the audit trail and conversations don't.
The helper pod
The one-off backup and the restore below copy files through a short-lived
pod that mounts the state PVC while Tiphys is scaled to 0. It runs the
same backend image Tiphys runs, so it needs nothing from Docker Hub and
works on air-gapped clusters, and it runs as the image's non-root user,
so it's admitted under the restricted Pod Security Standard.
# The backend image this install runs (a mirrored registry included)
IMAGE=$(kubectl -n tiphys get statefulset tiphys \
-o jsonpath='{.spec.template.spec.initContainers[?(@.name=="backend")].image}')
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
name: tiphys-state-helper
namespace: tiphys
spec:
automountServiceAccountToken: false
securityContext:
runAsNonRoot: true
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
seccompProfile:
type: RuntimeDefault
containers:
- name: shell
image: ${IMAGE}
command: ["sleep", "3600"]
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]
volumeMounts:
- name: state
mountPath: /var/lib/tiphys
volumes:
- name: state
persistentVolumeClaim:
claimName: state-tiphys-0
EOF
kubectl -n tiphys wait --for=condition=Ready pod/tiphys-state-helper --timeout=120s
If your registry needs credentials (images.pullSecrets), add the same
imagePullSecrets to the pod's spec.
CSI volume snapshots (recommended)
EBS-backed PVCs in EKS support CSI snapshots.
Once the snapshot CRDs and controller are installed, you can schedule
periodic snapshots of the Tiphys state PVC. Not every storage class
can snapshot: kind's default standard class and other local-path or
hostPath provisioners can't, so on those use the
one-off backup instead. Check with
kubectl get volumesnapshotclass: if it lists none for your CSI
driver, snapshots won't work.
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
name: tiphys-state-2026-04-25
namespace: tiphys
spec:
volumeSnapshotClassName: ebs-vsc
source:
persistentVolumeClaimName: state-tiphys-0
Schedule with Velero or snapscheduler for daily/hourly cadence. To restore one, see Restore from a snapshot.
One-off backup with kubectl cp
For an ad-hoc backup before a risky change (for example, before reinstalling the chart):
# Quiesce writes (scale to 0)
kubectl -n tiphys scale statefulset tiphys --replicas=0
kubectl -n tiphys wait --for=delete pod/tiphys-0 --timeout=120s
# Start the helper pod (above), then copy the DB file (and WAL/shm sidecars) out.
# A clean shutdown usually leaves no WAL or shm file, so a "No such file or
# directory" from the last two lines is fine.
kubectl -n tiphys cp tiphys-state-helper:/var/lib/tiphys/state.db ./state.db
kubectl -n tiphys cp tiphys-state-helper:/var/lib/tiphys/state.db-wal ./state.db-wal 2>/dev/null || true
kubectl -n tiphys cp tiphys-state-helper:/var/lib/tiphys/state.db-shm ./state.db-shm 2>/dev/null || true
# Tear down
kubectl -n tiphys delete pod tiphys-state-helper
kubectl -n tiphys scale statefulset tiphys --replicas=1
For a hot backup (no scale-to-zero), prefer SQLite's online backup
over cp: cp against a writing DB risks a corrupt copy
because of the separate WAL file. The backend image has no sqlite3
CLI, but its Python has the sqlite3 module, so run the backup in the
backend container and copy the result out. The result is one
self-contained file, with no WAL to copy:
kubectl -n tiphys exec tiphys-0 -c backend -- python -c \
"import sqlite3; src = sqlite3.connect('/var/lib/tiphys/state.db'); dst = sqlite3.connect('/tmp/state-backup.db'); src.backup(dst); dst.close(); src.close()"
kubectl -n tiphys cp tiphys-0:/tmp/state-backup.db ./state.db -c backend
kubectl -n tiphys exec tiphys-0 -c backend -- rm /tmp/state-backup.db
Restore
The StatefulSet always mounts the PVC named state-tiphys-0. Whichever
way you restore, the data has to end up in a PVC with exactly that
name, in the release's namespace, or Tiphys starts on an empty volume.
Restore from a snapshot
A PVC's dataSource can't be changed once it exists, so replace the
PVC with one of the same name, created from the snapshot.
# Scale to 0
kubectl -n tiphys scale statefulset tiphys --replicas=0
kubectl -n tiphys wait --for=delete pod/tiphys-0 --timeout=120s
# The snapshot must say READYTOUSE true before you go on
kubectl -n tiphys get volumesnapshot tiphys-state-2026-04-25
# Note the current PVC's storage class and size, then delete it.
# Under the usual Delete reclaim policy this deletes its volume too;
# the snapshot is kept.
kubectl -n tiphys get pvc state-tiphys-0 \
-o jsonpath='{.spec.storageClassName} {.spec.resources.requests.storage}{"\n"}'
kubectl -n tiphys delete pvc state-tiphys-0
# The same name, from the snapshot. Use the class and size from above;
# the size must be at least the snapshot's RESTORESIZE.
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: state-tiphys-0
namespace: tiphys
labels:
app.kubernetes.io/name: tiphys
app.kubernetes.io/instance: tiphys
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: <storage class>
resources:
requests:
storage: 5Gi
dataSource:
apiGroup: snapshot.storage.k8s.io
kind: VolumeSnapshot
name: tiphys-state-2026-04-25
EOF
# Scale back to 1
kubectl -n tiphys scale statefulset tiphys --replicas=1
Restore a file backup
This copies state.db (from either backup above) into the existing
PVC. Remove the old WAL and shm files first: SQLite would replay an old
WAL into the restored database and corrupt it.
# Scale to 0
kubectl -n tiphys scale statefulset tiphys --replicas=0
kubectl -n tiphys wait --for=delete pod/tiphys-0 --timeout=120s
# Start the helper pod (above), then replace the database
kubectl -n tiphys exec tiphys-state-helper -- \
rm -f /var/lib/tiphys/state.db-wal /var/lib/tiphys/state.db-shm
kubectl -n tiphys cp ./state.db tiphys-state-helper:/var/lib/tiphys/state.db
# Only if your backup has a WAL file (a cold backup can):
kubectl -n tiphys cp ./state.db-wal tiphys-state-helper:/var/lib/tiphys/state.db-wal
# Tear down and scale back to 1
kubectl -n tiphys delete pod tiphys-state-helper
kubectl -n tiphys scale statefulset tiphys --replicas=1
After restoring
If the pod doesn't come up, check the backend log for Can't open the state database: Tiphys couldn't open or write the restored file, and
stopped rather than run without it.
Troubleshooting has
the causes.
kubectl -n tiphys logs tiphys-0 -c backend | grep "Can't open the state database" || echo "no state database errors"
Then confirm reports, the audit trail, and conversations are back in the UI.
If you restored across a chart version boundary, nothing is migrated:
on start the agent creates any missing tables and indexes
(CREATE TABLE IF NOT EXISTS) and leaves existing ones as they are.
Each record is stored as JSON, and fields added in a later version get
defaults when an older record is read. Keep at least one snapshot from
before each upgrade.
Uninstall
helm uninstall removes what the chart made: the StatefulSet (or
Deployment), the Service, the service account, the roles and bindings
(the cluster-wide ones too), and the chart's own ConfigMap and Secrets.
It leaves what was made at runtime. These steps remove that too.
Before you start, export what you want to keep. The audit trail and conversations go with the PVC.
- On the Audit page, choose Export (JSON or CSV).
- On the same page, under Changes and approvals, each
change.succeededevent whose target is ahelm_releaseis a chart Tiphys installed or upgraded on your approval. Note the ones you want to remove (step 4).
# 1. The chart
helm uninstall tiphys -n tiphys
# 2. The state PVC (persistence.mode: sqlite, the default). A
# StatefulSet's volume claims outlive it, so Helm leaves this one.
kubectl -n tiphys delete pvc state-tiphys-0 --ignore-not-found
# 3. The ConfigMaps Tiphys creates as it runs: the scan cache and
# the cost state, always...
kubectl -n tiphys delete configmap --ignore-not-found \
tiphys-scan tiphys-prices tiphys-billed-costs
# ...and, in persistence.mode: configmap, the stores (use your own
# names if you set reports.configmapName, approvals.configmapName
# or the persistence.*ConfigmapName values)
kubectl -n tiphys delete configmap --ignore-not-found \
tiphys-reports tiphys-approvals tiphys-snoozes tiphys-audit \
tiphys-audit-events tiphys-conversations tiphys-tour
# 4. Releases Tiphys installed that you no longer want, one at a time
helm list -A
helm uninstall <release> -n <namespace>
# 5. Secrets you created for the install (the existingSecret values:
# sign-in password, model API key, license), if nothing else uses them
kubectl -n tiphys delete secret <name>
# 6. The namespace, if Tiphys was all that ran in it
kubectl delete namespace tiphys
Deleting the namespace in step 6 removes steps 2, 3 and 5 with it; the steps are separate for an install that shares its namespace.
Check that nothing is left:
kubectl get namespace tiphys # NotFound, after step 6
kubectl -n tiphys get all,pvc,configmap,secret # without step 6: only kube-root-ca.crt
kubectl get clusterrole,clusterrolebinding -l app.kubernetes.io/instance=tiphys
kubectl get pv | grep tiphys/state-tiphys-0 # nothing, unless the reclaim policy is Retain
A volume whose storage class uses the Retain reclaim policy stays as
a Released PersistentVolume after its PVC is gone. Delete it with
kubectl delete pv <name>, then the disk behind it in your cloud or
storage system.
Left on purpose
- Changes Tiphys made on your approval. Manifests it applied, scales,
restarts, and the Helm releases from step 4 are your workloads now.
Uninstalling Tiphys doesn't roll them back. What it applied records
tiphysas a field manager. - Your backups. VolumeSnapshots, Velero backups, and the files you copied out or exported. Delete them when you no longer need them.
- Access you created outside the cluster. The IAM role, its policies, and the IRSA trust or Pod Identity association from Getting started. Remove them the way you created them.
What this doc does NOT cover
- Backing up ConfigMap-mode persistence (
persistence.mode=configmap): the stores are the ConfigMaps in step 3 of Uninstall, andkubectl -n tiphys get configmap <names> -o yamlsaves them. Most operators are on SQLite. - Cross-region disaster recovery: set it up on your side (for example, EBS snapshot copies to a second region) and keep it in your runbook.