Added a warning about the scope of the B&R description
[doc.git] / docs / guides / onap-operator / onap_backup_restore.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0
2 .. International License. http://creativecommons.org/licenses/by/4.0
3 .. Copyright 2017-2020 Aarna Networks, Inc.
4
5 .. Links
6 .. Github web page to download the latest version of velero open source tool
7 .. _Velero official website: https://velero.io
8 .. Reference link with more details on Instructions for setting up Velero server
9 .. _Setup Velero Server: https://velero.io/docs/v1.5/contributions/minio/#set-up-server
10
11 Backup and Restore Solution
12 ###########################
13
14 .. warning::
15     This description is not covering the Backup & Restore procedure of the full
16     ONAP platform, but gives examples for the usage of Velero.
17     The ONAP community will focus on Disaster Recovery including B&R
18     in the coming releases.
19
20
21 Problem Statement and Requirement (User Story)
22 ==============================================
23
24 As an ONAP Operator- We require the ability to backup and restore ONAP state data, We want to have Disaster recovery solution for ONAP deployment done over K8.
25
26 Basic Use case would be
27
28 1) Add/Update/Modify the POD Data or DB Data.
29 2) Simulate a Disaster
30 3) Restore using Backup.
31 4) POD Data/DB entries should be recovered.
32
33 Solution Description
34 ====================
35
36 Narrowed down upon a tool which can be used for K8 Backup and Restoration for ONAP deployments named as Velero (formerly Heptio-ARK)
37
38 Velero is  an Opensource tool to back up and restore your Kubernetes cluster resources and persistent volumes. Velero lets you:
39
40 * Take backups of your cluster and restore in case of loss.
41 * Copy cluster resources across cloud providers. NOTE: Cloud volume migrations are not yet supported.
42 * Replicate your production environment for development and testing environments.
43
44 Velero consists of
45
46 * A server that runs on your cluster
47 * A command-line client that runs locally
48
49 Working Flow diagram
50
51 .. figure:: Backup-And-Restore.png
52    :align: center
53
54 Installation
55 ============
56 Prerequisites
57 -------------
58
59 - Access to a Kubernetes cluster, version 1.7 or later.
60 - A DNS server on the cluster
61 - kubectl installed
62 - Labels should be defined there.
63
64 Install Velero Tool
65 ~~~~~~~~~~~~~~~~~~~
66 Velero is an open source tool to safely backup and restore, perform disaster recovery, and migrate Kubernetes cluster resources and persistent volumes.
67
68 Go to `Velero official website`_ and Click on DOWNLOAD VELERO BUTTON. It will take you to the github page to download the latest version of velero. Scroll down to the
69 bottom of the page and choose the binary corresponding to the OS where you want to run the Velero on.
70
71 Install and configure Velero Server and Client
72 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73
74 To configure the latest version (1.5.2) of velero on Linux machine, please follow the below steps.
75
76 Run the below command. It will download the velero to your machine
77
78 .. code-block:: bash
79
80    wget https://github.com/vmware-tanzu/velero/releases/download/v1.5.2/velero-v1.5.2-linux-amd64.tar.gz
81
82 Extract it using below command
83
84 .. code-block:: bash
85
86    tar -zxvf velero-v1.5.2-linux-amd64.tar.gz
87
88 Once extracted, goto the directory "velero-v1.5.2-linux-amd64"
89
90 .. code-block:: bash
91
92    cd velero-v1.5.2-linux-amd64
93
94 Inside this you will find a directory called examples and then minio, just go inside it
95
96 .. code-block:: bash
97
98    cd examples/minio
99
100 Inside this you will find a file called 00-minio-deployment.yaml. Open this file using any editor and look for Velero service yaml portion, there you need to change
101 the type from ClusterIP to NodePort
102
103 Once made the changes then run the below command to deploy velero server
104
105 .. code-block:: bash
106
107    kubectl apply -f 00-minio-deployment.yaml
108
109 This will configure the Velero with Minio. Minio is nothing but local storage with aws s3 capabilities. Velero support many cloud providers as well like Azure,AWS,GCP
110 etc. You can configure any of those.
111
112 Once the Velero deployment is done, then we need to install and configure the velero server component using velero cli.
113
114 Create a Velero-specific credentials file (credentials-velero) in your local directory
115
116 .. code-block:: bash
117
118    [default]
119    aws_access_key_id=minio
120    aws_secret_access_key=minio123
121
122 Start the server and the local storage service. In the Velero directory, run
123
124 .. code-block:: bash
125
126     ./velero install \
127     --provider aws \
128     --plugins velero/velero-plugin-for-aws:v1.0.0 \
129     --bucket velero \
130     --secret-file ./credentials-velero \
131     --use-volume-snapshots=false \
132     --backup-location-config region=minio,s3ForcePathStyle="true",s3Url=http://minio.velero.svc:9000
133     --use-restic
134
135 Refer this for more details: `Setup Velero Server`_
136
137 .. note::
138
139    As Labels need to be defined, because that is a unique identity which we need to have for any backup of our k8 containers,
140
141    So in OOM code, Where -ever we don't have labels, We need to define that whether its configmap or secret, for eg below:-
142
143    labels:
144
145    app: {{ include "common.name" . }}
146    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
147    release: {{ .Release.Name }}
148    heritage: {{ .Release.Service }}
149
150 Running Velero Example (Backup and Restoration with Logs)
151 ---------------------------------------------------------
152
153 1) Install SO component
154 ~~~~~~~~~~~~~~~~~~~~~~~
155
156 .. note::
157
158    This is an optional step, if you have already installed SO or all other components of ONAP then you can skip this step.
159
160 Below is the example of installing SO component using helm
161
162 .. code-block:: bash
163
164   helm install so -n bkup --namespace test3
165
166   NAME:   bkup
167
168   LAST DEPLOYED: Fri Jul 20 06:59:09 2018
169
170   NAMESPACE: test3
171
172   STATUS: DEPLOYED
173
174   RESOURCES:
175
176   ==> v1/Pod(related)
177
178   NAME                         READY  STATUS    RESTARTS  AGE
179
180   bkup-so-db-744fccd888-w67zk  0/1    Init:0/1  0         0s
181
182   bkup-so-7668c746c-vngk8      0/2    Init:0/1  0         0s
183
184   ==> v1/Secret
185
186   NAME        TYPE    DATA  AGE
187
188   bkup-so-db  Opaque  1     0s
189
190   ==> v1/ConfigMap
191
192   NAME                      DATA  AGE
193
194   confd-configmap           1     0s
195
196   so-configmap              5     0s
197
198   so-docker-file-configmap  1     0s
199
200   so-filebeat-configmap     1     0s
201
202   so-log-configmap          11    0s
203
204
205   ==> v1/PersistentVolume
206
207   NAME        CAPACITY  ACCESS MODES  RECLAIM POLICY  STATUS  CLAIM             STORAGECLASS  REASON  AGE
208
209   bkup-so-db  2Gi       RWX           Retain          Bound   test3/bkup-so-db  0s
210
211
212   ==> v1/PersistentVolumeClaim
213
214   NAME        STATUS  VOLUME      CAPACITY  ACCESS MODES  STORAGECLASS  AGE
215
216   bkup-so-db  Bound   bkup-so-db  2Gi       RWX           0s
217
218
219   ==> v1/Service
220
221   NAME   TYPE      CLUSTER-IP   EXTERNAL-IP  PORT(S)                                                                     AGE
222
223   so-db  NodePort  10.43.63.96  <none>       3306:30252/TCP                                                              0s
224
225   so     NodePort  10.43.59.93  <none>       8080:30223/TCP,3904:30225/TCP,3905:30224/TCP,9990:30222/TCP,8787:30250/TCP  0s
226
227
228   ==> v1beta1/Deployment
229
230   NAME        DESIRED  CURRENT  UP-TO-DATE  AVAILABLE  AGE
231
232   bkup-so-db  1        1        1           0          0s
233
234   bkup-so     1        1        1           0          0s
235
236
237 .. note::
238
239   Get the application URL by running these commands
240
241   .. code-block:: bash
242
243     export NODE_PORT=$(kubectl get --namespace test3 -o jsonpath="{.spec.ports[0].nodePort}" services so)
244
245     export NODE_IP=$(kubectl get nodes --namespace test3 -o jsonpath="{.items[0].status.addresses[0].address}")
246
247     echo http://$NODE_IP:$NODE_PORT
248
249 2) Checking status of pod
250 ~~~~~~~~~~~~~~~~~~~~~~~~~
251
252 .. code-block:: bash
253
254    kubectl get pods --all-namespaces | grep -i so
255
256    NAMESPACE       NAME                                    READY     STATUS             RESTARTS   AGE
257
258    test3           bkup-so-7668c746c-vngk8                 2/2       Running            0          8m
259
260    test3           bkup-so-db-744fccd888-w67zk             1/1       Running            0          8m
261
262
263 3) Creating backup of deployment
264 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
265
266 Here I am using selector label as release name
267
268 .. code-block:: bash
269
270    ./velero backup create so-backup --selector release=bkup
271
272    Backup request "so-backup" submitted successfully.
273
274    Run `velero backup describe so-backup` for more details.
275
276
277 4) Checking backup logs
278 ~~~~~~~~~~~~~~~~~~~~~~~
279
280 .. code-block:: bash
281
282    ./velero backup describe so-backup
283
284    Name:         so-backup
285
286    Namespace:    velero
287
288    Labels:       <none>
289
290    Annotations:  <none>
291
292    Phase:  Completed
293
294
295    Namespaces:
296
297       Included:  *
298
299       Excluded:  <none>
300
301
302    Resources:
303
304       Included:        *
305
306       Excluded:        <none>
307
308       Cluster-scoped:  auto
309
310
311    Label selector:  release=bkup
312
313
314    Snapshot PVs:  auto
315
316
317    TTL:  720h0m0s
318
319
320    Hooks:  <none>
321
322
323    Backup Format Version:  1
324
325    Started:    2018-07-20 07:09:51 +0000 UTC
326
327    Completed:  2018-07-20 07:09:53 +0000 UTC
328
329    Expiration:  2018-08-19 07:09:51 +0000 UTC
330
331    Validation errors:  <none>
332
333    Persistent Volumes: <none included>
334
335 5) Simulating a disaster
336 ~~~~~~~~~~~~~~~~~~~~~~~~
337
338 .. code-block:: bash
339
340    helm delete --purge bkup
341
342    release "bkup" deleted
343
344 6)Restoring the kubernetes resources using velero
345 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
346
347 .. code-block:: bash
348
349    ./velero restore create --from-backup so-backup
350
351     Restore request "so-backup-20180720071236" submitted successfully.
352
353     Run `velero restore describe so-backup-20180720071236` for more details.
354
355
356 7) Checking restoration logs
357 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
358
359 .. code-block:: bash
360
361   ./velero restore describe so-backup-20180720071236
362
363   Name:         so-backup-20180720071236
364
365   Namespace:    velero
366
367   Labels:       <none>
368
369   Annotations:  <none>
370
371
372   Backup:  so-backup
373
374   Namespaces:
375
376     Included:  *
377
378     Excluded:  <none>
379
380
381   Resources:
382
383     Included:        *
384
385     Excluded:        nodes, events, events.events.k8s.io, backups.ark.heptio.com, restores.ark.heptio.com
386
387     Cluster-scoped:  auto
388
389
390   Namespace mappings:  <none>
391
392   Label selector:  <none>
393
394
395   Restore PVs:  auto
396
397   Phase:  Completed
398
399   Validation errors:  <none>
400
401   Warnings:  <none>
402
403   Errors:    <none>
404
405
406 8)Check backup files
407 ~~~~~~~~~~~~~~~~~~~~
408
409 As we are using Minio which is local storage with aws s3 capabilities. Thus our all the backup files are being stored in locally in Minio Pod. Let's see where the backup files are being genreted.
410
411 .. code-block:: bash
412
413    kubectl get pod -n velero
414    NAME                      READY   STATUS      RESTARTS   AGE
415    minio-d9c56ff5-cg8zp      1/1     Running     0          4d5h
416    minio-setup-ph8pk         0/1     Completed   0          4d5h
417    velero-74cdf64d76-t8wfs   1/1     Running     0          4d5h
418
419 .. code-block:: bash
420
421    kubectl exec -it -n velero minio-d9c56ff5-cg8zp  ls storage/velero/backups/
422    so-backup
423    aarna@anod-master:~$
424
425    kubectl exec -it -n velero minio-d9c56ff5-cg8zp  ls storage/velero/backups/so-backup
426    so-backup-csi-volumesnapshotcontents.json.gz
427    so-backup-csi-volumesnapshots.json.gz
428    so-backup-logs.gz
429    so-backup-podvolumebackups.json.gz
430    so-backup-resource-list.json.gz
431    so-backup-volumesnapshots.json.gz
432    so-backup.tar.gz
433    velero-backup.json
434
435
436 9) Restore run
437 ~~~~~~~~~~~~~~
438
439 .. code-block:: bash
440
441    ./velero  restore get
442
443     NAME                          BACKUP         STATUS      WARNINGS   ERRORS    CREATED                         SELECTOR
444
445     so-backup-20180720071236      so-backup      Completed   0          0         2018-07-20 07:12:36 +0000 UTC   <none>
446
447
448 10) Check the pod status
449 ~~~~~~~~~~~~~~~~~~~~~~~~
450
451 .. code-block:: bash
452
453    kubectl get pods --all-namespaces | grep -i so
454
455    NAMESPACE       NAME                                    READY     STATUS             RESTARTS   AGE
456
457    test3           bkup-so-7668c746c-vngk8                 2/2       Running            0          8m
458
459    test3           bkup-so-db-744fccd888-w67zk             1/1       Running            0          8m
460
461
462
463 Another Example with DB and PV Backup
464 -------------------------------------
465
466 APPC component backup and restoration
467 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
468
469 .. code-block:: bash
470
471    kubectl get pods --all-namespaces | grep -i appc
472    onap bk-appc-0 1/2 Running 0 1m
473    onap bk-appc-cdt-7cd6f6d674-5thwj 1/1 Running 0 1m
474    onap bk-appc-db-0 2/2 Running 0 1m
475    onap bk-appc-dgbuilder-59895d4d69-7rp9q 1/1 Running 0 1m
476
477
478 Creating dummy entry in db
479 ~~~~~~~~~~~~~~~~~~~~~~~~~~
480
481 .. code-block:: bash
482
483    kubectl exec -it -n default bk-appc-db-0 bash
484    Defaulting container name to appc-db.
485    Use 'kubectl describe pod/bk-appc-db-0 -n onap' to see all of the containers in this pod.
486    root@bk-appc-db-0:/#
487    root@bk-appc-db-0:/#
488    root@bk-appc-db-0:/#
489    root@bk-appc-db-0:/# mysql -u root -p
490    Enter password:
491    Welcome to the MySQL monitor. Commands end with ; or \g.
492    Your MySQL connection id is 42
493    Server version: 5.7.23-log MySQL Community Server (GPL)
494
495    Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
496
497    Oracle is a registered trademark of Oracle Corporation and/or its
498    affiliates. Other names may be trademarks of their respective
499    owners.
500
501    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
502
503    mysql>
504    mysql>
505    mysql>
506    mysql> connect mysql
507    Reading table information for completion of table and column names
508    You can turn off this feature to get a quicker startup with -A
509
510    Connection id: 44
511    Current database: mysql
512
513    mysql>
514    mysql>
515    mysql> select * from servers;
516    Empty set (0.00 sec)
517
518    mysql> desc servers;
519    +-------------+----------+------+-----+---------+-------+
520    | Field | Type | Null | Key | Default | Extra |
521    +-------------+----------+------+-----+---------+-------+
522    | Server_name | char(64) | NO | PRI | | |
523    | Host | char(64) | NO | | | |
524    | Db | char(64) | NO | | | |
525    | Username | char(64) | NO | | | |
526    | Password | char(64) | NO | | | |
527    | Port | int(4) | NO | | 0 | |
528    | Socket | char(64) | NO | | | |
529    | Wrapper | char(64) | NO | | | |
530    | Owner | char(64) | NO | | | |
531    +-------------+----------+------+-----+---------+-------+
532    9 rows in set (0.00 sec)
533
534    mysql> insert into servers values ("test","ab","sql","user","pwd",1234,"test","wrp","vaib");
535    Query OK, 1 row affected (0.03 sec)
536
537    mysql>
538    mysql>
539    mysql>
540    mysql> select * from servers;
541    +-------------+------+-----+----------+----------+------+--------+---------+-------+
542    | Server_name | Host | Db | Username | Password | Port | Socket | Wrapper | Owner |
543    +-------------+------+-----+----------+----------+------+--------+---------+-------+
544    | abc | ab | sql | user | pwd | 1234 | test | wrp | vaib |
545    +-------------+------+-----+----------+----------+------+--------+---------+-------+
546    1 row in set (0.00 sec)
547
548    mysql>
549    mysql>
550    mysql> exit
551    Bye
552    root@bk-appc-db-0:/#
553    root@bk-appc-db-0:/#
554    root@bk-appc-db-0:/# exit
555    command terminated with exit code 127
556    kubectl get pods --all-namespaces | grep -i appc
557    onap bk-appc-0 1/2 Running 0 5m
558    onap bk-appc-cdt-7cd6f6d674-5thwj 1/1 Running 0 5m
559    onap bk-appc-db-0 2/2 Running 0 5m
560    onap bk-appc-dgbuilder-59895d4d69-7rp9q 1/1 Running 0 5m
561
562
563 Creating dummy file in APPC PV
564 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
565 .. code-block:: bash
566
567    kubectl exec -it -n onap bk-appc-0 bash
568    Defaulting container name to appc.
569    Use 'kubectl describe pod/bk-appc-0 -n onap' to see all of the containers in this pod.
570    root@bk-appc-0:/#
571    root@bk-appc-0:/#
572    root@bk-appc-0:/#
573    root@bk-appc-0:/# cd /opt/opendaylight/current/daexim/
574    root@bk-appc-0:/opt/opendaylight/current/daexim# ls
575    root@bk-appc-0:/opt/opendaylight/current/daexim# ls
576    root@bk-appc-0:/opt/opendaylight/current/daexim#
577    root@bk-appc-0:/opt/opendaylight/current/daexim#
578    root@bk-appc-0:/opt/opendaylight/current/daexim# touch abc.txt
579    root@bk-appc-0:/opt/opendaylight/current/daexim# ls
580    abc.txt
581    root@bk-appc-0:/opt/opendaylight/current/daexim# exit
582    exit
583    root@rancher:~/oom/kubernetes# kubectl get pods --all-namespaces | grep -i appc
584    onap bk-appc-0 1/2 Running 0 6m
585    onap bk-appc-cdt-7cd6f6d674-5thwj 1/1 Running 0 6m
586    onap bk-appc-db-0 2/2 Running 0 6m
587    onap bk-appc-dgbuilder-59895d4d69-7rp9q 1/1 Running 0 6m
588
589
590 Creating backup using velero
591 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
592
593 .. code-block:: bash
594
595    ./velero backup create appc-bkup1 --selector release=bk
596     Backup request "appc-bkup1" submitted successfully.
597     Run `velero backup describe appc-bkup1` for more details.
598
599     ./velero backup describe appc-bkup1
600     Name: appc-bkup1
601     Namespace: velero
602     Labels: <none>
603     Annotations: <none>
604
605     Phase: Completed
606
607     Namespaces:
608     Included: *
609     Excluded: <none>
610
611     Resources:
612     Included: *
613     Excluded: <none>
614     Cluster-scoped: auto
615
616     Label selector: release=bk
617
618     Snapshot PVs: auto
619
620     TTL: 720h0m0s
621
622     Hooks: <none>
623
624     Backup Format Version: 1
625
626     Started: 2018-08-27 05:07:45 +0000 UTC
627     Completed: 2018-08-27 05:07:47 +0000 UTC
628
629     Expiration: 2018-09-26 05:07:44 +0000 UTC
630
631     Validation errors: <none>
632
633     Persistent Volumes: <none included>
634
635
636 Simulating disaster by deleting APPC
637 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
638
639 .. code-block:: bash
640
641    helm delete --purge bk
642    release "bk" deleted
643
644
645 Restoration using velero
646 ~~~~~~~~~~~~~~~~~~~~~~~~
647
648 .. code-block:: bash
649
650    ./velero restore create --from-backup appc-bkup1
651    Restore request "appc-bkup1-20180827052651" submitted successfully.
652    Run `velero restore describe appc-bkup1-20180827052651` for more details.
653
654 Restoration details
655 ~~~~~~~~~~~~~~~~~~~
656
657 Check the Restoration details immediately after restoration. Restoration process is in InProgress Phase. Please check the Phase.
658
659 .. code-block:: bash
660
661    ./velero restore describe appc-bkup1-20180827052651
662    Name: appc-bkup1-20180827052651
663    Namespace: velero
664    Labels: <none>
665    Annotations: <none>
666
667    Backup: appc-bkup1
668
669    Namespaces:
670    Included: *
671    Excluded: <none>
672
673    Resources:
674    Included: *
675    Excluded: nodes, events, events.events.k8s.io, backups.ark.heptio.com, restores.ark.heptio.com
676    Cluster-scoped: auto
677
678    Namespace mappings: <none>
679
680    Label selector: <none>
681
682    Restore PVs: auto
683
684    Phase: InProgress
685
686    Validation errors: <none>
687
688    Warnings: <none>
689    Errors: <none>
690    ./velero restore describe appc-bkup1-20180827052651
691    Name: appc-bkup1-20180827052651
692    Namespace: velero
693    Labels: <none>
694    Annotations: <none>
695
696    Backup: appc-bkup1
697
698    Namespaces:
699    Included: *
700    Excluded: <none>
701
702    Resources:
703    Included: *
704    Excluded: nodes, events, events.events.k8s.io, backups.ark.heptio.com, restores.ark.heptio.com
705    Cluster-scoped: auto
706
707    Namespace mappings: <none>
708
709    Label selector: <none>
710
711    Restore PVs: auto
712
713    Phase: Completed
714
715    Validation errors: <none>
716
717
718    Warnings:   <error getting warnings: Get "http://minio.velero.svc:9000/velero/restores/dev-appc-1-20201108164330/restore-dev-appc-1-20201108164330-results.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minio%2F20201108%2Fminio%2Fs3%2Faws4_request&X-Amz-Date=20201108T183923Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Signature=847bdbb0a76718220c40767c4837aa999a4da9ff1344e9b42d3c93f7009e6898": dial tcp: lookup minio.velero.svc on 127.0.0.53:53: no such host>
719
720    Errors:  <error getting errors: Get "http://minio.velero.svc:9000/velero/restores/dev-appc-1-20201108164330/restore-dev-appc-1-20201108164330-results.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minio%2F20201108%2Fminio%2Fs3%2Faws4_request&X-Amz-Date=20201108T183923Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Signature=847bdbb0a76718220c40767c4837aa999a4da9ff1344e9b42d3c93f7009e6898": dial tcp: lookup minio.velero.svc on 127.0.0.53:53: no such host>
721
722 This process might take some time to complete. When you check the Restoration details again after some time then the phase will show as Completed as shown below.
723
724 .. code-block:: bash
725
726    ./velero restore describe appc-bkup1-20180827052651
727     Name: appc-bkup1-20180827052651
728     Namespace: velero
729     Labels: <none>
730     Annotations: <none>
731
732     Backup: appc-bkup1
733
734     Namespaces:
735     Included: *
736     Excluded: <none>
737
738     Resources:
739     Included: *
740     Excluded: nodes, events, events.events.k8s.io, backups.ark.heptio.com, restores.ark.heptio.com
741     Cluster-scoped: auto
742
743     Namespace mappings: <none>
744
745     Label selector: <none>
746
747     Restore PVs: auto
748
749     Phase: Completed
750
751     Validation errors: <none>
752
753     Warnings:   <error getting warnings: Get "http://minio.velero.svc:9000/velero/restores/dev-appc-1-20201108164330/restore-dev-appc-1-20201108164330-results.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minio%2F20201108%2Fminio%2Fs3%2Faws4_request&X-Amz-Date=20201108T183923Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Signature=847bdbb0a76718220c40767c4837aa999a4da9ff1344e9b42d3c93f7009e6898": dial tcp: lookup minio.velero.svc on 127.0.0.53:53: no such host>
754
755     Errors:  <error getting errors: Get "http://minio.velero.svc:9000/velero/restores/dev-appc-1-20201108164330/restore-dev-appc-1-20201108164330-results.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minio%2F20201108%2Fminio%2Fs3%2Faws4_request&X-Amz-Date=20201108T183923Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Signature=847bdbb0a76718220c40767c4837aa999a4da9ff1344e9b42d3c93f7009e6898": dial tcp: lookup minio.velero.svc on 127.0.0.53:53: no such host>
756
757
758 List of restores
759 ~~~~~~~~~~~~~~~~
760
761 .. code-block:: bash
762
763     ark restore get
764     NAME BACKUP STATUS WARNINGS ERRORS CREATED SELECTOR
765     appc-bkup-20180827045955 appc-bkup Completed 2 0 2018-08-27 04:59:52 +0000 UTC <none>
766     appc-bkup1-20180827052651 appc-bkup1 Completed 5 0 2018-08-27 05:26:48 +0000 UTC <none>
767     vid-bkp-20180824053001 vid-bkp Completed 149 2 2018-08-24 05:29:59 +0000 UTC <none>
768
769 Completed status means the Restoration is done successfully.
770
771 Restoration successful
772 ~~~~~~~~~~~~~~~~~~~~~~
773
774 .. code-block:: bash
775
776    kubectl get pods --all-namespaces | grep -i appc
777    onap bk-appc-0 1/2 Running 0 26m
778    onap bk-appc-cdt-7cd6f6d674-5thwj 1/1 Running 0 26m
779    onap bk-appc-db-0 2/2 Running 0 26m
780    onap bk-appc-dgbuilder-59895d4d69-7rp9q 1/1 Running 0 26m
781    kubectl exec -it -n onap bk-appc-db-0 bash
782    Defaulting container name to appc-db.
783    Use 'kubectl describe pod/bk-appc-db-0 -n onap' to see all of the containers in this pod.
784    root@bk-appc-db-0:/#
785    root@bk-appc-db-0:/#
786    root@bk-appc-db-0:/#
787
788
789 Restoration of db successful
790 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
791
792 .. code-block:: bash
793
794    root@bk-appc-db-0:/# mysql -u root
795    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
796    root@bk-appc-db-0:/# mysql -u root -p
797    Enter password:
798    Welcome to the MySQL monitor. Commands end with ; or \g.
799    Your MySQL connection id is 335
800    Server version: 5.7.23-log MySQL Community Server (GPL)
801
802    Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
803
804    Oracle is a registered trademark of Oracle Corporation and/or its
805    affiliates. Other names may be trademarks of their respective
806    owners.
807
808    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
809
810    mysql> connect mysql
811    Reading table information for completion of table and column names
812    You can turn off this feature to get a quicker startup with -A
813
814    Connection id: 337
815    Current database: mysql
816
817    mysql> select * from servers;
818    +-------------+------+-----+----------+----------+------+--------+---------+-------+
819    | Server_name | Host | Db | Username | Password | Port | Socket | Wrapper | Owner |
820    +-------------+------+-----+----------+----------+------+--------+---------+-------+
821    | abc | ab | sql | user | pwd | 1234 | test | wrp | vaib |
822    +-------------+------+-----+----------+----------+------+--------+---------+-------+
823    1 row in set (0.00 sec)
824
825    mysql> quit
826    Bye
827    root@bk-appc-db-0:/# exit
828    exit
829
830
831 Restoration of PV successful
832 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
833
834 .. code-block:: bash
835
836    kubectl get pods --all-namespaces | grep -i appc
837    onap bk-appc-0 1/2 Running 0 27m
838    onap bk-appc-cdt-7cd6f6d674-5thwj 1/1 Running 0 27m
839    onap bk-appc-db-0 2/2 Running 0 27m
840    onap bk-appc-dgbuilder-59895d4d69-7rp9q 1/1 Running 0 27m
841    kubectl exec -it -n onap bk-appc-0 bash
842    Defaulting container name to appc.
843    Use 'kubectl describe pod/bk-appc-0 -n onap' to see all of the containers in this pod.
844    root@bk-appc-0:/#
845    root@bk-appc-0:/#
846    root@bk-appc-0:/#
847    root@bk-appc-0:/#
848    root@bk-appc-0:/# cd /opt/opendaylight/current/daexim/
849    root@bk-appc-0:/opt/opendaylight/current/daexim# ls
850    abc.txt
851    root@bk-appc-0:/opt/opendaylight/current/daexim#
852    root@bk-appc-0:/opt/opendaylight/current/daexim#
853    root@bk-appc-0:/opt/opendaylight/current/daexim# exit
854    exit
855
856
857 Use Cases
858 ---------
859
860 Disaster recovery
861 ~~~~~~~~~~~~~~~~~
862
863 Using Schedules and Restore-Only Mode
864
865 If you periodically back up your cluster resources, you are able to return to a previous state in case of some unexpected mishap, such as a service outage.
866
867 Cluster migration
868 ~~~~~~~~~~~~~~~~~
869
870 Using Backups and Restores
871
872 Velero can help you port your resources from one cluster to another, as long as you point each Velero Config to the same cloud object storage.
873
874 References:
875 https://github.com/vmware-tanzu/velero