Score:1

Restore one protected application in GKE Kubernetes cluster in namespace with multiple apps

id flag

In a Kubernetes cluster I have several apps deployed in the same namespace called "default". An app consist of a webserver pod and a database pod.

How to restore one single app in the original cluster from a backup plan from Backup for GKE?

In the cluster I have defined several ProtectedApplication's for the backup agent for it to identify the distinct applications (websites). This definitions looks like:

kind: ProtectedApplication
apiVersion: gkebackup.gke.io/v1alpha2
metadata:
  name: test
  namespace: default
spec:
  resourceSelection:
    type: Selector
    selector:
      matchLabels:
        app.kubernetes.io/instance: test
  components:
    - name: wordpress
      resourceKind: Deployment
      resourceNames: ["test-wordpress"]
      strategy:
        type: BackupAllRestoreAll
        backupAllRestoreAll: {}
    - name: mariadb
      resourceKind: StatefulSet
      resourceNames: ["test-mariadb"]
      strategy:
        type: BackupAllRestoreAll
        backupAllRestoreAll: {}

My main concern is about the option "Define conflict handling" in the restore plan configuration:

Define conflict handling creating a restore plan

It says:

Any conflicting namespaces in the target cluster (along with all their contained resources) will be deleted before a non-destructive restore is performed.

Does it really removes the entire "default" Kubernetes namespace before restoring only the protected application? I hope it only removes the resources inside the Kubernetes namespace that has the same names as found inside the backup that is to be restored. Can someone help me out here?

Score:2
id flag

Good news! The restore procedure does not remove the whole namespace. But only the artifacts belonging to the ProtectedApplication are first removed, then restored from backup. Perfect!

beatrice avatar
in flag
well the documentation says the opposite of your screenshot: https://cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke/how-to/restore-plan It says what you just experienced.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.