Introduction to Microservices with Docker and Kubernetes

Preview:

Citation preview

All Aboard the Buzzword Express(or - what are Docker and Kubernetes?)

Dave Charles@cobecto

DDN

DDN

DHS

DDN

DHS

DVCS

?

Duh - This is just SOA?

Duh - This is just SOA?

Martin Fowlerauthor, speaker, and loud-mouth on the design of enterprise software

I've heard people say the nice thing about SOA is that it separates data from process, that it combines data and process, that it uses web standards, that it's independent of web standards, that it's asynchronous, that it's synchronous, that the synchronicity doesn't matter....

Adrian Cockcroft• A service-oriented architecture composed of

loosely coupled elements that have bounded contexts

Eric Evans• Domain Driven Design.• A microservice with correctly bounded context

is self-contained for the purposes of software development.

• You can understand and update the microservice’s code without knowing anything about the internals of its peers

Componentisation via Services

Business CapabilitiesNot

Org Structure

ProductsNot

Projects

Smart endpointsDumb Pipes

DecentralisedGovernance

DecentralisedData Management

So what are the benefits

There must be down-sides?

Docker

Docker

• A HOST runs a DOCKER SERVER (agent running as a daemon)

• Accessed using a DOCKER CLIENT• Tasks:• Builds IMAGES• Downloads IMAGES• Starts CONTAINERS• Stops CONTAINERS

Kubernetes

K8s

API SERVER

SCHEDULER

CONTROLLER

users control plane clusterNODE

NODE

NODE

kubelet

registry

APICLIENT

UI

API SERVER

SCHEDULER

CONTROLLER

users control plane clusterNODE

NODE

NODE

kubelet

registrykubectl run nginx:v1

API SERVER

SCHEDULER

CONTROLLER

users control plane clusterNODE

NODE

NODE

kubelet

registrykubectl run nginx:v1

status

API SERVER

SCHEDULER

CONTROLLER

users control plane clusterNODE

NODE

NODE

kubelet

registry

status

status

API SERVER

SCHEDULER

CONTROLLER

users control plane clusterNODE

NODE

NODE

registry

• NAMESPACE• Provides multiple virtual clusters backed by

the same physical cluster• “default” by, well, default

Some Terminology

• POD• Encapsulate containers and volumes• Atomic unit of replication and placement• A logical host

Some Terminology

• Volumes• Local scratch directories• Cloud block storage (GCE, AWS)• Cluster storage• Special – like Secrets, GIT repo

Some Terminology

• Secrets• As per 12 factor App• Injected as a volume into a POD• Never touches disk

Some Terminology

• Labels and Selectors• Labels are user defined key-value pairs than

can be attached to any API object• These labels are query-able by SELECTORS

Some Terminology

• Replication Controllers• Ensure n copies of a POD• Will drive current state towards desired state• If too few replicas, will create new ones• If too many, will destroy some• Used for scaling up, down and rolling

updates

Some Terminology

• Services• Targets group of pods with label selectors• Pods get their own IP, but they cannot be

relied upon to be stable over time• Services provide a stable endpoint so that

ephemeral pods can be found and accessed.

Some Terminology

https://www.infoq.com/presentations/7-sins-microservices

http://martinfowler.com/articles/microservices.html

https://www.nginx.com/blog/microservices-at-netflix-architectural-best-practices/

Recommended