using kubernetes, docker, and helm to deploy on … · “kubernetes is an open-source system for...

21
USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON-DEMAND POSTGRESQL STREAMING REPLICAS by Steve Hetzel

Upload: others

Post on 20-May-2020

15 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON-DEMAND POSTGRESQL STREAMING REPLICAS

by Steve Hetzel

Page 2: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

HELLO!I am Steve Hetzel

PostgreSQL and DevOps EnthusiastBased out of the Boulder, Colorado area

You can find me on LinkedIn: https://www.linkedin.com/in/stevehetzeldataengineer/

2

Page 3: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

Use-case: Disaster Recovery and Horizontal Scaling

3

▰ While the use of Containers and Kubernetes is growing at an astounding rate – most of the primary use-cases that we’ve seen are homogenous in nature (entire stacks deployed to k8s – all within the Cloud).

▰ Disaster Recovery/Business Continuity between multiple environments is an under-served need - cross-DC links between on-prem and cloud providers is an evolving proposition.

▰ Deploying Postgres via Containers/Kubernetes allows for automation, easy scalability, consistency, and a quick path to DR/BC.

Page 4: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

EXPLAIN ALL THE THINGSWhat are Containers? What is Kubernetes? What is Helm? What does the architecture look like?

4

Page 5: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

WHAT ARE CONTAINERS?

“A container image is a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings. Available for both Linux and Windows based apps, containerized software will always run the same, regardless of the environment.” - - Docker.com

Docker is one example of a Container format - others include rkt and OCI (Open Container Initiative).

5

Page 6: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

6

Container Workflow

Dockerfile

Docker Entrypoint

Script

Build DockerImage

PushContainer

Image Registry(Docker Hub, gcr.io, Quay,

etc)

Docker Client

Kubernetes (K8s) Cluster

Pull Image and Deploy Container

(via Helm)

Page 7: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

7Credit: docs.docker.com

Page 8: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

“Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.

It groups containers that make up an application into logical units (Pods) for easy management and discovery. Kubernetes builds upon 15 years of experience of running production workloads at Google, combined with best-of-breed ideas and practices from the community.” - - Kubernetes.io

WHAT IS KUBERNETES?

8

Page 9: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

Kubernetes is ancient Greek for Helmsman. Root of the word Governor/Cybernetics

Kubernetes is an open-source Container Orchestrator/Cluster Manager (written in Go) and is maintained by the Cloud Native Computing Foundation (CNCF). Some of the functionality Kubernetes provides:

▰ Declarative in nature▰ Places containers on nodes▰ Recovers automatically from failure▰ Basic monitoring, logging, health checking▰ Enables containers to find each other.

WHAT IS KUBERNETES?

9

Page 10: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

10

Kubernetes Workflow

Helm ChartDeploy K8s API

Server

Scheduled

Helm Client (calls kubectl)

Kubernetes (K8s) Cluster

1 -> Many Pods are scheduled on

1 -> Many K8s NodesKubernetes (K8s) Node

Kubernetes (K8s) Node

Kubernetes (K8s) Node

Pod

PV(Disk)

Page 11: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

11Credit: Kubernetes Project

Page 12: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

12Credit: Kubernetes Project

Page 13: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

13Credit: Kubernetes Project

All you really need to care about!

Page 14: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

Helm is an open-source package manager that helps you manage Kubernetes applications — Helm Charts define, install, and upgrade even the most complex Kubernetes application. They provide an atomic unit of deployment that can be version, upgraded, rolled-back, and deleted. Charts are easy to share and be tracked via source control.

WHAT IS HELM?

14

Page 15: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

15

Page 16: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

16

The Lego® analogy:

Individual Lego® bricks == The various parts/building blocks of Kubernetes (Containers, Services, PersistentVolumes, ConfigMaps, Secrets, etc.)

Pods == A fully-functioning Lego® mini-kit

Helm == Instructions (a template) for a building a mini-kit

Kubernetes == The entire Lego® set - everything working together as one/as designed.

Orchestration == A techincal/social construct - how your Lego® set plays nicely with your friends' Lego sets

Page 17: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

17

Kubernetes Functionality Used in this demo:

▰ ConfigMaps▰ Persistent Volumes/Persistent Volume Claims▰ Secrets▰ Services (NodePort)▰ Stateful Sets▰ Storage Classes

Page 18: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

Once everything is assembled - ship it!

18

Page 19: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

Postgres can be easily deployed, maintained/operated, upgraded, and scaled via Kubernetes. Literally anything you can do with Postgres via traditional infrastructure (bare metal, VM’s, etc) - can be done with Containers.

Containerized databases also have the added benefit of being portable and resource-scaled (CPU, Memory, etc). Containers have shown increased performance, lower overhead, and dramatically faster deployment times/elasticity versus VM’s.

SO WHAT DOES THIS MEAN FOR POSTGRES?

19

Page 20: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

Time for theDemo!

20

Page 21: USING KUBERNETES, DOCKER, AND HELM TO DEPLOY ON … · “Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications. It

21

THANKS!Any questions?

You can find me on LinkedIn: https://www.linkedin.com/in/stevehetzeldataengineer/