Kubernetes Day 2017 - Build, Ship and Run Your APP, Production !!

Preview:

Citation preview

Build, Ship and Run Your App, Production !!

HELLO!I am smalltown (Tom Tsai)

I am here because I want to share something with you

You can find me at smalltown@awsug.tw

How Far...From Dev To Prod?

App Can Run As Container

App Can Run As Container In Prod

What The FXXK Gap?

Docker

Monitor

Log

AWS

CoreOS

Kubernetes

Terraform

Docker

Monitor

Log

AWS

CoreOS

Kubernetes

Terraform

What Happened?

BackgroundExist Service Wants to Migrate From AT&T Data Center to AWS

Technical Debt- Service Feature Out of Date

- Trap in The Infrastructure

- Without Scalability

Not Just Migration

- Application Refactory

- Micro Service Adoption

- Container Introducing

Just Only MigrationV.S.

Leverage AWS Resource

Comparison

AWS RESOURCE OTHERS

Database RDS Self Host

Share Storage EFS Self Host

Docker Registry ECR Self Host

... ... ...

Container Orchestration ECS Host K8S

Container Ecosystem

Docker

Monitor

Log

AWS

CoreOS

Kubernetes

Terraform

Container Die Anytime !- Is The Application Suit For

Living as Container?

Examine The Application

Stateful

Stateful Stateless

Session Centralization

Stateful

Adopt Shared Storage

Stateless

Keep Origin

App Cluster Mode + StatefulSets

Work

Container Liveness and Readiness- Liveness: When The App

Transition to Broken States

- Readiness: When The App Ready to Receive Traffic

Docker

Monitor

Log

AWS

CoreOS

Kubernetes

Terraform

Why Kubernetes?

◉ Both ECS & K8S Can Solve All My Problems

◉ Interoperability V.S. Vendor Lock-in

◉ Familiarity & Tight Schedule

◉ Popularity & Community

Kubernetes Infra.

Kubernetes ModuleKubernetes Master Kubernetes Worker

Etcd ClusterFlannelDockerKubelet

K8S ProxyK8S API Server

K8S Control Manager

k8S Scheduler

Etcd ProxyFlannelDockerKubelet

K8S Proxy

CoreOS: See You Later !!

Kubernetes Scalability

Workers Pods

Horizontal # of Workers(https://goo.gl/qrJuHE)

# of Pods(https://goo.gl/mdoZFY)

Vertical Resources for a Workers(Different EC2 Type?)

Resources for a Pod(Under Development)

Docker

Monitor

Log

AWS

CoreOS

Kubernetes

Terraform

CoreOS Host Kubernetes

How K8S Run in CoreOSK8S Master K8S Worker

Docker Container(Hyperkube)

- K8S Proxy- K8S API Server- K8S Control Manager- k8S Scheduler

Docker Container(Hyperkube)

- K8S Proxy

RKT Container- Etcd (etcd-wrapper)- Flannel (flannel-wrapper)- Kubelet (kubelet-wrapper)

How To Update Core OS?!- Update Linux OS is Hard, But

Not CoreOS

CoreOS Release Channel

CoreOS Update Strategies

Strategy Description

reboot(Dev)

Reboot Immediately After an Update is Applied

etcd-lock(Stage or Prod)

Reboot After First Taking a Distributed Lock in Etcd

off(Prod)

Do Not Reboot After Updates are Applied

Docker

Monitor

Log

AWS

CoreOS

Kubernetes

Terraform

Avoid Add AWS Resource Manually- Using Hashicorp Terraform to Add

Public Cloud Resource

- Infrastructure As Code

What is Terraform?- Building, Changing, and

Versioning Infrastructure Safely And Efficiently

- Manage Existing and Popular Service Providers

Not This Session- It’s a Long Story to Say...

- Refer to Here For Slide

- Refer to Here For Sample

My Some Practices- Load Balancer Define in

Terraform

- EBS Persistent Volume Define in Terraform

Docker

Monitor

Log

AWS

CoreOS

Kubernetes

Terraform

Centralised V.S. Decentralised- Official Suggestion

- Ship Log By Each Node

- Ship Log By Each Pod

How to Collect App Log

Collector Problem

Docker Log Driver Not Support in Kubernetes

Logstash Resource Monster

Beats Lack of Output

Fluentd Similar Logstash

Fluent Bit Lack of Output

Log Management

Docker

Monitor

Log

AWS

CoreOS

Kubernetes

Terraform

Monitor K8S Cluster- Container View & Cluster View

- Yes, Prometheus (Not Again)

- Another Way For Integrating With AWS ASG or SNS ?

Do You Remember EC2 era?- Memory and Disk Metrics for

AWS EC2 Linux Instances. (Ref)

- Turn it Into Container. (Ref)

Easy Monitor Cluster Status

Any questions ?Thanks!

Recommended