Share
Azure in Action: Pragmatische Cloud-Lösungen mit Containern & Serverless
IDE öffnen, „File – New Project – Cloud“, OK klicken und fertig. Oder? Nun, nicht ganz. Denn egal ob AWS, GCP oder eben Azure: am Ende des Tages werden Sie sich fragen, warum, wann und wie gehe ich in die Cloud? Genau diese Fragestellungen wollen Thorsten Hans und Christian Weyer für Java-, node.js- und .NET-Entwickler in diesem Workshop beantworten. Anhand diverser Use Cases werden mögliche Wege mit, über und in Azure diskutiert. Was bedeuten Architekturansätze wie Cloud-Native Microservices und Serverless Microservices? Wie gehe ich bei Brownfield-Projekten vor und wie kann ich Greenfield-Lösungen effizient in Azure realisieren? Wo liegen Unterschiede und Benefits von datengetriebenen und von ereignisgetriebenen Ansätzen? Wie kann ich mit dem Sammelsurium an Patterns, Technologien und Tools in Azure kosteneffektiv hantieren und dennoch flexibel sein? All dies werden wir anhand praktischer Beispiele und pragmatischer Lösungen in interaktiver Art und Weise adressieren. Sehen Sie PaaS, Web Apps, Containers, Orchestrators, Serverless, Functions & Co. mit der Azure-Cloud anhand von .NET-Demos in Action.
Christian Weyer PRO
Transcript
62 slides
-
Azure in Action: Pragmatische Cloud-Lösungen mit Containern & Serverless Christian
Weyer @christianweyer CTO Thorsten Hans @ThorstenHans Consultant -
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 -
§ 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 -
4 Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action
Topics Morning Containers & Orchestrators Afternoon Serverless -
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 -
7 The other Cloud Azure Azure in Action Pragmatische Cloud-Lösungen
mit Containern & Serverless -
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 -
10 How ‘large’ is ‘small’? ‘Micro’ Services Azure in Action
Pragmatische Cloud-Lösungen mit Containern & Serverless -
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 -
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 -
13 Classic Microservices Containers & Orchestrators Azure in Action Pragmatische
Cloud-Lösungen mit Containern & Serverless -
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 -
What is AKS? Azure Kubernetes Service Azure in Action Pragmatische
Cloud-Lösungen mit Containern & Serverless 15 -
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 -
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 -
Azure Kubernetes Service AKS 101 Azure in Action Pragmatische Cloud-Lösungen
mit Containern & Serverless 18 -
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 -
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 -
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 -
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 -
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 -
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 -
Azure Services Integrating AKS Azure in Action Pragmatische Cloud-Lösungen mit
Containern & Serverless 25 -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
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 -
36 A different approach Serverless Azure in Action Pragmatische Cloud-Lösungen
mit Containern & Serverless -
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 ! -
38 Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action
What is Serverless, anyway? -
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 -
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 -
41 Pragmatische Cloud-Lösungen mit Containern & Serverless Azure in Action
There are NO servers! https://twitter.com/jeffhollan/status/1030244102082682880 -
42 Azure Storage & Cosmos DB Serverless Data Azure in
Action Pragmatische Cloud-Lösungen mit Containern & Serverless -
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 -
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 -
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 -
46 Azure Functions Serverless Compute Azure in Action Pragmatische Cloud-Lösungen
mit Containern & Serverless -
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 -
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/ -
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 -
50 Azure in Action Triggers & Bindings in Code Pragmatische
Cloud-Lösungen mit Containern & Serverless -
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 -
52 Azure Service Bus Serverless Messaging Azure in Action Pragmatische
Cloud-Lösungen mit Containern & Serverless -
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 -
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 -
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 -
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 -
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 -
58 Azure SignalR Service Serverless Realtime Azure in Action Pragmatische
Cloud-Lösungen mit Containern & Serverless -
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 -
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 -
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