Slide 1

Slide 1 text

Azure in Action: Pragmatische Cloud-Lösungen mit Containern & Serverless Christian Weyer @christianweyer CTO Thorsten Hans @ThorstenHans Consultant

Slide 2

Slide 2 text

2 § Co-Founder & CTO at Thinktecture AG § Personal focus on § Mobile & web-based application architectures § Pragmatic end-to-end solutions § Cloud-native & serverless architectures § Independent Microsoft Regional Director § Microsoft MVP for Visual Studio Tools & Development ASPInsider, AzureInsider § Google GDE for Web Technologies § [email protected] § @christianweyer Christian Weyer Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless

Slide 3

Slide 3 text

§ Consultant at Thinktecture AG § Personal focus on § Container Technologies § Cloud-native & serverless architectures § Office Add-In Development § Microsoft MVP for Visual Studio Tools & Development § [email protected] [email protected] § www.thinktecture.com thorsten-hans.com thns.io/slides § @ThorstenHans Thorsten Hans Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 3

Slide 4

Slide 4 text

4 Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action Topics Morning Containers & Orchestrators Afternoon Serverless

Slide 5

Slide 5 text

5 § We can choose from a continuum § VM ➔ § Containers ➔ § Orchestrators ➔ § PaaS ➔ § Serverless Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action Evolution to Cloud Compute Continuum PaaS IaaS On-Premises Serverless

Slide 6

Slide 6 text

6 Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless IaaS

Slide 7

Slide 7 text

7 The other Cloud Azure Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless

Slide 8

Slide 8 text

8 § Why Azure? § Look beyond one’s own nose § Microsoft has always been strong in the enterprise § It is no longer “Windows Azure” § >50% of VMs running on Linux (increasing) § Strong developer tooling § VS Code, anyone? § Breadth & depth offerings § Very broad availability worldwide Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action Azure Cloud https://www.cbronline.com/news/aws-results-azure

Slide 9

Slide 9 text

https://azure.microsoft.com/en-us/global-infrastructure/regions/ Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 9

Slide 10

Slide 10 text

10 How ‘large’ is ‘small’? ‘Micro’ Services Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless

Slide 11

Slide 11 text

11 Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action Bird’s-Eye-View Target Architectures HTTP API WS API Service D HTTPS HTTPS WebSocket Service A Service B Service C HTTP API

Slide 12

Slide 12 text

12 § Single Responsibility § Focused around business domain § ‘Small’ § Isolation § Choice of technology § Well-defined technology-agnostic API § Mobility § Autonomy § Exclusive State § Decoupling § Asynchronous Communication § Really, always? Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action Principles of Microservices 12

Slide 13

Slide 13 text

13 Classic Microservices Containers & Orchestrators Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless

Slide 14

Slide 14 text

1. What is Azure Kubernetes Service 2. Azure Kubernetes Service 101 3. Integrating AKS with Azure Services Containers & Orchestrators - Talking Points Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 14

Slide 15

Slide 15 text

What is AKS? Azure Kubernetes Service Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 15

Slide 16

Slide 16 text

AKS § Managed k8s cluster on Azure § AKS supports § Cluster auto-scaling § GPU enabled nodes § Development Tooling Integration (Azure DevSpaces) § Cost efficient § you pay ONLY for your worker nodes Azure Kubernetes Services Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 16

Slide 17

Slide 17 text

Azure Kubernetes Services 1 Fully managed Kubernetes Master 2 Seamless Azure Integration 3 Simplified Cluster Operations Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 17

Slide 18

Slide 18 text

Azure Kubernetes Service AKS 101 Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 18

Slide 19

Slide 19 text

Using Azure CLI # Create a resource group az group create --name thh-demo --location westeurope --tags @{resp="THH"} # Create a Service Principal az ad sp create-for-rbac --name thh-demo-aks-sp --skip-assignment # Will print something like { "appId": "7248f250-0000-0000-0000-dbdeb8400d85", # --> identifier ($SP_ID) "displayName": "thh-demo-aks-sp", "name": "http://thh-demo-aks-sp", "password": "77851d2c-0000-0000-0000-cb3ebc97975a", # --> client secret ($SP_PWD) "tenant": "72f988bf-0000-0000-0000-2d7cd011db47“ } Prepare a new AKS Cluster Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 19

Slide 20

Slide 20 text

Using Azure CLI # Create a AKS Cluster az aks create --name thh-demo-aks --resource-group thh-demo --location westeurope --service-principal $SP_ID --client-secret $SP_PWD --node-count 3 --node-vm-size Standard_DS1_v2 --tags @{resp="THH"} Create a new AKS Cluster Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 20

Slide 21

Slide 21 text

Using Azure CLI # Scale-Out an AKS Cluster (increase Node count to 5) az aks scale --name thh-demo-aks --resource-group thh-demo --node-count 5 Scale-Out an AKS Cluster Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 21

Slide 22

Slide 22 text

Using Azure CLI # Scale-In an AKS Cluster (reduce Node count to 1) az aks scale --name thh-demo-aks --resource-group thh-demo --node-count 1 Scale-In an AKS Cluster Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 22

Slide 23

Slide 23 text

Using Azure CLI # Get current k8s version az aks get-upgrades --name thh-demo-aks --resource-group thh-demo --output table # Name ResourceGroup MasterVersion NodePoolVersion Upgrades # ------- --------------- --------------- ----------------- ---- ---------- # thh... thh-demo 1.9.6 1.9.6, 1.9.8, 1.10.1 Get AKS Cluster Upgrades Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 23

Slide 24

Slide 24 text

Using Azure CLI # Start k8s upgrade az aks upgrade --name thh-demo-aks --resource-group thh-demo --kubernetes-version 1.10.1 Upgrade an AKS Cluster Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 24

Slide 25

Slide 25 text

Azure Services Integrating AKS Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 25

Slide 26

Slide 26 text

Integrating AKS with Azure Services 1 Container Registry 2 Storage 3 Container Instances 4 Key Vault 5 Analytics Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 26

Slide 27

Slide 27 text

Consume private images § Pull Docker images from ACR § Authentication done via Service Principal § Grant Reader permissions to AKS’s underlying SP for ACR Azure Container Registry Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 27

Slide 28

Slide 28 text

Using Azure CLI # Get ACR Identifier az acr show --name thhdemo --resource-group thh --query id # --> identifier ($ACR_ID) # Create Role Assignment for SP az role assignment create --assignee $SP_ID --role Reader --scope $ACR_ID Authenticate with ACR Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 28

Slide 29

Slide 29 text

Use persistent volumes § Support for Azure Disks and Azure Files § Static consumption § Storage is attached to Cluster and app developer uses it (eg in a Pod) § Dynamic consumption § Cluster knows how to dynamically create Azure Disks or Azure Files Shares Azure Storage Account Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 29

Slide 30

Slide 30 text

Scale cluster dynamically and support hybrid workloads § Deploy Pods to ACI § Execute both Windows and Linux containers § Feels like one or more native k8s node § Implemented using Virtual Kubelet Azure Container Instances Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 30

Slide 31

Slide 31 text

Extend AKS using a virtual-kubelet # Start k8s upgrade az aks install-connector --name thh-demo-aks --resource-group thh-demo --connector-name virtual-kubelet --aci-resource-group thh-demo --service-principal $SP_ID --client-secret $SP_PWD --os-type Windows Azure Container Instances Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 31

Slide 32

Slide 32 text

Keep sensitive data secured § Consume secrets, keys and certificates from a secured resource § Final, native integration for Key Vault and competitors not yet landed in k8s § Two different integration scenarios available § Authenticate via Client-Id and –Secret from within an application component § Use AAD to generate an Pod Identity (think of MSI) § Best solution … for NOW Azure Key Vault Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 32

Slide 33

Slide 33 text

All Insights at one place § Use Application Insights to collect application logs § Use Log Insights to collect infrastructure logs § Seamless integration of Log Insights for AKS § Centralized experience in Azure Monitor Azure Monitor Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 33

Slide 34

Slide 34 text

Enable Monitoring Add-on to stream logs to Azure Monitor # Enable Monitoring Add-on on AKS az aks enable-addons --name thh-demo-aks --resource-group thh-demo --addons monitoring --workspace-resource-id $WS_R_ID Azure Log Insights Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless 34

Slide 35

Slide 35 text

35 § We can choose from a continuum § VM ➔ § Containers ➔ § Orchestrators ➔ § PaaS ➔ § Serverless Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action Evolution to Cloud Compute Continuum PaaS IaaS On-Premises Serverless

Slide 36

Slide 36 text

36 A different approach Serverless Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless

Slide 37

Slide 37 text

37 § We strive for isolating functional services § Choice of technology, use best fitting communication means § Microservice: unit of independent deployment for a business domain-specific service § Nanoservice: like Microservice, but more focused & lightweight; can be replaced easier § Functions as the mental model § Basic idea: make things easier, get productive with business, not infrastructure Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action Microservices – or rather: Nanoservices !

Slide 38

Slide 38 text

38 Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action What is Serverless, anyway?

Slide 39

Slide 39 text

39 Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action Serverless Sweet Spot Programming Model § Event-driven § Stateless § Service-full Operational Model § Fully managed § Automatically scaling § Usage priced

Slide 40

Slide 40 text

40 § Serverless Compute → Azure Functions § Serverless Database → Azure Cosmos DB § Serverless Storage → Azure Storage § Serverless Realtime → Azure SignalR Service § Serverless Events → Azure Event Grid § Serverless Messaging → Azure Service Bus § Serverless Workflows → Azure Logic Apps Azure Durable Functions § Serverless IoT → Azure IoT Hub § Serverless Analytics → Azure Application Insights § Serverless Containers → Azure Container Instances Azure in Action Serverless in Azure Pragmatische Cloud-Lösungen mit Containern & Serverless

Slide 41

Slide 41 text

41 Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action There are NO servers! https://twitter.com/jeffhollan/status/1030244102082682880

Slide 42

Slide 42 text

42 Azure Storage & Cosmos DB Serverless Data Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless

Slide 43

Slide 43 text

43 § Blob § Highly scalable storage for arbitrary data § Can host static websites § Integrated with Event Grid § Files: fully managed cloud file shares § Sync § SMB, HTTPS § Table § Very simple schemaless table storage § Highly scalable § Needs thorough upfront design of data structures Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action Azure Storage

Slide 44

Slide 44 text

44 § Globally distributed, elastically scalable § Fully managed by Azure § But not yet fully automatically scaling § Pricing not (yet?) suitable for low-entry projects § Multi-model database § Key-value, document, graph § Multiple APIs § DocumentDB, with SQL & JS APIs § MongoDB API § Cassandra API § Table Storage API § Graph Database with Gremlin API Azure in Action Cosmos DB: A NoSQL Database with Many Faces Pragmatische Cloud-Lösungen mit Containern & Serverless

Slide 45

Slide 45 text

45 § Building event-driven architectures with Cosmos DB § Listening to Azure Cosmos DB collection for any changes § Inserts, updates, soft-deletes § Subscribe to collection changes Azure in Action Cosmos DB Change Feed Pragmatische Cloud-Lösungen mit Containern & Serverless

Slide 46

Slide 46 text

46 Azure Functions Serverless Compute Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless

Slide 47

Slide 47 text

47 § Azure Functions is code being triggered by an event § Basic principles enable powerful use cases § Events ➔ Triggers § Bindings § Two ways of operation § Cost-optimized, automatic scale (aka Consumption Plan) § Always-on § V2 Runtime built on .NET Core § Available for e.g. self-hosting § Local tooling & runtime available § Multiple language bindings supported Azure in Action Azure Functions: Functions-as-a-Service Pragmatische Cloud-Lösungen mit Containern & Serverless

Slide 48

Slide 48 text

48 § Cold vs. warm start Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action Azure Functions: Activation in Consumption Plan https://blogs.msdn.microsoft.com/appserviceteam/2018/02/07/understanding-serverless-cold-start/

Slide 49

Slide 49 text

49 § Incoming event triggers function § Input bindings enable easy access to data from various data sources § Output bindings offer easy access to outbound data sinks Azure in Action Triggers & Bindings Pragmatische Cloud-Lösungen mit Containern & Serverless Your code logic Runtime Azure Function HTTP Trigger Storage Input Binding Push Notification Output Binding Database Output Binding Email Output Binding Example

Slide 50

Slide 50 text

50 Azure in Action Triggers & Bindings in Code Pragmatische Cloud-Lösungen mit Containern & Serverless

Slide 51

Slide 51 text

51 Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings Triggers & Bindings

Slide 52

Slide 52 text

52 Azure Service Bus Serverless Messaging Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless

Slide 53

Slide 53 text

53 § Asynchronous communication for decoupling Microservices § Different messaging services in Azure § Events, messages, data points § Event Grid § Primary use case: Reactive programming § Service Bus § Primary use case: Enterprise-grade messaging § Event Hubs § Primary use case: Big data streams Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action Communication is key to Cloud Architectures

Slide 54

Slide 54 text

54 § Fully-managed centralized event routing service § Simplifies development of event-based applications § Simplifies creation of serverless workflows § Supports direct event filtering using event type, prefix or suffix § Your application will only need to receive the events you care about § Same underlying model for different use-cases § System-provided events § Custom application-specific events Azure in Action Reactive Programming: Event Grid Pragmatische Cloud-Lösungen mit Containern & Serverless

Slide 55

Slide 55 text

55 § Queues & Topics § Reliable asynchronous communication § Rich features for temporal control § Routing and filtering § Transactions § Convoys & Sessions (related messages with state) Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action Service Bus: Messaging-as-a-Service

Slide 56

Slide 56 text

56 Sender § Sender sends message to queue § Queue ACKs receipt § Receiver connects to queue & retrieves message § Receiver ACKs complete (or other action) Service Bus Queues Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless Receiver

Slide 57

Slide 57 text

57 § Sender only knows about Topic § Receivers only know about Subscriptions § Filters and Actions exist on Subscriptions Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action Service Bus Topics & Subscriptions Type == ‘order‘ Sender type=order type=quote Topic Type == ‘quote‘ Filter Filter Subscrip- tion 1 Subscrip- tion 2

Slide 58

Slide 58 text

58 Azure SignalR Service Serverless Realtime Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless

Slide 59

Slide 59 text

59 § Realtime messaging is a wanted feature nowadays § Dashboards and monitoring apps § Collaborative apps § Apps that require notifications § ASP.NET Core SignalR provides programming model for bi-directional ‘method invocation’ § Via WebSockets, SSE or Long Polling § Wanted: “SignalR messaging & scale-out”-as-a-Service ➔ Azure SignalR Service § Azure Functions bindings available for accessing Hubs (in preview) Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action Azure SignalR Service

Slide 60

Slide 60 text

60 Summary Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless

Slide 61

Slide 61 text

61 § Container technologies provide § a soft migration path to the cloud § a unified deployment model § AKS integrates perfectly with Azure Services § AKS scales dynamically depending on your needs § Serverless is just one option in the Cloud Continuum § Always think about the use cases and requirements § Serverless will be pre-dominant on the ‘server’ in a couple of years § Azure Functions is way more than just a Web API framework Summary Azure in Action Pragmatische Cloud-Lösungen mit Containern & Serverless

Slide 62

Slide 62 text

Azure in Action: Pragmatische Cloud-Lösungen mit Containern & Serverless Christian Weyer @christianweyer [email protected] Thorsten Hans @ThorstenHans [email protected] https://github.com/thorstenhans/aks-demo-app https://github.com/thinktecture/serverless-microservices