Data Management in Kubernetes Using Kanister T om Manville | April 25th, 2018
2
3
4
yes* 5
Database Operations in Kubernetes kanister.io 6
Agenda • Background • DB in a container • DB in Kubernetes • Kanister • Use Cases • Components • Walkthrough • Demo 7
whoami 8
DB in a Container $ docker run -d \ percona/percona-server:5.7 9
DB in a Container $ docker run -d \ – v /local/datadir:/var/lib/mysql \ percona/percona-server:5.7 10
Cloud Native • Container Package • Dynamically Managed • Micro-Services Oriented 11
12
13
14
Requirements https://kubernetes.io/ https://www.helm.sh/ https://github.com/kubernetes/kubernetes https://github.com/kubernetes/helm 15
DB in Kubernetes $ helm install stable/percona 16
Application Centric Use Cases • Portability between cloud providers • Testing on real data • Filtering • Masking • Backup/Recover • Distributed point-in-time consistency • Incremental backups 17
Install Kanister $ helm install stable/kanister-operator $ helm repo add kanister http://charts.kanister.io 18
Kanister DB Charts $ helm install kanister/kanister-mysql \ --set kanister.s3_bucket="mysql-backup-bucket" \ --set kanister.s3_api_key="${AWS_ACCESS_KEY_ID}" \ --set kanister.s3_api_secret="${AWS_SECRET_ACCESS_KEY}" \ 19
Kanister Components API Objects Controller • • Watches for new API objects ActionSet • • Launches actions Blueprints • • Profiles (coming soon!) Creates events / logs status • Locations • Credentials 20
Controller Database Blueprint 21
CLI Controller Database Blueprint 22
CLI Controller ActionSet Database Blueprint 23
CLI Controller ActionSet Database Blueprint 24
CLI Controller ActionSet Database Blueprint 25
CLI Controller ActionSet Database Action Blueprint 26
CLI Controller ActionSet Database Action Blueprint 27
CLI Controller ActionSet Database Action Blueprint 28
Demos Click to add text
An Abridged ActionSet spec: actions: - name: backup blueprint: mysql-blueprint object: kind: Deployment name: mysql-sakila namespace: video-store-app status: ... 30
Blueprint: Backup backup: phases: - func: KubeExec args: - "{{ .Deployment.Namespace }}" - "{{ index .Deployment.Pods 0 }}" - kanister-sidecar - bash - -c - | s3_path="s3://${S3_BUCKET}/{{ .ArtifactsOut.mysqlCloudDump.path }}" s3_cmd=(aws "${S3_VERIFY_SSL}" s3 cp - "${s3_path}") mysqldump --password="${MYSQL_ROOT_PASSWORD}" | gzip - | ${s3_cmd[@]} 31
Blueprint: Restore restore : phases: - func: KubeExec args: - "{{ .Deployment.Namespace }}" - "{{ index .Deployment.Pods 0 }}" - kanister-sidecar - bash - -c - | s3_path="s3://${S3_BUCKET}/{{ .ArtifactsIn.mysqlCloudDump.path }}" s3_cmd=(aws "${S3_VERIFY_SSL}" s3 cp "${s3_path}" - ) ${s3_cmd[@]} | gunzip -c - | mysql --password="${MYSQL_ROOT_PWD}" 32
Chaining ActionSets $ kanctl perform restore --from backup-mysql-04-23 33
Database Operations in Kubernetes kanister.io 34
Try Kanister Today! • Site: https://kanister.io/ • Github: https://github.com/kanisterio/kanister • Docs: https://docs.kanister.io/ • Slack: https://kasten.typeform.com/to/QBcw8T 35
Backup Slides Click to add text
37
38
39
Common Databases 40
41
42
Recommend
More recommend