Top Banner
Ingredients for micro- services based platform for cloud native computing [email protected]
26

Micro-services meetup

Apr 15, 2017

Download

Technology

Craig mcluckie
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Micro-services meetup

Ingredients for micro-services based platform

for cloud native [email protected]

Page 2: Micro-services meetup

Towards cloud native computing

Container Packaged

Dynamically Scheduled

Microservices Oriented

Page 3: Micro-services meetup

Towards cloud native computing

Container Packaged

Dynamically Scheduled

Microservices Oriented

Not just Google ...

… n other internet companies

Page 4: Micro-services meetup

contextposit that “cloud native” is three things1. container packaged 2. dynamically scheduled 3. micro-services oriented

micro-services• lets developers assemble small, independently deployable components

• create loosely coupled, more agile systems• a basic atom of consumption for software• a basic atom of management for software

Page 5: Micro-services meetup

why?

Loosely coupled = easier to build and extend

• Compose applications from micro-services• Mix in and extend third party services• More agile systems and teams

Page 6: Micro-services meetup

why?

Separation of concerns = specialization

• Separate infrastructure ops from cluster ops from app ops• Radically increase code reuse• Radically reduced operations overhead

Page 7: Micro-services meetup

why?

Deeper automation = fewer bad outcomes

• Higher abstraction provides more insight into behavior• Orchestration made far easier• Self-healing and self-managing systems

Page 8: Micro-services meetup

Greek for “Helmsman”; also the root of the word “Governor”, “Cybernetics’

• Container orchestrator • Runs Docker containers• Supports multiple cloud and bare-metal

environments• Inspired and informed by Google’s experiences

and internal systems• Open source, written in Go

Manage services, not machines

Kubernetes

Page 9: Micro-services meetup

libs

app

kernel

libs

app

libs

app

libs

app

libs

app

kernel

libs

app

libs

app

libs

app

Kubernetes Master

libs

app

kernel

libs

app

libs

app

libs

app

Kubernetes gives you a cluster

Page 10: Micro-services meetup

Pod

Labels

Replication Controller

Service

Kubernetes Core Concepts

Page 11: Micro-services meetup

Group of containers

Live and die together

Shared network interface

Pod

Serving app

Data updater

Log collector

Pod

Page 12: Micro-services meetup

Label anything

Name-value pair

Make your own

Grouping via label selector

Pod

App

Log Collector

...

type = Frontend

version = 1.0

Labels

Page 13: Micro-services meetup

ReplicationController

Replicas → 2Pod

App

Log Collector

...

type = Frontend

version = 1.0

Pod

App

Log Collector

...

type = Frontend

version = 1.0

Replication Controller

Page 14: Micro-services meetup

ReplicationController

Replicas → 1Pod

App

Log Collector

...

type = Frontend

version = 1.0

Pod

App

Log Collector

...

type = Frontend

version = 1.0

Replication Controller

Page 15: Micro-services meetup

ReplicationController

Replicas → 2Pod

frontend

Pod

type = Frontend

version = 1.0

Pod

type = Frontend

version = 1.0

Service

Label selectors: version = 1.0 type = Frontend

(micro) Service

Page 16: Micro-services meetup

Pods are ephemeral● Need something addressable that is not

How do one set of ephemeral things find another set?● Discoverable through DNS● Discoverable environment variables

In time can do fancy things● Dynamic activation, context based scheduling, etc

Micro-services are a gateway to agile apps

Page 17: Micro-services meetup

Offers a minimum atom of software consumption● Minimally (hostname, port)● Endpoint API (enumerate membership; watch for changes)● Relies on a label selector to establish service membership

Offers a simple framework for orchestration● Route based on a label selector● Blue/Green● Canary deployment● ...

Kubernetes Services Defined

Page 18: Micro-services meetup

Service Scoping

Two basic scope levels● Cluster● Namespace

Page 19: Micro-services meetup

{ "kind": "Service", "apiVersion": "v1", "metadata": { "name": "my-service" }, "spec": { "selector": { "app": "MyApp" }, "ports": [ { "protocol": "TCP", "port": 80, "targetPort": 9376 } ] }}

Creating a Service

Assumes a set of pods listening on port 9376, with label ‘MyApp’ set.

POST to the API server will create a new service object

Page 20: Micro-services meetup

Finding your service: Environment variables

Automatically adds environment variables that are available to each container

REDIS_MASTER_SERVICE_HOST=10.0.0.11REDIS_MASTER_SERVICE_PORT=6379REDIS_MASTER_PORT=tcp://10.0.0.11:6379REDIS_MASTER_PORT_6379_TCP=tcp://10.0.0.11:6379REDIS_MASTER_PORT_6379_TCP_PROTO=tcpREDIS_MASTER_PORT_6379_TCP_PORT=6379REDIS_MASTER_PORT_6379_TCP_ADDR=10.0.0.11

Page 21: Micro-services meetup

Finding your service: DNS

An optional capability is DNS support (offered as a cluster add-on)

Server watches Kubernetes Services API and automatically creates DNS records for services

Use DNS Lookup with <service-name>.<namespace> to resolve IP

Services in the same namespace can be found via <service-name>

Page 22: Micro-services meetup

Broadening the Service definition: External services

VM LB IP:Port

VM IP:Port

K8sPod

Other clouds/On-prem IP:Port

Multiple Producers You may want to ‘mix in’ other services (VM based/SaaS based)

Ideally consume them as if they were ‘native’ to your cluster

To support this, it is possible to create services without specifying a selector

Page 23: Micro-services meetup

Towards a cluster environment

● A critical step towards ‘cloud native development’● Brings a new ‘type B’ cloud

○ Run it natively○ Overlay it on your ‘type A’ cloud infrastructure

Page 24: Micro-services meetup

Towards standards: CNCF

compute nodeOS

out of scope

api specification

reference implementation

container runtime

infrastructure provisioning

agent

OCI reference implementationOCI api specification

…. N

distributed systems services

resource scheduling

application definition and orchestration

software defined network software defined storage

container image repository

container image registry

Page 25: Micro-services meetup

Distributed systems services

compute nodeOS

container runtime

infrastructure provisioning

agent

…. N

resource scheduling

application definition and orchestration

software defined network software defined storage

container repository

container registry

distributed systems services

● a standard set of services that are not bound to a single node○ supporting application use cases

■ naming/discovery■ locking/quorum■ state management/sharding■ logging/monitoring

○ supporting cluster use cases■ distributed state management■ distributed control plane■ logging/auditing

● a minimum atom of consumption for software○ within the cluster○ between clusters○ from outside the cluster

Page 26: Micro-services meetup

Learn more.

Talk to me...Twitter: @cmcluckEmail me: [email protected]

Follow Kubernetes…Twitter: @kubernetesioGithub: https://github.com/googlecloudplatform/kubernetesBlog: http://blog.kubernetes.io/