skbn icon indicating copy to clipboard operation
skbn copied to clipboard

[Question] Any examples to restore from thinBackup zipped file into Jenkins in GKE?

Open scheung38 opened this issue 2 years ago • 0 comments

https://github.com/helm/charts/tree/master/stable/jenkins

Restore from backup To restore a backup, you can use the kube-tasks underlying tool called skbn, which copies files from cloud storage to Kubernetes. The best way to do it would be using a Job to copy files from the desired backup tag to the Jenkins pod. See the skbn in-cluster example for more details.


I have uploaded into Google Storage:

gsutil cp ~/Desktop/jenkins-full.tgz gs://migrate_sample

so the:

Authenticated URL: https://storage.cloud.google.com/migrate_sample/jenkins-full.tgz?authuser=1 gsutil URI: gs://migrate_sample.tgz

How to use the following jobs.yaml? I see it is not configured for GCP but AWS?

apiVersion: batch/v1
kind: Job1
metadata:
  labels:
    app: skbn
  name: skbn
spec:
  template:
    metadata:
      labels:
        app: skbn
      annotations:
        iam.amazonaws.com/role: skbn # We are using kube2iam <- Swap skbn -> kube2iam and create ServiceAccount? https://github.com/jtblin/kube2iam/blob/master/examples/eks-example.yml
    spec:
      restartPolicy: OnFailure
      serviceAccountName: skbn
      containers:
      - name: skbn
        image: maorfr/skbn
        command: ["skbn"]
        args:
        - cp
        - --src
        - k8s://namespace/pod/container/path/to/copy/from
        - --dst
        - s3://bucket/path/to/copy/to
        imagePullPolicy: IfNotPresent
        env:
        - name: AWS_REGION
          value: eu-central-1

Also in this case I would need to swap src and dst from example to:

    - --src
    - gs://migrate_sample/jenkins-full.tgz
    - --dst
    - k8s://namespace/pod/container/path/to/copy/to
    

How do we get k8s://namespace/pod/container/path/to/copy/to

Assuming namespace is jenkins, would it be

k8s://jenkins/my-jenkins-0/var/backups

scheung38 avatar Dec 15 '21 11:12 scheung38