35
Dapr Lego for Microservices Mark Chmarny Principal Program Manager Office of CTO, Azure @mchmarny

Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

DaprLego for Microservices

Mark ChmarnyPrincipal Program ManagerOffice of CTO, Azure@mchmarny

Page 2: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

Context

Page 3: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

Gap between existing code and modern architecture

increasingly larger

Platforms have narrow language support, tightly

controlled feature sets

Runtimes target specific infrastructure, limit portability

without rewrite

Developer Friction

Page 4: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

Dapr

Page 5: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

Distributed Application Runtime

dapr.io

Dapr project transitioningto open governance

Page 6: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

github.com/dapr

11Releases

10MImage Pulls

>450Contributors

70+Components

7.8KGitHub Stars

1Year

Page 7: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

Dapr Design Principles

Opt-inBuilding Blocks

Any LanguageAny Framework

Idiomatic, Based onCommon Practices

Consistent, Portable,Open APIs

Platform AgnosticVM, Cloud, BM, Edge

Extensibleand Pluggable

Page 8: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

Dapr

Building

BlocksService

invocationState

managementPublish

SubscribeResourcebindings

Virtualactors

Observability Secrets

Any Cloud, VM, Bare-meta, or Edge Infrastructure

HTTP API gRPC API

Any Code or Framework

Dapr Logical LayersDistributed Application Runtime

Page 9: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

Secrets

Streamlined and secure access to

application secrets

Observability

Automatic view logs, metrics, and traces across components

and networked services

VirtualActors

Durable code and data

encapsulation in reusable actor

objects

ResourceBindings

Event triggers, resource bindings from and to wide arrays of external

resources

Publish/ Subscribe

Scalable, secure, and reliable messaging

between services

State Management

Key/value statemanagement for

long running, stateless, and

stateful services

Dapr Building Blocks

ServiceInvocation

Discovery, secure, service-to-service

method calls across protocols

Page 10: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

State stores

Publish & subscribe

Resource bindingsScanning

for events

Dapr APIDapr API

Messaging

Load and save state

Servicecode B

Servicecode A

Input/output

Appl

icat

ion

Sidecar Sidecar

Secure with mTLS

Dapr Sidecar Architecture

Tracing, logsand metrics

Tracing, logsand metrics

Application

Page 11: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

Dapr SidecarKubernetes Standalone (self-hosted) apiVersion: apps/v1kind: Deploymentmetadata:name: my-applabels:app: my-app

spec:selector:matchLabels:app: my-app

template:metadata:labels:app: my-app

annotations:dapr.io/enabled: "true"dapr.io/app-id: "my-appr"dapr.io/app-protocol: ”http"dapr.io/app-port: ”8080”

dapr run --app-id my-app \--app-protocol grpc \--app-port 50105 \--components-path ./config \go run main.go

dapr run --app-id my-app \--app-protocol http \--app-port 3000 \--components-path ./config \node app.js

dapr run --app-id my-app \--app-protocol http \--app-port 5678 \--components-path ./config \./my-exe

Page 12: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

1

PodPod

Updatecomponent changes

Updates actor partition placement

Injects Daprruntime

Dapr Components

Manages

Components

Any modern Kubernetes cluster in the Cloud, in your Datacenter

Publish & subscribe

State stores

Resource bindingsInput/outputPod

C O N T A I N E R

Actor Placement

Pod

C O N T A I N E R

Sidecar Injector

Pod

C O N T A I N E R

Operator

Dapr APIHTTP or gRPC

Uses Components

C O N T A I N E R

Sidecar

C O N T A I N E R

Application code

Pod

C O N T A I N E R

Sentry

Certificate authority

Distributed Tracing

Prometheus AppInsightts Jaeger

Secured with mTLSto/from sidecar

Readiness andliveness probeon healthz API

Kubelet

Dapr on Kubernetes

Page 13: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

Dapr Building Blocks

Page 14: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

App“my-app”

{"name": "Tatooine"

}

GEThttp://localhost:3500/v1.0/state/<store-name>/planet

POSThttp://localhost:3500/v1.0/state/<store-name>

[{"key": "weapon","value": "DeathStar"

}, {"key": "planet","value": {

"name": "Tatooine"}

}]

key value

my-app-weapon "DeathStar"

my-app-planet { "name": "Tatooine"

}

Key/value state managementDapr building blocks

Backed by state storeof your choice

Page 15: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

apiVersion: dapr.io/v1alpha1kind: Componentmetadata:

name: corpdbspec:

type: state.mongodbmetadata:- name: host

value: headless.mongo.svc.cluster.local:27017- name: username

value: user1- name: password

secretKeyRef:name: mongo-secretkey: mongodb-password

- name: databaseNamevalue: orders

- name: collectionNamevalue: processed

POST/v1.0/state/corpdb

GET/v1.0/state/corpdb/<key>

DELETE/v1.0/state/corpdb/<key>

POST (Get bulk) /v1.0/state/corpdb/bulk

POST / PUT (Save multiple)/v1.0/state/corpdb/transaction

Key/value state managementDapr building blocks

Page 16: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

”app1"

”app2"

HTTPhttp://localhost:3500/v1.0/invoke/cart/method/checkout

{"user":"johndoe","cart":"0001"

}

gRPC 10.0.0.2:50001/InvokeService/checkout

{"user":"johndoe","cart":"0001"

}

Service discovery and invocationDapr building blocks

curl -H "Content-Type: application/json” -d '{ "arg1": 10, "arg2": 23}' \http://localhost:3500/v1.0/invoke/myService/method/myMethod?param1=a&parm2=1

Page 17: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

SubscribePublish

POSThttp://localhost:3500/v1.0/publish/

"topic":"order","data":{

"user":"johndoe","item":"ZeroDay"

},

“cart”

Publish and subscribeDapr building blocks

“shipping”

POSThttp://10.0.0.5:8005/order

"data":{"user":"johndoe","item":"ZeroDay"

}

“email”

POSThttp://10.0.0.4:8004/order

Page 18: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

apiVersion: dapr.io/v1alpha1kind: Componentmetadata:name: orders

spec:type: pubsub.redismetadata:- name: redisHostvalue: leader.redis.svc.cluster.local:6379

- name: redisPasswordsecretKeyRef:name: redis-secretkey: password

- name: allowedTopicsvalue: ”processed,audit"

POST/v1.0/publish/orders/processed

GET (programmatic discover)/dapr/subscribe

Supports both programmatic and declarative subscriptions

POST (to the app)/any/path/defined/in/subscription

Publish and subscribeDapr building blocks

Page 19: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

App"my-app"

GET / POSThttp://localhost:8000/trigger

{"user":"johndoe"

}

Redis

Kafka

SQS

Twitter

Resource bindings: inputDapr building blocks

Page 20: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

{“operation”: “query”"data": “SELECT A,B from C”

}

POSThttp://localhost:3500/v1.0/bindings/my-binding

App“my-app”

DynamoDB

Redis

Kafka

Twilio

Event Hubs

CosmosDB

Resource bindings: outputDapr building blocks

Page 21: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

apiVersion: dapr.io/v1alpha1kind: Componentmetadata:name: my-kafka

spec:type: bindings.kafkametadata:- name: brokersvalue: "http://localhost:5050"

- name: topicsvalue: ”submitted"

- name: publishTopicvalue: ”processed"

- name: consumerGroupvalue: "group1"

OPTIONS/POST (Input)/my-kafka

POST/PUT (Output)/v1.0/bindings/my-kafka

Resource bindingsDapr building blocks

Page 22: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

Secret Stores

GEThttp://localhost:3500/v1.0/secrets/vault/my-secret

Applicationcode

my-secret “supersecret”

SecretsDapr building blocks

Page 23: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

apiVersion: dapr.io/v1alpha1kind: Componentmetadata:name: my-secrets

spec:type: secretstores.hashicorp.vaultmetadata:- name: vaultAddrvalue: https://127.0.0.1:8200

- name: caCertvalue: "ca_cert"

- name: caPathvalue: ”/certs/cert.pem"

- name: caPemvalue: "/certs/ca.pem"

GET/v1.0/secrets/my-secrets/redis-password

Some secret stores support parameters in query (for metadata (e.g. version)

SecretsDapr building blocks

- name: redisPasswordsecretKeyRef:name: my-secretskey: redis-password

And in config

Page 24: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

App InsightsAzure Monitor

Datadog

Instana

Jaeger

SignalFX

Prometheus

Observability: metrics, distributed tracingDapr building blocks

App“frontend”

App“backend”

OpenCensus

Page 25: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

Pod Y

Actor C

Actor D

Pod X

Actor A

Actor B

POSThttp://localhost:3500/v1.0/actors/MyActors/C/method/update

{"speed":"1"

}

Virtual actorsDapr building blocks

App

Placementservice

Determine actor node placement

POSThttp://10.0.0.6:6004/update

{"speed":"1"

}

InvokeActor

Allocate

POSThttp://10.0.0.7:6005/update

{"speed":"3"

}

Page 26: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

SDKs & Frameworks

Page 27: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

HTTP API

gRPC API

SDKs

Dapr SDKs & FrameworksLanguage-specific Convenience Layers

Functions

ASP.NET Core

Logic Apps

Spring Boot

Server Side Blazor

Frameworks

Page 28: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

Demo

Page 29: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

DemoEvent processing pipeline

TweetProcessor

save tweets/v1.0/state/tweets

input binding/tweets

Sidecar

Twitter API

Page 30: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

DemoEvent processing pipeline

TweetProcessor

save tweets/v1.0/state/tweets

SentimentScorer

invoke sentiment service method/v1.0/invoke/sentimenter/method/score

publish scored tweets/v1.0/publish/processed

input binding/tweets

Sidecar Sidecar

Twitter API

Page 31: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

DemoEvent processing pipeline

TweetProcessor

save tweets/v1.0/state/tweets

SentimentScorer

TweetViewer

invoke sentiment service method/v1.0/invoke/sentimenter/method/score

publish scored tweets/v1.0/publish/processed

input binding/tweets

Sidecar Sidecar Sidecar

UITwitter API

Page 32: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

Event Processing Pipeline Demo

bit.ly/cncf-dapr

Page 33: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

Dapr Integrations

Page 34: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

• v0.11

• Stable APIs

• Access control, service identity

• External security audit (CNCF-certified company)

• Kicked off project transition to open governance

• Next, most likely, v1.0 RC by EOY

• Address friction from real-world use-cases

• Test infra (performance, conformance, long running tests…)

• Start seating the Technical and Steering Committee (TSC)

• Ensure general readiness for production grade workloads

Dapr Areas of Focus

Page 35: Lego for Microservices · Secrets Streamlined and secure access to application secrets Observability Automatic view logs, metrics, and traces across components and networked

Chatgitter.im/dapr

Twitter@daprdev

Anything [email protected]

Videosbit.ly/dapr-videos

Daprdapr.io

Projectgithub.com/dapr