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