The module lifecycle stage: Preview
The module has requirements for installation
Disk Snapshot-Based Backup
Disk snapshot creation depends on a separate module snapshot-controller.
The snapshot-controller module must be enabled, and one of the CSI drivers from the list must also be configured.
For example, sds-local-volume in LVM Thin mode.
Creating a Postgres Snapshot
Ensure that the selected spec.instance.persistentVolumeClaim.storageClassName supports snapshotting.
If storageClassName was not explicitly specified, ensure that the default storageClassName in the DKP cluster supports this feature.
To create a disk snapshot, simply apply the following resource:
apiVersion: managed-services.deckhouse.io/v1alpha1
kind: PostgresSnapshot
metadata:
name: my-first-snapshot
spec:
postgresName: my-postgresThe disk snapshot result can be seen in the resource status:
kubectl get postgressnapshot -n postgres-ek my-first-snapshot -oyaml | yq .status
completedAt: "2025-12-04T19:00:31Z"
phase: completed
postgres:
cluster:
replication: Availability
topology: Ignored
configuration:
maxConnections: 300
databases:
- name: test
instance:
cpu:
coreFraction: 50
cores: 1
memory:
size: 1Gi
persistentVolumeClaim:
size: 1Gi
storageClassName: thin-local-storage-class
postgresClassName: default
type: Cluster
startedAt: "2025-12-04T19:00:16Z"
volumeSnapshotName: d8ms-pg-my-first-snapshotRestoring from a Snapshot
To restore Postgres from a disk snapshot, apply a new Postgres resource with the spec.dataSource parameter.
Note that this operation is almost identical to creating a new Postgres cluster. That is, when creating such a resource, all validations for the corresponding PostgresClass will be performed.
This provides the advantage that the configuration for the restored cluster can be modified at this stage.
The restored SQL databases, LOGIN users, passwords and privileges remain as captured in the snapshot. Inventory publishes unmanaged PostgresDatabase and PostgresUser resources. The old Postgres.spec.databases and Postgres.spec.users lists do not delete or recreate them. To resume management, fill the corresponding inventory resources after restoration; PostgresUser adoption requires one password source. Kubernetes Secrets are separate resources and are not restored from the database disk snapshot. See User management for password sources and adoption.
kubectl apply -f managed-services_v1alpha2_postgres.yaml -n postgresapiVersion: managed-services.deckhouse.io/v1alpha2
kind: Postgres
metadata:
name: my-restored-postgres
spec:
dataSource:
objectRef:
kind: PostgresSnapshot
name: my-first-snapshot
postgresClassName: default
instance:
memory:
size: 1Gi
cpu:
cores: 1
coreFraction: "50%"
persistentVolumeClaim:
size: 1Gi
storageClassName: thin-local-storage-class
configuration:
maxConnections: 300
type: Cluster
cluster:
topology: Ignored
replication: AvailabilityThe restoration success will be reflected in the status of the created Postgres resource:
kubectl get postgres my-restored-postgres -n postgres -o wide -w