Using CheatSheets To Apply Best Practices

Cheatsheet: Kubernetes Backup

Cheatsheet: Kubernetes Backup

1.1 Backup Scenarios

Name Summary
Backup and restore at infra level Data and configuration of SDN, SDS and virtualization
Backup and restore at db level Full etcd backup and restore
Backup and restore per label k8s resource matching label will be copied, including PV and PVC.
Backup and restore namespace level k8s resource for a given namespace. Not including global resource

1.2 heptio ark

Name Summary
ark Kubernetes backup and recovery. Initiated by heptio
heptio backup volume Backup is done at PV layer(e.g, snapshot EBS block), instead of PVC(Posix filesystem).
Reference YouTube: 15 minutes with Heptio Ark, Link: How Ark Works
Reference Link: ark supported storage providers

ark-backup.png

1.3 heptio ark cli

Name Command
Create backup by labels ark backup create $BACKUP_NAME --selector app=nginx
Check backupset info ark backup describe $BACKUP_NAME
Restore from backupset ark restore create --from-backup $BACKUP_NAME
Check restore status ark restore get
Delete backupset ark backup delete $BACKUP_NAME

1.4 heptio ark CRD

Name Summary
backups.ark.heptio.com  
backupstoragelocations.ark.heptio.com  
deletebackuprequests.ark.heptio.com  
downloadrequests.ark.heptio.com  
podvolumebackups.ark.heptio.com  
podvolumerestores.ark.heptio.com  
resticrepositories.ark.heptio.com  
restores.ark.heptio.com  
schedules.ark.heptio.com  
volumesnapshotlocations.ark.heptio.com  

1.5 Sample output of ark backup

> ark backup describe nginx-backup
Name:         nginx-backup
Namespace:    heptio-ark
Labels:       <none>
Annotations:  <none>

Phase:  New

Namespaces:
  Included:  *
  Excluded:  <none>

Resources:
  Included:        *
  Excluded:        <none>
  Cluster-scoped:  auto

Label selector:  app=nginx

Storage Location:

Snapshot PVs:  auto

TTL:  720h0m0s

Hooks:  <none>

Backup Format Version:  0

Started:    <n/a>
Completed:  <n/a>

Expiration:  0001-01-01 00:00:00 +0000 UTC

Validation errors:  <none>

Persistent Volumes: <none included>

1.6 ark CLI Online Help

> ./ark --help
Heptio Ark is a tool for managing disaster recovery, specifically for Kubernetes
cluster resources. It provides a simple, configurable, and operationally robust
way to back up your application state and associated data.

If you're familiar with kubectl, Ark supports a similar model, allowing you to
execute commands such as 'ark get backup' and 'ark create schedule'. The same
operations can also be performed as 'ark backup get' and 'ark schedule create'.

Usage:
  ark [command]

Available Commands:
  backup            Work with backups
  backup-location   Work with backup storage locations
  bug               Report an Ark bug
  client            Ark client related commands
  completion        Output shell completion code for the specified shell (bash or zsh)
  create            Create ark resources
  delete            Delete ark resources
  describe          Describe ark resources
  get               Get ark resources
  help              Help about any command
  plugin            Work with plugins
  restic            Work with restic
  restore           Work with restores
  schedule          Work with schedules
  server            Run the ark server
  snapshot-location Work with snapshot locations
  version           Print the ark version and associated image

Flags:
      --alsologtostderr                  log to standard error as well as files
  -h, --help                             help for ark
      --kubeconfig string                Path to the kubeconfig file to use to talk to the Kubernetes apiserver. If unset, try the environment variable KUBECONFIG, as well as in-cluster configuration
      --kubecontext string               The context to use to talk to the Kubernetes apiserver. If unset defaults to whatever your current-context is (kubectl config current-context)
      --log_backtrace_at traceLocation   when logging hits line file:N, emit a stack trace (default :0)
      --log_dir string                   If non-empty, write log files in this directory
      --logtostderr                      log to standard error instead of files
  -n, --namespace string                 The namespace in which Ark should operate (default "heptio-ark")
      --stderrthreshold severity         logs at or above this threshold go to stderr (default 2)
  -v, --v Level                          log level for V logs
      --vmodule moduleSpec               comma-separated list of pattern=N settings for file-filtered logging

Use "ark [command] --help" for more information about a command.


Leave a Reply

Your email address will not be published. Required fields are marked *