Kubernetes
Run each drill as a CronJob. The job starts a Postgres container as a native sidecar, restores the backup into it through RESTOREPROOF_TARGET_DSN, runs the checks and reports metadata. The sidecar and its data are discarded when the job ends.
How the pod is laid out
- Native sidecar (init container with
restartPolicy: Always): a Postgres server that starts before the runner and keeps running alongside it. It needs Kubernetes 1.29 or later. - Runner container: the
restoreproof drillcommand. It reaches the sidecar on127.0.0.1, because containers in a pod share a network namespace. - Scratch volume: an
emptyDirfor the Postgres data directory, so no restored data is written to a persistent volume.
Docker is not needed in this mode. The runner detects RESTOREPROOF_TARGET_DSN and restores into that database instead of starting its own container.
CronJob manifest
Replace the image with the RestoreProof runner image you build or pull, and the storage access with the method your cluster uses, such as IRSA on EKS or Workload Identity on GKE.
apiVersion: batch/v1
kind: CronJob
metadata:
name: restoreproof-prod-postgres
namespace: restoreproof
spec:
schedule: "17 3 * * *"
concurrencyPolicy: Forbid
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 5
jobTemplate:
spec:
backoffLimit: 0
activeDeadlineSeconds: 3600
template:
metadata:
labels:
app.kubernetes.io/name: restoreproof
spec:
restartPolicy: Never
serviceAccountName: restoreproof-drill # IRSA / Workload Identity binding for read-only backup access
initContainers:
- name: postgres
image: postgres:16
restartPolicy: Always # native sidecar, Kubernetes 1.29+
env:
- name: POSTGRES_USER
value: restore
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: restoreproof-target
key: password
- name: POSTGRES_DB
value: restore
ports:
- containerPort: 5432
readinessProbe:
exec:
command: ["pg_isready", "-U", "restore", "-d", "restore"]
periodSeconds: 2
volumeMounts:
- name: pgdata
mountPath: /var/lib/postgresql/data
containers:
- name: restoreproof
image: ghcr.io/restoreproof/runner:0.1.0 # the runner image
args: ["drill", "--config", "/etc/restoreproof/restoreproof.yml", "--drill", "prod-postgres"]
env:
- name: RESTOREPROOF_API_KEY
valueFrom:
secretKeyRef:
name: restoreproof-api
key: api-key
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: restoreproof-target
key: password
- name: RESTOREPROOF_TARGET_DSN
value: "postgres://restore:$(POSTGRES_PASSWORD)@127.0.0.1:5432/restore?sslmode=disable"
volumeMounts:
- name: config
mountPath: /etc/restoreproof
readOnly: true
volumes:
- name: pgdata
emptyDir: {}
- name: config
configMap:
name: restoreproof-config
The config map holds your restoreproof.yml. Its engine_version should match the Postgres image tag above, and its source points at your backup storage.
kubectl create configmap restoreproof-config \
--namespace restoreproof \
--from-file=restoreproof.yml
kubectl create secret generic restoreproof-api \
--namespace restoreproof \
--from-literal=api-key="$RESTOREPROOF_API_KEY"
kubectl create secret generic restoreproof-target \
--namespace restoreproof \
--from-literal=password="$(openssl rand -base64 24)"
Install with Helm
The Helm chart in the repositoryThe Helm chart in the repository’s deploy/k8s/ directoryrsquo;s deploy/helm/restoreproof/ directory renders the same CronJob from values, so you do not maintain the manifest by hand. Set the schedule, the drill names, and the secret references in a values file, then install:
helm install restoreproof ./deploy/helm/restoreproof \
--namespace restoreproof --create-namespace \
-f restoreproof-values.yaml
helm upgrade restoreproof ./deploy/helm/restoreproof \
--namespace restoreproof -f restoreproof-values.yaml
Check the chart’s values.yaml for the current keys. Keep the API key in a Kubernetes Secret created outside the values file, and reference it by name.
Check a run
kubectl get cronjobs -n restoreproof
kubectl get jobs -n restoreproof
kubectl logs -n restoreproof job/<job-name> -c restoreproof
The job’s exit code follows the drill: 0 when it passed, 1 when it failed. The result also appears in the dashboard.
Restore space. The scratch volume must be large enough for the uncompressed database. Size it from the restored size, not the backup file size.