K10 Applications

Note

The K10 Application resource is in developer preview and a number of breaking changes to the resource API schema may happen in subsequent releases.

A K10 Application resource represents an application that K10 has automatically discovered on the Kubernetes cluster. The application encapsulates all stateless and stateful resources that comprise the application.

Life Cycle and Namespaces

K10 Application resources are read-only and are automatically instantiated by K10 when it discovers applications that are running on the Kubernetes cluster.

A K10 Application resource is available in for each application that is currently running in the cluster. This resource resides in the same namespace as the application that it corresponds to.

When an application, for which K10 has at least one existing RestorePointContent from a previous backup, is deleted from the cluster, a K10 Application resource representing the application is still available in the namespace where K10 is installed. The resource will be marked as a deleted application, but it will be possible for an administrator to restore the application.

K10 Apps are also available to track applications that have been deleted from the Kubernetes cluster, but are available to be restored based on an existing RestorePointContent captured by K10.

K10 Application Operations

List K10 Applications

The K10 Application API allows you to discover all applications that are installed and currently present on the Kubernetes cluster.

# list available applications
$ kubectl get applications.apps.kio.kasten.io --namespace kasten-io \
                           --field-selector=status.state=Active
NAME                       AGE
my-app-1                   <unknown>
my-app-2                   <unknown>
my-app-3                   <unknown>

List Deleted K10 Applications

The K10 Application API allows you to discover applications that K10 can restore which have been previously deleted from the cluster.

# list deleted applications
$ kubectl get applications.apps.kio.kasten.io --namespace kasten-io \
                           --field-selector=status.state=Deleted
NAME                       AGE
my-app-5                   <unknown>
my-app-6                   <unknown>

Restore Deleted K10 Applications

In addition to discovery of deleted applications, K10 makes it possible to restore an application that has been deleted but was previously protected.

The procedure, which requires K10 administrative privileges, is as follows:

  • Step 1: Find the RestorePointContent that corresponds to the desired point-in-time.

  • Step 2: Re-create the namespace where you would like to restore the application.

  • Step 3: Create a RestorePoint in the new namespace that is backed by the RestorePointContent. See Creating RestorePoint from RestorePointContent Example for details.

  • Step 4: Initiate a RestoreAction to restore the application from the created RestorePoint. See RestoreAction for details.

Get K10 Application Components

In addition to discovering the applications on the cluster, K10 also tracks all resources associated with the application. You can get a summary of all resources (stateful and stateless) discovered in the context of the application. This is done by querying a details sub-resource for the particular application you are interested in.

# get the details of application named <APPNAME> in namespace <NS>
# yq is used for readability
$ kubectl get --raw /apis/apps.kio.kasten.io/v1alpha1/namespaces/<NS>/applications/<APPNAME>/details | yq -y .status.appDetails
components:
  config:
  - kind: secret
    name: default-token-wghrq
    namespace: sample-app
  - kind: secret
    name: muddled-saola-postgresql
    namespace: sample-app
  network:
  - kind: service
    name: muddled-saola-postgresql
    namespace: sample-app
  - kind: service
    name: muddled-saola-postgresql-headless
    namespace: sample-app
  volumes:
  - persistentVolumeClaimName: datadir
    size: 1
    type: EBS
  workloads:
  - kind: statefulset
    name: muddled-saola-postgresql
    namespace: sample-app

Initiate Backup for an Application

K10 Apps can be protected on a scheduled basis using a Policy or in an ad hoc manner using a BackupAction.

For details see, Create a Backup Policy or BackupAction.

K10App API Type

The following is a complete specification of the K10 Application resource.

Note

The K10App resource is read-only.

# Standard Kubernetes API Version declaration. Required.
apiVersion: apps.kio.kasten.io/v1alpha1
# Standard Kubernetes Kind declaration. Required.
kind: Application
# Standard Kubernetes metadata. Required.
metadata:
  # Name of the K10App. Auto-derived.
  name: sample-app
  # Namespace of the K10App. Auto-derived.
  namespace: sample-app
  # Timestamp for when the application was created.
  creationTimestamp: '2019-02-11T03:03:47Z'
# K10App parameters. Required.
spec:
  # Currently only applications defines as namespaces are supported.
  # This may change in the near future with additional app types
  # Namespaced based app.
  namespace:
    # Name of the namespace hosting the application
    name: sample-app
# Status of the K10App. Users should not set any data here.
status:
  # State of the application.
  # Possible values:
  # Active - application is currently active
  # Deleted - application is not active but can be recovered
  state: Active

K10App Details API Type

The following is a complete specification of the appDetails section of the K10 Application API. These fields are only available in the K10 Application API when the details sub-resource is used as shown in the example above.

apiVersion: apps.kio.kasten.io/v1alpha1
kind: Application
...
spec:
...
status:
  ...
  # Details about the components of the application.
  appDetails:
    # Categorized components of the application.
    components:
      # List of 'config' components.
      config:
        # Zero or more elements.
        # Kind for config components.
      - kind: secret
        # Kubernetes name of the component.
        name: default-token-wghrq
        # Namespace of the component.
        namespace: sample-app
        # API version of the component.
        apiVersion: v1
        # Group name of the component.
        group:
        # Resource name of the component.
        resource: secrets
        # Annotations of the component.
        annotations:
        - sample-annotation: sample-app
        # List of blueprints bound to the resource via blueprint bindings.
        boundBlueprints:
          # Name of the bound blueprint.
        - name: my-blueprint
          # Namespace of the bound blueprint.
          namespace: kasten-io
          # Reference to a source blueprint binding.
          bindingRef:
            name: my-blueprint-binding
            namespace: kasten-io
      # List of 'network' components.
      network:
        # Analogous to 'config'.
        # Possible kinds: service | ingress
      # List of 'workload' components.
      workloads:
        # Analogous to 'config'.
        # Possible kinds: deployment | statefulset | cronjob
      # List of 'customresource' components.
      customresources:
        # Analogous to 'config'.
      # List of 'volumes' components.
      volumes:
        # Analogous to 'config' with the following additional fields:
        #   persistentVolumeClaimName - name of PVC
        #   podName - name of the pod
        #   size - size of underlying volume in GB
        #   type - identifier of disk type
      - persistentVolumeClaimName: datadir
        podName: sample-app-84xu1
        size: 1
        type: EBS

    # Additional component types maybe introduced.