Restore Points

RestorePoint

A RestorePoint API resource is used to represent a K10 App that is captured at a specific time as a result of a BackupAction or a RestoreAction.

A RestorePoint resides in the namespace of the K10 App and access to it can be controlled using Kubernetes RBAC role and binding for the RestorePoint API.

List RestorePoint Example

The following example illustrates listing all RestorePoints for a sample application.

# list restore point in namespace 'sample-app'
$ kubectl get restorepoints.apps.kio.kasten.io --namespace sample-app
NAME                              AGE
sample-app-backup-rp-raq923       1h
sample-app-backup-rp-rdq309       2h

Get RestorePoint Details Example

In addition to getting a RestorePoint, you can also query the details associated with the restore point. You would use the details sub-resource for that purpose.

# get the details for restorepoint 'sample-app-backup-rp-raq923' created in 'mysql' namespace
# yq only used for readability
$ kubectl get --raw /apis/apps.kio.kasten.io/v1alpha1/namespaces/mysql/restorepoints/sample-app-backup-rp-raq923/details | yq -y .status.restorePointDetails
artifacts:
  ...
originatingPolicies:
  ...

Delete RestorePoint Example

For RestorePoints created by policy, RestorePoints will automatically be deleted as part of the retention scheme that is specified.

A K10 administrator may chose to not enable RBAC that allows deleting RestorePoints directly in order to force such operations to happen through policy retirement only.

# delete restore point 'sample-app-backup-rp-raq923' in namespace 'sample-app'
$ kubectl delete restorepoints.apps.kio.kasten.io sample-app-backup-rp-raq923 --namespace sample-app
restorepoint.apps.kio.kasten.io/sample-app-backup-rp-raq923 deleted

Note

Currently, deleting a RestorePoint manually does not delete the underlying resources. For all associated resources (e.g. persistent volumes, application-level artifacts, etc.) to be reclaimed, see, Delete RestorePointContent Example

Creating RestorePoint from RestorePointContent Example

When an application which has previously been protected by K10 is deleted, the RestorePoints associated with the application are no longer available, but the corresponding RestorePointContent resources remain available. A K10 administrator has the opportunity re-create a RestorePoint that would be bound to the RestorePointContent.

The following example illustrates creating a RestorePoint in the mysql namespace. The operation requires that the caller has read access to the RestorePointContent resource.

$ cat > create-rp-from-rpc.yaml <<EOF
apiVersion: apps.kio.kasten.io/v1alpha1
kind: RestorePoint
metadata:
  name: new-restore-point
  namespace: mysql
spec:
  restorePointContentRef:
    name: rpc-mysql-backup
    namespace: kasten-io
EOF

$ kubectl create -f create-rp-from-rpc.yaml
restorepoint.apps.kio.kasten.io/new-restore-point created

#validate that the new restore point is bound
$ kubectl get restorepoints.apps.kio.kasten.io new-restore-point --namespace mysql \
       -ojsonpath="{.status.state}{'\n'}"
Bound

RestorePoint API Type

The following is a complete specification of the RestorePoint resource.

# Standard Kubernetes API Version declaration. Required.
apiVersion: apps.kio.kasten.io/v1alpha1
# Standard Kubernetes Kind declaration. Required.
kind: RestorePoint
# Standard Kubernetes metadata. Required.
metadata:
  # Name of the RestorePoint. Required.
  name: sample-restore-point
  # Namespace of the RestorePoint. Required.
  namespace: sample-app
  # Kubernetes labels
  labels:
  # Labels that can be used fot filtering.
  # Automatically populated when creating the the resource
  k10.kasten.io/appName: sample-app
  k10.kasten.io/appNamespace: sample-app
# Restore point resource parameters
spec:
  # Reference to the underlying RestorePointContent resource.
  # When creating a RestorePoint the caller need to have
  # read access to the RestorePointContent being referenced.
  restorePointContentRef:
    # Name of the underlying RestorePointContent resource
    name: rpc-sample-app-backip-art245
    # RestorePointContent namespace. Always K10 namespace.
    namespace: kasten-io
# Status of the RestorePointContent. Users should not set any data here.
status:
  # State of the resource.
  # Possible values:
  #   Bound - corresponding RestorePoint resource exists
  #   Unbound - no RestorePoint references the resource
  state: Bound
  # Scheduled backup or import time associated with the resource.
  # Could be 'null' for on-demand actions.
  scheduledTime: '2019-02-11T03:03:47Z'
  # Time of actual creation by the corresponding action
  actionCreationTime: '2019-02-11T03:03:47Z'

RestorePointContent

A RestorePointContent API resource backs the content of a RestorePoint. The resource resides in the namespace in which K10 is installed.

When a RestorePoint exists for a given RestorePointContent, that RestorePointContent resource is bound. If there is no corresponding RestorePoint (e.g. application was deleted), then the resource is unbound.

Deletion of a RestorePointContent resource frees up the artifacts associated with the restore point content and deletes any bound RestorePointContents.

Access to RestorePointContent is typically reserved for users with K10 administrative privileges through Kubernetes RBAC since the resources reside in the K10 namespace.

List RestorePointContent Example

RestorePointContent resources can be listed similarly to RestorePoint resources, but the operation happens in the K10 namespace.

In addition, to get the RestorePointContent resources associated with a specific K10App, you can use a label selector to constrain your query.

# list RestorePointContent resources for 'sample-app'
# assume K10 is installed in 'kasten-io'
$ kubectl get restorepointcontents.apps.kio.kasten.io \
    --selector=k10.kasten.io/appName=sample-app
NAME                              AGE
sample-app-backup-rp-raq923       1h
sample-app-backup-rp-rdq309       2h

Get RestorePointContent Details Example

In addition to getting a RestorePointContent, you can also query the details associated with the restore point content. You would use the details sub-resource for that purpose.

# get the details for restorepointcontent 'sample-app-backup-rp-raq923'
# yq only used for readability
$ kubectl get --raw /apis/apps.kio.kasten.io/v1alpha1/restorepointcontents/sample-app-backup-rp-raq923/details | yq -y .status.restorePointContentDetails
artifacts:
  ...
originatingPolicies:
  ...

Delete RestorePointContent Example

In addition to policy-based deletion of RestorePoints and RestorePointContents, you can explicitly delete a RestorePointContent. Deleting a RestorePointContent will cause its bound RestorePoints and all associated resources (e.g. persistent volumes, application-level artifacts, etc.) to be reclaimed.

Deleting a RestorePointContent resource creates a RetireAction that can be examined to monitor progress of the retirement.

Warning

Deletion of a RestorePointContent is permanent and overrides retention by a Policy.

The following example illustrates deleting a RestorePointContent. The operation requires that the caller has delete access to the RestorePointContent resource.

# delete restore point content 'sample-app-backup-rpc-raq923'
$ kubectl delete restorepointcontents.apps.kio.kasten.io sample-app-backup-rpc-raq923
restorepointcontent.apps.kio.kasten.io/sample-app-backup-rpc-raq923 deleted

RestorePointContent API Type

The following is a complete specification of the RestorePointContent resource.

Note

The RestorePointContent resource cannot be created directly.

# Standard Kubernetes API Version declaration. Required.
apiVersion: apps.kio.kasten.io/v1alpha1
# Standard Kubernetes Kind declaration. Required.
kind: RestorePointContent
# Standard Kubernetes metadata. Required.
metadata:
  # Name of the RestorePointContent. Required.
  name: sample-restore-point-content
  # Namespace of the RestorePointContent. Required.
  # Always in K10 namespace.
  namespace: kasten-io
  # Kubernetes labels
  labels:
  # Labels that can be used fot filtering.
  # Automatically populated when creating the the resource
  k10.kasten.io/appName: sample-app
  k10.kasten.io/appNamespace: sample-app
# Status of the RestorePointContent. Users should not set any data here.
status:
  # State of the resource.
  # Possible values:
  #   Bound - corresponding RestorePoint resource exists
  #   Unbound - no RestorePoint references the resource
  state: Bound
  # Scheduled backup or import time associated with the resource.
  # Could be 'null' for on-demand actions.
  scheduledTime: '2019-02-11T03:03:47Z'
  # Time of actual creation by the corresponding action
  actionCreationTime: '2019-02-11T03:03:47Z'