Slide 1

Slide 1 text

Ian Lewis Developer Advocate, Google Cloud Platform Building and Deploying Scalable Microservices With Kubernetes Modern WEb Conference

Slide 2

Slide 2 text

Confidential & Proprietary Google Cloud Platform 2 Ian Lewis Developer Advocate - Google Cloud Platform Tokyo, Japan +Ian Lewis @IanMLewis

Slide 3

Slide 3 text

Agenda ● Monolithic Apps ● Containers & Microservices ● Kubernetes ● Wrap Up

Slide 4

Slide 4 text

Confidential & Proprietary Google Cloud Platform 4 Current Practice

Slide 5

Slide 5 text

Confidential & Proprietary Google Cloud Platform 5 Database Batch processing Cache Webservers Webservers Webservers Webservers

Slide 6

Slide 6 text

Confidential & Proprietary Google Cloud Platform 6 App

Slide 7

Slide 7 text

7 Requires large resources per instance Hard to scale properly Hard for teams to have ownership of code Hard to set up SLOs around performance and availability. Monolithic Apps 7 App

Slide 8

Slide 8 text

Confidential & Proprietary Google Cloud Platform 8 Microservices

Slide 9

Slide 9 text

Confidential & Proprietary Google Cloud Platform 9 App A App B App C App D

Slide 10

Slide 10 text

Confidential & Proprietary Google Cloud Platform 10 App B App D App D App D App C App B App B App B App A App A App A App B App C App D

Slide 11

Slide 11 text

11 No isolation No namespacing Common libs Highly coupled apps and OS Shared Machines 11 kernel libs app app app app

Slide 12

Slide 12 text

12 Some isolation Inefficient Still highly coupled to the guest OS Hard to manage Virtual Machines 12 app libs kernel libs app app kernel app libs libs kernel kernel

Slide 13

Slide 13 text

Confidential & Proprietary Google Cloud Platform 13 Containers

Slide 14

Slide 14 text

For the last 15 years Google has been building the world’s fastest, most powerful infrastructure.

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

Cloud Technology Innovations 2012 2013 MapReduce Spanner/F1 2003 2006 2007 2010 2011 GFS Omega Colossus Cloud Storage Dremel BigQuery Big Table Cloud Datastore Paxos impl. 2004 Cloud Bigtable

Slide 17

Slide 17 text

Copyright 2015 Google Inc Google has been running all our services in Containers for over 10 years. We start over 2 billion containers every week. Images by Connie Zhou

Slide 18

Slide 18 text

18 Containers 18 libs app kernel libs app libs app libs app

Slide 19

Slide 19 text

Fast Simple and Fast compared to VMs. Can be started in just a few milliseconds. Portable Can be run in a many environments. Efficiency Low overhead. Resources use by containers can be limited. Why Containers?

Slide 20

Slide 20 text

Container Management Node Node Cluster Node ??? ● How to deploy to multiple nodes? ● How to deal with node failures? ● How to deal with container failures? ● How do you update your applications? ● How can your containers discover and communicate with each other?

Slide 21

Slide 21 text

http://research.google.com/pubs/pub43438.html

Slide 22

Slide 22 text

Image by Connie Zhou

Slide 23

Slide 23 text

job hello_world = { runtime = { cell = 'ic' } // Cell (cluster) to run in binary = '.../hello_world_webserver' // Program to run args = { port = '%port%' } // Command line parameters requirements = { // Resource requirements ram = 100M disk = 100M cpu = 0.1 } replicas = 5 // Number of tasks } 10000 Developer View

Slide 24

Slide 24 text

web browsers BorgMaster link shard UI shard BorgMaster link shard UI shard BorgMaster link shard UI shard BorgMaster link shard UI shard Scheduler borgcfg web browsers scheduler Borglet Borglet Borglet Borglet Config file BorgMaster link shard UI shard persistent store (Paxos) Binary Developer View

Slide 25

Slide 25 text

Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Image by Connie Zhou Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world! Hello world!

Slide 26

Slide 26 text

Confidential & Proprietary Google Cloud Platform 26 Kubernetes

Slide 27

Slide 27 text

Enter Kubernetes Greek for “Helmsman”; also the root of the word “Governor” • Container orchestrator • Runs containers • Supports multiple cloud and bare-metal environments • Inspired and informed by Google’s experiences and internal systems • Open source, written in Go Manage applications, not machines

Slide 28

Slide 28 text

CNCF(Cloud Native Computing Foundation)

Slide 29

Slide 29 text

Confidential & Proprietary Google Cloud Platform 29 Community ● Current stable version: 1.3 ● 860+ contributors ● over 16,000 github stars Project Partners

Slide 30

Slide 30 text

Google Cloud Platform UI CLI API users master nodes etcd scheduler controllers master The 10000 Foot View kubelet kubelet kubelet kubelet kubelet kubelet kubelet kubelet kubelet

Slide 31

Slide 31 text

Google Cloud Platform The 10000 Foot View etcd scheduler controller-manager apiserver kubelet docker kube-proxy iptables 1. User creates Deployment 2. API server saves info to etcd 3. CM finds Deployment and creates ReplicaSet, which creates Pods (unscheduled) 4. Scheduler schedules pods. 5. Kubelet sees pod scheduled to it and tells docker to run the container. 6. Docker pulls and runs the container. 1 2 6 3 5 4 Docker Hub / GCR

Slide 32

Slide 32 text

web browsers BorgMaster link shard UI shard BorgMaster link shard UI shard BorgMaster link shard UI shard BorgMaster link shard UI shard Scheduler borgcfg web browsers scheduler Borglet Borglet Borglet Borg Kubernetes Borglet Config file BorgMaster link shard UI shard persistent store (Paxos) manifest.yaml Master Kubelet etcd Kubelet Kubelet Binary Docker Image Docker Hub/Private Repo Kubelet kubernetes-dashboard

Slide 33

Slide 33 text

Google Cloud Platform observe diff act Deployments & ReplicaSets

Slide 34

Slide 34 text

Google Cloud Platform Deployments ReplicaSet - replicas: 3 - selector: - app: MyApp - version: v1 Deployment - name: MyApp kubectl create ...

Slide 35

Slide 35 text

Google Cloud Platform Deployments ReplicaSet - replicas: 4 - selector: - app: MyApp - version: v1 Deployment - name: MyApp kubectl create ...

Slide 36

Slide 36 text

Google Cloud Platform Deployments ReplicaSet - replicas: 3 - selector: - app: MyApp - version: v1 Deployment - name: MyApp kubectl create ...

Slide 37

Slide 37 text

Google Cloud Platform Deployments ReplicaSet - replicas: 3 - selector: - app: MyApp - version: v1 Deployment - name: MyApp kubectl create ...

Slide 38

Slide 38 text

Google Cloud Platform Rolling Updates ReplicaSet - replicas: 3 - selector: - app: MyApp - version: v1 Deployment - name: MyApp kubectl apply ...

Slide 39

Slide 39 text

Google Cloud Platform ReplicaSet - replicas: 3 - selector: - app: MyApp - version: v1 Rolling Updates ReplicaSet - replicas: 0 - selector: - app: MyApp - version: v2 Deployment - name: MyApp

Slide 40

Slide 40 text

Google Cloud Platform ReplicaSet - replicas: 3 - selector: - app: MyApp - version: v1 ReplicaSet - replicas: 1 - selector: - app: MyApp - version: v2 Rolling Updates Deployment - name: MyApp

Slide 41

Slide 41 text

Google Cloud Platform ReplicaSet - replicas: 2 - selector: - app: MyApp - version: v1 ReplicaSet - replicas: 1 - selector: - app: MyApp - version: v2 Rolling Updates Deployment - name: MyApp

Slide 42

Slide 42 text

Google Cloud Platform ReplicaSet - replicas: 2 - selector: - app: MyApp - version: v1 ReplicaSet - replicas: 2 - selector: - app: MyApp - version: v2 Rolling Updates Deployment - name: MyApp

Slide 43

Slide 43 text

Google Cloud Platform ReplicaSet - replicas: 1 - selector: - app: MyApp - version: v1 ReplicaSet - replicas: 2 - selector: - app: MyApp - version: v2 Rolling Updates Deployment - name: MyApp

Slide 44

Slide 44 text

Google Cloud Platform ReplicaSet - replicas: 1 - selector: - app: MyApp - version: v1 ReplicaSet - replicas: 3 - selector: - app: MyApp - version: v2 Rolling Updates Deployment - name: MyApp

Slide 45

Slide 45 text

Google Cloud Platform ReplicaSet - replicas: 0 - selector: - app: MyApp - version: v1 ReplicaSet - replicas: 3 - selector: - app: MyApp - version: v2 Rolling Updates Deployment - name: MyApp

Slide 46

Slide 46 text

Google confidential │ Do not distribute Services A group of pods that work together • grouped by a selector Defines access policy • “load balanced” or “headless” Gets a stable virtual IP and port • sometimes called the service portal • also a DNS name VIP is managed by kube-proxy • watches all services • updates iptables when backends change Hides complexity - ideal for non-native apps Virtual IP Client

Slide 47

Slide 47 text

Confidential & Proprietary Google Cloud Platform 47 App B App D App D App D App C App B App B App B App A App A App A App B App C App D

Slide 48

Slide 48 text

Confidential & Proprietary Google Cloud Platform 48 Demo

Slide 49

Slide 49 text

Confidential & Proprietary Google Cloud Platform 49 Web guestbook NGWord Redis Guestbook

Slide 50

Slide 50 text

Confidential & Proprietary Google Cloud Platform 50 The Right Architecture

Slide 51

Slide 51 text

Kubernetes Schedules workloads to resources and helps you manage them. Microservices Build a large complex system as many small simple parts. Containers Easier dependency management & resource isolation. Why Containers?

Slide 52

Slide 52 text

$ hello-world Photo by Connie Zhou

Slide 53

Slide 53 text

Google Container Engine New service for cluster-based compute ● Provisioned cluster in seconds. Fully configured. ● Fine-grained control over cluster. ● Designed for multi-cloud. Runs Kubernetes. Releases ● Now GA!! ● No additional cost for up to 5 nodes Resources ● Google Container Engine: http://cloud.google.com/container-engine ● Kubernetes: http://kubernetes.io

Slide 54

Slide 54 text

Thank You