cloud foundry vancouver meetup july 2016

52
Container Microservices: A Holistic Look at Managing Containers for Microservices

Upload: stuart-charlton

Post on 15-Apr-2017

309 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Cloud Foundry Vancouver Meetup July 2016

Container Microservices:A Holistic Look at Managing Containers for Microservices

Page 2: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Overview

• Why Containers?• Exploring Docker and Cloud Foundry• Docker and Cloud Foundry Workflow• Diego Cell and Brain

Page 3: Cloud Foundry Vancouver Meetup July 2016

Why Containers?

Page 4: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Why Containers?

Page 5: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

• a psychological condition of an operator who has suffered (usually persistent) emotional, or psychological abuse from a problematic CI system.

Why Containers?Battered Continuous Delivery

Ops Syndrome

Page 6: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Environment Parity- run tasks locally before

committing

Configurable- declarative CI (no more

snowflakes)- store in version control

Unpolluted builds- previous builds do not

affect subsequent builds

Usability- visualize pipeline- simple ui (click less!)

Scalability- scale up to increase

performance- scale down to decrease

cost

Example: What if we could...

Page 7: Cloud Foundry Vancouver Meetup July 2016

Exploring ContainerPlatforms

Page 8: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Swarm

Page 9: Cloud Foundry Vancouver Meetup July 2016

9

Router Cloud Controller

BOSH Director BOSH Agent

UAA/Login Servers

Messaging (NATS)

IaaS

Cloud Foundry Elastic Runtime Stack

Page 10: Cloud Foundry Vancouver Meetup July 2016

10

Router Cloud Controller

BOSH Director BOSH Agent

UAA/Login Servers

Messaging (NATS)

IaaS

Cloud Foundry Elastic Runtime Stack

Container Cells

Page 11: Cloud Foundry Vancouver Meetup July 2016

11

Doppler (Metrics & Logs)

Router Cloud Controller

BOSH Director BOSH Agent

UAA/Login Servers

Messaging (NATS)

IaaS

Cloud Foundry Elastic Runtime Stack

Container Cells

Page 12: Cloud Foundry Vancouver Meetup July 2016

12

Doppler (Metrics & Logs)

Router Cloud Controller

BOSH Director BOSH Agent

UAA/Login Servers Brain

Messaging (NATS)

IaaS

Cloud Foundry Elastic Runtime Stack

Container Cells

Page 13: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

The Container: Runtime vs No-Runtime

Platform buildpacks provide standard runtime

Platform provides fixed OS container image

Developer brings customized app

Developer brings runtime container image

Developer brings container OS image

Developer brings customized app

Platform provides fixed host OS Kernel

Platform provides fixed host OS Kernel

App container

Page 14: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Back-end Container Stuff

Container Orchestrator Container Engine

docker/docker-engine runC*

Kubernetes/kublet docker-engine -> runC*

Cloudfoundry/garden-linux custom code

Cloudfoundry/garden-runc runC*

*runC – Open Container Initiative reference implementation

Page 15: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

CF Root Filesystem

cflinuxfs2

Droplet

Docker

Write layer

• Layered file system in the container namespace

• RootFS changed by pivot root

• RootFS can be either cflinuxfs2 or from a Docker image

• Buildpacks are the Droplet added to the write layer

• Write layer is ephemeral

Write layer

BuildPack Docker

Page 16: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

CF Buildpacks Provide Runtime

Page 17: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Concourse.ci Pipelines: Docker-Native CI/CD

Page 18: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Finding The Runtime

Page 19: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Figuring Out How to Add My Application

Page 20: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Creating The Dockerfile

Page 21: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Running the Image

• Cloud Foundry– cf push

• Docker:– docker build– docker push– docker run

Page 22: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Orchestrating PCF Demo Application

Page 23: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Cloud Foundry Manifest

Page 24: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Docker Compose (On Docker-Machine)

Page 25: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Kubernetes

Page 26: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Deploying the Application• Cloud Foundry

– cf create-service– cf push

• Docker– docker-compose up

• Kubernetes– kubectl create -f ./pcfdemo.yml– kubectl create –f ./pcfdemo-service.yml– kubectl create –f ./rabbitmq.yml– kubectl create –f ./rabbitmq-service.yml

Page 27: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Ease of Platform Management

• Installing/Deploying Platform• Monitoring• Configuration• Upgrades

Page 28: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

BOSH

• Cloud Foundry is a distributed system that runs on many infrastructures

• BOSH was mainly designed as a holistic approach to deploying and managing Cloud Foundry-managed VMs– BOSH keeps the Cloud

Foundry runtime running

..

.BOSH

Cloud Foundry VMs

Infrastructure

Page 29: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

BOSH Architecture

Page 30: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Deploying New Services

• Managing Credentials• Connection Configuration and Metadata• Ease of Adding New Capabilities• Command Line Access• Accessible API

Page 31: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Service Broker API

Page 32: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Architectural Diagram of Services

Page 33: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Examples of Services

• MySQL, RabbitMQ, Redis, and Kafka• Spring Cloud Services: (i.e. Netflix OSS)

– Eureka – Service Registry– Hysterix – Circuit Breaker– ConfigServer – Configuration Service

• Route Services (contributed by GE Predix)– Rate Limiting– Authentication– Caching Services

Page 34: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Logging and Metrics: Two Perspectives

• Application Developers–Access to logs with logging a ticket–Self-service access for diagnostics

• Operations–Understanding the health of the Platform–Insights for Analysis and Capacity Planning

Page 35: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Application Dashboard

• Display current app status, scale, and route

• Streaming Data– last five

minutes of container and network metrics

– most recent app events

Page 36: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Container Metrics Detail

• View app events in context with streaming:– CPU– Disk– Memory

• Viewable by day, hour and minute

Page 37: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Network Metrics Detail

• View app events in context with streaming:– HTTP requests– HTTP errors – Latency

• Viewable by day, hour and minute

Page 38: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Loggregator

• Applications write logs to STDOUT and STDERR

• Relevant Cloud Foundry component events added to application stream

• Log events collected, collated, and expose via API and the Firehose

Page 39: Cloud Foundry Vancouver Meetup July 2016

DeveloperWorkflow

Page 40: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Focus of Cloud Foundry

• Increase Developer Productivity• Speed Application Development• Shorten Feedback Loop• Product Development Focused on Large

Enterprises

Page 41: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

PCF Workflow

• Docker and PCF Workflow• PCF (Pivotal Cloud Foundry) Workflow

Page 42: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Initial Docker and PCF Workflow

Select base find/ images Build Artifact Create Dockerfile

Create Manifest

cf create-service Build Docker Image

cf push Check App/Service

Push Docker Image to Registry

Page 43: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Subsequent Docker/PCF Workflow

Build Artifact Rebuild Docker Image

cf restage Push Docker Image to Registry

Check App/Service

Page 44: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Initial Cloud Foundry Workflow

cf create-service Build Artifact

Create Manifestcf push

Check Service/App

Page 45: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Subsequent Cloud Foundry Workflow

Build Artifact cf push

Check App/Service

Page 46: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Services of PCF• Container and Runtime Management

– Native: Complete Container and Runtime– Docker: User brings own Runtime

• Orchestration• Logging and Metrics• Services

– Databases– Message Queues

• Routing– Routing Services

Page 47: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Diego Brain And Cell• Rep

– Auction– Commands to Executor

• Executor– Manages the Container– Decoupled from Container Format

• Garden– Interface that defines Container– Garden-Linux– Garden-runC*– Can be Garden-Windows

• Metron– Manages Logging and Metrics

Page 48: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Gardenallows Diego to programmatically say

“make me a container”

“put this in it”

“then run this”

via a platform-agnostic API

Page 49: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Gardenallows Diego’s abstractions to be flexible

Page 50: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

The Open Container Initiative

Page 51: Cloud Foundry Vancouver Meetup July 2016

© Copyright 2015 Pivotal. All rights reserved.

Values Guiding the OCI Specification

• Composable - Container format not bound to runtime or clients

• Portable – Usable across different HW, OS, Clouds etc• Decentralized – Standard format for referencing images• Minimalist – Spec should focus on doing a few things well• Backward Compatible – Strive to be as backward

compatible as possible with Docker container format

Page 52: Cloud Foundry Vancouver Meetup July 2016

Thank You:Stuart Charlton@svrc

With thanks to @jyidiego for muchof this content