"카타코더 k8s - Backup and Restore with Heptio Ark"의 두 판 사이의 차이

 
406번째 줄: 406번째 줄:
</source>
</source>
<source lang='console'>
<source lang='console'>
aster $ kubectl get deployments --namespace=nginx-example
master:~$ kubectl get deployments --namespace=nginx-example
No resources found.
No resources found.
</source>
</source>

2019년 3월 24일 (일) 04:34 기준 최신판

1 개요[ | ]

카타코더 Kubernetes - Backup and Restore with Heptio Ark
카타코더 Kubernetes - Heptio Ark
카타코더 Kubernetes
# 🔗 제목
카타코더 Kubernetes/2 e
🡵 카타코더 k8s - Use Kubernetes To Manage Secrets And Passwords
🡵 카타코더 k8s - Deploy Docker Compose Files with Kompose
🡵 카타코더 k8s - Deploying from source onto Kubernetes
🡵 카타코더 k8s - Backup and Restore with Heptio Ark
🡵 카타코더 k8s - Helm Package Manager
🡵 카타코더 k8s - Installing Weave Scope on Kubernetes
🡵 카타코더 k8s - Getting Started with Kubeless

2 Set Up our Environment[ | ]

master:~$ git clone https://github.com/heptio/velero
Cloning into 'velero'...
remote: Enumerating objects: 22, done.
remote: Counting objects: 100% (22/22), done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 20181 (delta 4), reused 16 (delta 4), pack-reused 20159
Receiving objects: 100% (20181/20181), 13.37 MiB | 10.24 MiB/s, done.
Resolving deltas: 100% (12327/12327), done.
Checking connectivity... done.
master:~$ cat velero/examples/common/00-prereqs.yaml
# Copyright 2017 the Velero contributors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: backups.velero.io
  labels:
    component: velero
spec:
  group: velero.io
  version: v1
  scope: Namespaced
  names:
    plural: backups
    kind: Backup

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: schedules.velero.io
  labels:
    component: velero
spec:
  group: velero.io
  version: v1
  scope: Namespaced
  names:
    plural: schedules
    kind: Schedule

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: restores.velero.io
  labels:
    component: velero
spec:
  group: velero.io
  version: v1
  scope: Namespaced
  names:
    plural: restores
    kind: Restore

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: downloadrequests.velero.io
  labels:
    component: velero
spec:
  group: velero.io
  version: v1
  scope: Namespaced
  names:
    plural: downloadrequests
    kind: DownloadRequest

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: deletebackuprequests.velero.io
  labels:
    component: velero
spec:
  group: velero.io
  version: v1
  scope: Namespaced
  names:
    plural: deletebackuprequests
    kind: DeleteBackupRequest

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: podvolumebackups.velero.io
  labels:
    component: velero
spec:
  group: velero.io
  version: v1
  scope: Namespaced
  names:
    plural: podvolumebackups
    kind: PodVolumeBackup

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: podvolumerestores.velero.io
  labels:
    component: velero
spec:
  group: velero.io
  version: v1
  scope: Namespaced
  names:
    plural: podvolumerestores
    kind: PodVolumeRestore

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: resticrepositories.velero.io
  labels:
    component: velero
spec:
  group: velero.io
  version: v1
  scope: Namespaced
  names:
    plural: resticrepositories
    kind: ResticRepository

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: backupstoragelocations.velero.io
  labels:
    component: velero
spec:
  group: velero.io
  version: v1
  scope: Namespaced
  names:
    plural: backupstoragelocations
    kind: BackupStorageLocation

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: volumesnapshotlocations.velero.io
  labels:
    component: velero
spec:
  group: velero.io
  version: v1
  scope: Namespaced
  names:
    plural: volumesnapshotlocations
    kind: VolumeSnapshotLocation

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  name: serverstatusrequests.velero.io
  labels:
    component: velero
spec:
  group: velero.io
  version: v1
  scope: Namespaced
  names:
    plural: serverstatusrequests
    kind: ServerStatusRequest
---
apiVersion: v1
kind: Namespace
metadata:
  name: velero

---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: velero
  namespace: velero
  labels:
    component: velero

---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: velero
  labels:
    component: velero
subjects:
  - kind: ServiceAccount
    namespace: velero
    name: velero
roleRef:
  kind: ClusterRole
  name: cluster-admin
  apiGroup: rbac.authorization.k8s.io
master:~$ cd velero
master:~/velero$ kubectl apply -f examples/common/00-prereqs.yaml
customresourcedefinition.apiextensions.k8s.io/backups.velero.io created
customresourcedefinition.apiextensions.k8s.io/schedules.velero.io created
customresourcedefinition.apiextensions.k8s.io/restores.velero.io created
customresourcedefinition.apiextensions.k8s.io/downloadrequests.velero.io created
customresourcedefinition.apiextensions.k8s.io/deletebackuprequests.velero.io created
customresourcedefinition.apiextensions.k8s.io/podvolumebackups.velero.io created
customresourcedefinition.apiextensions.k8s.io/podvolumerestores.velero.io created
customresourcedefinition.apiextensions.k8s.io/resticrepositories.velero.io created
customresourcedefinition.apiextensions.k8s.io/backupstoragelocations.velero.io created
customresourcedefinition.apiextensions.k8s.io/volumesnapshotlocations.velero.io created
customresourcedefinition.apiextensions.k8s.io/serverstatusrequests.velero.io created
namespace/velero created
serviceaccount/velero created
clusterrolebinding.rbac.authorization.k8s.io/velero created
master:~/velero$ ll examples/minio/
total 24
drwxr-xr-x 2 root root 4096 Mar 23 19:26 ./
drwxr-xr-x 9 root root 4096 Mar 23 19:26 ../
-rw-r--r-- 1 root root 2715 Mar 23 19:26 00-minio-deployment.yaml
-rw-r--r-- 1 root root 1049 Mar 23 19:26 05-backupstoragelocation.yaml
-rw-r--r-- 1 root root 1816 Mar 23 19:26 20-deployment.yaml
-rw-r--r-- 1 root root 2015 Mar 23 19:26 30-restic-daemonset.yaml
master:~/velero$ kubectl apply -f examples/minio/
deployment.apps/minio created
service/minio created
secret/cloud-credentials created
job.batch/minio-setup created
backupstoragelocation.velero.io/default created
deployment.apps/velero created
daemonset.apps/restic created
master:~/velero$ cat examples/nginx-app/base.yaml
# Copyright 2017 the Velero contributors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: v1
kind: Namespace
metadata:
  name: nginx-example
  labels:
    app: nginx

---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
  name: nginx-deployment
  namespace: nginx-example
spec:
  replicas: 2
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx:1.7.9
        name: nginx
        ports:
        - containerPort: 80

---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: nginx
  name: my-nginx
  namespace: nginx-example
spec:
  ports:
  - port: 80
    targetPort: 80
  selector:
    app: nginx
  type: LoadBalancer
master:~/velero$ kubectl apply -f examples/nginx-app/base.yaml
namespace/nginx-example created
deployment.apps/nginx-deployment created
service/my-nginx created
master:~/velero$ cd
master:~$ kubectl get deployments --all-namespaces --show-labels
NAMESPACE       NAME               DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE       LABELS
kube-system     coredns            2         2         2            2           5m        k8s-app=kube-dns
nginx-example   nginx-deployment   2         2         2            2           2m        app=nginx
velero          minio              1         1         1            1           2m        component=minio
velero          velero             1         1         1            1           2m        component=velero

3 Back Up Our Resources[ | ]

master:~$ curl -sLO https://github.com/heptio/velero/releases/download/v0.11.0/velero-v0.11.0-linux-amd64.tar.gz
master:~$ tar -C /usr/local/bin -xzvf velero-v0.11.0-linux-amd64.tar.gz
LICENSE
config/README.md
config/aws
config/aws/05-backupstoragelocation.yaml
config/aws/06-volumesnapshotlocation.yaml
config/aws/10-deployment-kube2iam.yaml
config/aws/10-deployment.yaml
config/aws/20-restic-daemonset.yaml
config/azure
config/azure/00-deployment.yaml
config/azure/05-backupstoragelocation.yaml
config/azure/06-volumesnapshotlocation.yaml
config/azure/20-restic-daemonset.yaml
config/common
config/common/00-prereqs.yaml
config/common/README.md
config/gcp
config/gcp/05-backupstoragelocation.yaml
config/gcp/06-volumesnapshotlocation.yaml
config/gcp/10-deployment.yaml
config/gcp/20-restic-daemonset.yaml
config/ibm
config/ibm/05-backupstoragelocation.yaml
config/ibm/10-deployment.yaml
config/minio
config/minio/00-minio-deployment.yaml
config/minio/05-backupstoragelocation.yaml
config/minio/20-deployment.yaml
config/minio/30-restic-daemonset.yaml
config/nginx-app
config/nginx-app/README.md
config/nginx-app/base.yaml
config/nginx-app/with-pv.yaml
velero
master:~$ velero version
Client:
        Version: v0.11.0
        Git commit: ab2fc65c02ecdcb9bb1690e3afe67a3b3196aebc
Server:
        Version: v0.11.0
master:~$ velero backup create nginx-backup --selector app=nginx
Backup request "nginx-backup" submitted successfully.
Run `velero backup describe nginx-backup` or `velero backup logs nginx-backup` for more details.
master:~$ velero backup get
NAME           STATUS      CREATED                         EXPIRES   STORAGE LOCATION   SELECTOR
nginx-backup   Completed   2019-03-23 19:32:48 +0000 UTC   29d       default            app=nginx
master:~$ kubectl delete namespace nginx-example
namespace "nginx-example" deleted
master:~$ kubectl get deployments --namespace=nginx-example
No resources found.
master:~$ kubectl get services --namespace=nginx-example
No resources found.
master:~$ kubectl get namespace/nginx-example
No resources found.
Error from server (NotFound): namespaces "nginx-example" not found

4 Restore Our Resources[ | ]

master:~$ velero restore create --from-backup nginx-backup
Restore request "nginx-backup-20190323192249" submitted successfully.
Run `velero restore describe nginx-backup-20190323192249` or `velero restore logs nginx-backup-20190323192249` for more details.
master:~$ velero restore get
NAME                          BACKUP         STATUS       WARNINGS   ERRORS    CREATED                         SELECTOR
nginx-backup-20190323192249   nginx-backup   InProgress   0          0         2019-03-23 19:22:49 +0000 UTC   <none>
master:~$ velero restore get
NAME                          BACKUP         STATUS      WARNINGS   ERRORS    CREATED                         SELECTOR
nginx-backup-20190323192249   nginx-backup   Completed   0          0         2019-03-23 19:22:49 +0000 UTC   <none>
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}