Getting sh*t done with Azure Functions (on AKS!)

Rick van den Bosch
Rick van den BoschCloud Solution Architect at Betabit
Getting sh*t done with Azure Functions (on AKS!)
Getting sh*t done with
Azure Functions
(on AKS!)
Who’s who?
Daniël te Winkel Rick van den Bosch
Agenda
• Introduction
• Hosting platforms
• Triggers & Bindings
• Dependency Injection
• Managed Identities
• Azure Functions on AKS
Introduction
Azure Functions
“Accelerate your development with an event-driven,
serverless compute experience. Scale on demand and
pay only for the resources you consume.”
Azure Functions
• Accelerate & simplify development with Serverless compute
• Improve your end-to-end development experience
• Simplify complex orchestration challenges resolution
• Connect other services without hard-coding integrations for faster
solutions development
• Choose the best hosting option for your application
• Develop your way
Supported languages
Hosting Platforms
Azure
Consumption plan
• The default hosting plan
• Pay only when your Functions are running
• Scale out automatically
• Billing is based on # of executions, execution time, and memory used
• GB-s: average memory size in gigabytes * execution time in ms
• Free grant: 1 million executions, 400.000 GB-s
App Service plan
• Consider if you want to
• Take advantage of existing, underutilized VMs
• Provide a custom image to run Functions on
• Enable Always On
• Runtime goes idle after a few minutes
• Only HTTP triggers “wake up” the Functions
Premium plan
• Consider if you want to
• Run function apps continuously, or nearly continuously
• Have more CPU or memory options than what is provided by the
Consumption plan
• Run your code longer than the max. on the Consumption plan
• Have features that are only available on a Premium plan (VNET/VPN)
• Billing is based on the number of vCPU-s and GB-s
Intermezzo: Timeout duration
Premium plan – Features
• Perpetually warm instances to avoid any cold start
• VNet connectivity
• Unlimited execution duration
• Premium instance sizes (one core, two core, and four core instances)
• More predictable pricing
• High-density app allocation for plans with multiple function apps
Premium plan – Pre-warmed instances
Hosting Platforms
AKS / Kubernetes / Docker
What is Kubernetes / AKS?
• Docker: Create, deploy and run applications in Containers
• Kubernetes (k8s): open source container orchestration engine
for automating deployment, scaling, and management of
containerized applications (e.g. Docker containers)
• Azure Kubernetes Service (AKS): Managed Kubernetes in Azure
17
Cluster
• Master
• Nodes
18
Deployments
• Manages lifecycle of app
• Across nodes
19
Pods
• Unit of Deployment
• One or a few Containers
• Persistent volumes
20
Azure functions in AKS
• Add serverless capabilities with Virtual Nodes
• Scale Event driven applications with KEDA (preview)
• Scale HTTP driven applications with Osiris (experimental)
• Managed identity with AAD Pod Identity
21
Azure Functions in Kubernetes
The good news:
• Easy to write and small pieces of code
• Triggers and bindings
• Portable between all hosting options
The not-so-good news:
• You lose most of what you are used to with Azure Functions in the
portal
22
Azure Functions in Kubernetes – Pitfalls
• Scaling, without KEDA, does not work as expected
• Host ID different per Pod
• Poor fix by setting: AzureFunctionsWebHost:hostId
23
Triggers & Bindings
Triggers & Bindings
• Triggers
• cause a function to run
• function must have exactly one trigger
• have associated data, which is often provided as the payload of the function
• Bindings
• way of declaratively connecting another resource to the function
• may be connected as input bindings, output bindings, or both
• provide their data to the function as parameters
Getting sh*t done with Azure Functions (on AKS!)
Dual abstraction
• Azure Functions abstract away the infrastructure
• Triggers & Bindings abstract away the resources you interact with
Triggers
• Example:
• Blob Trigger on a Consumption plan
• Up to 10 minute delay
Solution:
• Switch to App Service plan with Always On enabled.
• Use Event Grid trigger with your Blob storage account.
DEMO
Dependency Injection
Dependency Injection
• Microsoft.NET.Sdk.Functions >= 1.0.28
• Constructor injection
• Same as DI in ASP.Net core
• Already provided services:
• Microsoft.Extensions.Configuration.IConfiguration
• Microsoft.Azure.WebJobs.Host.Executors.IHostIdProvider
32
DI – Scopes
• Singleton – Created once, on first request,
or when created before registration
• Scoped – Created once per client request (connection / trigger)
• Transient – Created on each request
33
DI – Extension
• NuGet: Microsoft.Azure.Functions.Extensions
• Makes dependency registrations a bit easier
• Provides IServiceCollection on IFunctionHostBuilder
34
DI – Migrating
35
public static class Function
{
[FunctionName(nameof(Ping))]
public static async Task<string> Ping(
[HttpTrigger(AuthorizationLevel.Function, "get"] HttpRequest req,
ILogger log,
CancellationToken cancellationToken)
{
var pingService = new PingService(log);
return await pingService.Ping(cancellationToken);
}
}
public class Function
{
private readonly IPingService _pingService;
public Function(IPingService pingService)
{
_pingService = pingService;
}
[FunctionName(nameof(Ping))]
public async Task<string> Ping(
[HttpTrigger(AuthorizationLevel.Function, "get")] HttpRequest req,
CancellationToken cancellationToken)
=> await _pingService.Ping(cancellationToken);
}
DI – Registration
36
using Microsoft.Azure.Functions.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
[assembly: FunctionsStartup(typeof(Startup))]
public class Startup : FunctionsStartup
{
public override void Configure(IFunctionsHostBuilder builder)
{
builder.Services.AddScoped<IPingService, PingService>();
}
}
DEMO
37
Managed Identities
a.k.a. Managed Service Identifier
Managed Identities for Azure resources
• Provide Azure services with a managed identity in Azure AD
• Use the identity to authenticate to any service
(that supports Azure AD authentication)
Supporting services
“We are in the process of integrating managed identities for Azure
resources and Azure AD authentication across Azure.”
• Azure Resource Manager
• Azure Key Vault
• Azure Data Lake
• Azure SQL
• Azure Event Hub
• Azure Service Bus
• Azure Storage blobs and queues
• Azure Analysis Services
DEMO
Resources
https://www.theurlist.com/gsdwaf
Questions?
d.te.winkel@betabit.nl
r.van.den.bosch@betabit.nl
@daniel_teWinkel
@rickvdbosch
Find us at the Betabit booth
Getting sh*t done with Azure Functions (on AKS!)
1 of 43

Recommended

こんなところにセキュリティ by
こんなところにセキュリティこんなところにセキュリティ
こんなところにセキュリティはなずきん Hana
2.6K views15 slides
NGINX Plus on AWS by
NGINX Plus on AWSNGINX Plus on AWS
NGINX Plus on AWSAmazon Web Services
3.3K views44 slides
AWS Dedicated Host 통한 효율적 마이그레이션 구축 사례::이준호 매니저 (AWS), 홍재선 (Bespin Global) by
AWS Dedicated Host 통한 효율적 마이그레이션 구축 사례::이준호 매니저 (AWS), 홍재선 (Bespin Global)AWS Dedicated Host 통한 효율적 마이그레이션 구축 사례::이준호 매니저 (AWS), 홍재선 (Bespin Global)
AWS Dedicated Host 통한 효율적 마이그레이션 구축 사례::이준호 매니저 (AWS), 홍재선 (Bespin Global)Amazon Web Services Korea
2.6K views25 slides
Container World 2018 by
Container World 2018Container World 2018
Container World 2018aspyker
4.9K views23 slides
Service Mesh with Apache Kafka, Kubernetes, Envoy, Istio and Linkerd by
Service Mesh with Apache Kafka, Kubernetes, Envoy, Istio and LinkerdService Mesh with Apache Kafka, Kubernetes, Envoy, Istio and Linkerd
Service Mesh with Apache Kafka, Kubernetes, Envoy, Istio and LinkerdKai Wähner
25.1K views79 slides
Introduction to GitHub Actions by
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub ActionsKnoldus Inc.
3.2K views16 slides

More Related Content

What's hot

Flink on Kubernetes operator by
Flink on Kubernetes operatorFlink on Kubernetes operator
Flink on Kubernetes operatorEui Heo
297 views28 slides
Introduction to Kubernetes by
Introduction to KubernetesIntroduction to Kubernetes
Introduction to KubernetesVishal Biyani
601 views21 slides
Kibana overview by
Kibana overviewKibana overview
Kibana overviewRinat Tainov
560 views18 slides
Getting started with MariaDB with Docker by
Getting started with MariaDB with DockerGetting started with MariaDB with Docker
Getting started with MariaDB with DockerMariaDB plc
714 views47 slides
Technical Introduction to PostgreSQL and PPAS by
Technical Introduction to PostgreSQL and PPASTechnical Introduction to PostgreSQL and PPAS
Technical Introduction to PostgreSQL and PPASAshnikbiz
5.5K views65 slides
Kubernetes: A Short Introduction (2019) by
Kubernetes: A Short Introduction (2019)Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)Megan O'Keefe
8K views25 slides

What's hot(20)

Flink on Kubernetes operator by Eui Heo
Flink on Kubernetes operatorFlink on Kubernetes operator
Flink on Kubernetes operator
Eui Heo297 views
Introduction to Kubernetes by Vishal Biyani
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
Vishal Biyani601 views
Getting started with MariaDB with Docker by MariaDB plc
Getting started with MariaDB with DockerGetting started with MariaDB with Docker
Getting started with MariaDB with Docker
MariaDB plc714 views
Technical Introduction to PostgreSQL and PPAS by Ashnikbiz
Technical Introduction to PostgreSQL and PPASTechnical Introduction to PostgreSQL and PPAS
Technical Introduction to PostgreSQL and PPAS
Ashnikbiz5.5K views
Kubernetes: A Short Introduction (2019) by Megan O'Keefe
Kubernetes: A Short Introduction (2019)Kubernetes: A Short Introduction (2019)
Kubernetes: A Short Introduction (2019)
Megan O'Keefe8K views
Why kubernetes matters by Platform9
Why kubernetes mattersWhy kubernetes matters
Why kubernetes matters
Platform93K views
Infrastructure as Code - Getting Started, Concepts & Tools by Lior Kamrat
Infrastructure as Code - Getting Started, Concepts & ToolsInfrastructure as Code - Getting Started, Concepts & Tools
Infrastructure as Code - Getting Started, Concepts & Tools
Lior Kamrat2.3K views
Building infrastructure as code using Terraform - DevOps Krakow by Anton Babenko
Building infrastructure as code using Terraform - DevOps KrakowBuilding infrastructure as code using Terraform - DevOps Krakow
Building infrastructure as code using Terraform - DevOps Krakow
Anton Babenko1.8K views
[Main Session] 카프카, 데이터 플랫폼의 최강자 by Oracle Korea
[Main Session] 카프카, 데이터 플랫폼의 최강자[Main Session] 카프카, 데이터 플랫폼의 최강자
[Main Session] 카프카, 데이터 플랫폼의 최강자
Oracle Korea2.8K views
Git Lab Introduction by Krunal Doshi
Git Lab IntroductionGit Lab Introduction
Git Lab Introduction
Krunal Doshi850 views
Hands-On Introduction to Kubernetes at LISA17 by Ryan Jarvinen
Hands-On Introduction to Kubernetes at LISA17Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17
Ryan Jarvinen1.1K views
Introduction to Ansible by CoreStack
Introduction to AnsibleIntroduction to Ansible
Introduction to Ansible
CoreStack722 views
Kubernetes Networking by CJ Cullen
Kubernetes NetworkingKubernetes Networking
Kubernetes Networking
CJ Cullen26.7K views
DevOps with Ansible by Swapnil Jain
DevOps with AnsibleDevOps with Ansible
DevOps with Ansible
Swapnil Jain1.8K views
Centralized Logging System Using ELK Stack by Rohit Sharma
Centralized Logging System Using ELK StackCentralized Logging System Using ELK Stack
Centralized Logging System Using ELK Stack
Rohit Sharma3.3K views
Speeding up your team with GitOps by Brice Fernandes
Speeding up your team with GitOpsSpeeding up your team with GitOps
Speeding up your team with GitOps
Brice Fernandes300 views

Similar to Getting sh*t done with Azure Functions (on AKS!)

Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F... by
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...Tokyo Azure Meetup
1.4K views48 slides
AWS re:Invent 2016: Netflix: Container Scheduling, Execution, and Integration... by
AWS re:Invent 2016: Netflix: Container Scheduling, Execution, and Integration...AWS re:Invent 2016: Netflix: Container Scheduling, Execution, and Integration...
AWS re:Invent 2016: Netflix: Container Scheduling, Execution, and Integration...Amazon Web Services
3.3K views61 slides
Dev day serverless from a devs perspective by
Dev day   serverless from a devs perspectiveDev day   serverless from a devs perspective
Dev day serverless from a devs perspectivebartlannoeye
212 views32 slides
Container orchestration k8s azure kubernetes services by
Container orchestration  k8s azure kubernetes servicesContainer orchestration  k8s azure kubernetes services
Container orchestration k8s azure kubernetes servicesRajesh Kolla
55 views19 slides
Re:invent 2016 Container Scheduling, Execution and AWS Integration by
Re:invent 2016 Container Scheduling, Execution and AWS IntegrationRe:invent 2016 Container Scheduling, Execution and AWS Integration
Re:invent 2016 Container Scheduling, Execution and AWS Integrationaspyker
5.9K views61 slides
Containers, microservices and serverless for realists by
Containers, microservices and serverless for realistsContainers, microservices and serverless for realists
Containers, microservices and serverless for realistsKarthik Gaekwad
77.3K views74 slides

Similar to Getting sh*t done with Azure Functions (on AKS!)(20)

Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F... by Tokyo Azure Meetup
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
Tokyo Azure Meetup #7 - Introduction to Serverless Architectures with Azure F...
Tokyo Azure Meetup1.4K views
AWS re:Invent 2016: Netflix: Container Scheduling, Execution, and Integration... by Amazon Web Services
AWS re:Invent 2016: Netflix: Container Scheduling, Execution, and Integration...AWS re:Invent 2016: Netflix: Container Scheduling, Execution, and Integration...
AWS re:Invent 2016: Netflix: Container Scheduling, Execution, and Integration...
Amazon Web Services3.3K views
Dev day serverless from a devs perspective by bartlannoeye
Dev day   serverless from a devs perspectiveDev day   serverless from a devs perspective
Dev day serverless from a devs perspective
bartlannoeye212 views
Container orchestration k8s azure kubernetes services by Rajesh Kolla
Container orchestration  k8s azure kubernetes servicesContainer orchestration  k8s azure kubernetes services
Container orchestration k8s azure kubernetes services
Rajesh Kolla55 views
Re:invent 2016 Container Scheduling, Execution and AWS Integration by aspyker
Re:invent 2016 Container Scheduling, Execution and AWS IntegrationRe:invent 2016 Container Scheduling, Execution and AWS Integration
Re:invent 2016 Container Scheduling, Execution and AWS Integration
aspyker5.9K views
Containers, microservices and serverless for realists by Karthik Gaekwad
Containers, microservices and serverless for realistsContainers, microservices and serverless for realists
Containers, microservices and serverless for realists
Karthik Gaekwad77.3K views
Understanding Docker and IBM Bluemix Container Service by Andrew Ferrier
Understanding Docker and IBM Bluemix Container ServiceUnderstanding Docker and IBM Bluemix Container Service
Understanding Docker and IBM Bluemix Container Service
Andrew Ferrier1.1K views
ECS and Docker at Okta by Jon Todd
ECS and Docker at OktaECS and Docker at Okta
ECS and Docker at Okta
Jon Todd1.9K views
Serverless Application Development with Azure by Callon Campbell
Serverless Application Development with AzureServerless Application Development with Azure
Serverless Application Development with Azure
Callon Campbell450 views
Containers, Serverless and Functions in a nutshell by Eugene Fedorenko
Containers, Serverless and Functions in a nutshellContainers, Serverless and Functions in a nutshell
Containers, Serverless and Functions in a nutshell
Eugene Fedorenko451 views
Building Cloud Native Applications Using Azure Kubernetes Service by Dennis Moon
Building Cloud Native Applications Using Azure Kubernetes ServiceBuilding Cloud Native Applications Using Azure Kubernetes Service
Building Cloud Native Applications Using Azure Kubernetes Service
Dennis Moon123 views
Tokyo azure meetup #8 - Azure Update, August by Kanio Dimitrov
Tokyo azure meetup #8 - Azure Update, AugustTokyo azure meetup #8 - Azure Update, August
Tokyo azure meetup #8 - Azure Update, August
Kanio Dimitrov114 views
Kubernetes: від знайомства до використання у CI/CD by Stfalcon Meetups
Kubernetes: від знайомства до використання у CI/CDKubernetes: від знайомства до використання у CI/CD
Kubernetes: від знайомства до використання у CI/CD
Stfalcon Meetups522 views
DevOps as a Service - Kuberiter by lawrence143
DevOps as a Service - KuberiterDevOps as a Service - Kuberiter
DevOps as a Service - Kuberiter
lawrence143128 views
Structured Container Delivery by Oscar Renalias, Accenture by Docker, Inc.
Structured Container Delivery by Oscar Renalias, AccentureStructured Container Delivery by Oscar Renalias, Accenture
Structured Container Delivery by Oscar Renalias, Accenture
Docker, Inc.815 views
AWS for Java Developers workshop by Rory Preddy
AWS for Java Developers workshopAWS for Java Developers workshop
AWS for Java Developers workshop
Rory Preddy180 views
Introduction to Azure Functions by Callon Campbell
Introduction to Azure FunctionsIntroduction to Azure Functions
Introduction to Azure Functions
Callon Campbell4.6K views
Azure functions: Build apps faster with serverless architecture (March 2018) by Callon Campbell
Azure functions: Build apps faster with serverless architecture (March 2018)Azure functions: Build apps faster with serverless architecture (March 2018)
Azure functions: Build apps faster with serverless architecture (March 2018)
Callon Campbell700 views

More from Rick van den Bosch

Configuration in azure done right by
Configuration in azure done rightConfiguration in azure done right
Configuration in azure done rightRick van den Bosch
353 views28 slides
Getting started with Azure Cognitive services by
Getting started with Azure Cognitive servicesGetting started with Azure Cognitive services
Getting started with Azure Cognitive servicesRick van den Bosch
99 views29 slides
From .NET Core 3, all the rest will be legacy by
From .NET Core 3, all the rest will be legacyFrom .NET Core 3, all the rest will be legacy
From .NET Core 3, all the rest will be legacyRick van den Bosch
291 views54 slides
SAFwAD @ Intelligent Cloud Conference by
SAFwAD @ Intelligent Cloud ConferenceSAFwAD @ Intelligent Cloud Conference
SAFwAD @ Intelligent Cloud ConferenceRick van den Bosch
298 views45 slides
Securing an Azure Function REST API with Azure Active Directory by
Securing an Azure Function REST API with Azure Active DirectorySecuring an Azure Function REST API with Azure Active Directory
Securing an Azure Function REST API with Azure Active DirectoryRick van den Bosch
259 views29 slides
Azure Lowlands: An intro to Azure Data Lake by
Azure Lowlands: An intro to Azure Data LakeAzure Lowlands: An intro to Azure Data Lake
Azure Lowlands: An intro to Azure Data LakeRick van den Bosch
1.6K views52 slides

More from Rick van den Bosch(12)

From .NET Core 3, all the rest will be legacy by Rick van den Bosch
From .NET Core 3, all the rest will be legacyFrom .NET Core 3, all the rest will be legacy
From .NET Core 3, all the rest will be legacy
Rick van den Bosch291 views
Securing an Azure Function REST API with Azure Active Directory by Rick van den Bosch
Securing an Azure Function REST API with Azure Active DirectorySecuring an Azure Function REST API with Azure Active Directory
Securing an Azure Function REST API with Azure Active Directory
Rick van den Bosch259 views
Azure Lowlands: An intro to Azure Data Lake by Rick van den Bosch
Azure Lowlands: An intro to Azure Data LakeAzure Lowlands: An intro to Azure Data Lake
Azure Lowlands: An intro to Azure Data Lake
Rick van den Bosch1.6K views
TechDays 2017 - Going Serverless (2/2): Hands-on with Azure Event Grid by Rick van den Bosch
TechDays 2017 - Going Serverless (2/2): Hands-on with Azure Event GridTechDays 2017 - Going Serverless (2/2): Hands-on with Azure Event Grid
TechDays 2017 - Going Serverless (2/2): Hands-on with Azure Event Grid
Rick van den Bosch379 views
TechDays 2016 - Case Study: Azure + IOT + LoRa = ”Leven is Water” by Rick van den Bosch
TechDays 2016 - Case Study: Azure + IOT + LoRa = ”Leven is Water”TechDays 2016 - Case Study: Azure + IOT + LoRa = ”Leven is Water”
TechDays 2016 - Case Study: Azure + IOT + LoRa = ”Leven is Water”
Rick van den Bosch996 views
Take control of your deployments with Release Management by Rick van den Bosch
Take control of your deployments with Release ManagementTake control of your deployments with Release Management
Take control of your deployments with Release Management
Rick van den Bosch967 views

Recently uploaded

Digital Personal Data Protection (DPDP) Practical Approach For CISOs by
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOsPriyanka Aash
162 views59 slides
CryptoBotsAI by
CryptoBotsAICryptoBotsAI
CryptoBotsAIchandureddyvadala199
42 views5 slides
Transcript: Redefining the book supply chain: A glimpse into the future - Tec... by
Transcript: Redefining the book supply chain: A glimpse into the future - Tec...Transcript: Redefining the book supply chain: A glimpse into the future - Tec...
Transcript: Redefining the book supply chain: A glimpse into the future - Tec...BookNet Canada
41 views16 slides
Inawisdom IDP by
Inawisdom IDPInawisdom IDP
Inawisdom IDPPhilipBasford
15 views48 slides
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...The Digital Insurer
91 views52 slides
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023 by
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023BookNet Canada
44 views19 slides

Recently uploaded(20)

Digital Personal Data Protection (DPDP) Practical Approach For CISOs by Priyanka Aash
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Priyanka Aash162 views
Transcript: Redefining the book supply chain: A glimpse into the future - Tec... by BookNet Canada
Transcript: Redefining the book supply chain: A glimpse into the future - Tec...Transcript: Redefining the book supply chain: A glimpse into the future - Tec...
Transcript: Redefining the book supply chain: A glimpse into the future - Tec...
BookNet Canada41 views
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading... by The Digital Insurer
Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...Webinar : Desperately Seeking Transformation - Part 2:  Insights from leading...
Webinar : Desperately Seeking Transformation - Part 2: Insights from leading...
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023 by BookNet Canada
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
Redefining the book supply chain: A glimpse into the future - Tech Forum 2023
BookNet Canada44 views
PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」 by PC Cluster Consortium
PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」
PCCC23:日本AMD株式会社 テーマ2「AMD EPYC™ プロセッサーを用いたAIソリューション」
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdf by MichaelOLeary82
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdfAdopting Karpenter for Cost and Simplicity at Grafana Labs.pdf
Adopting Karpenter for Cost and Simplicity at Grafana Labs.pdf
MichaelOLeary8213 views
This talk was not generated with ChatGPT: how AI is changing science by Elena Simperl
This talk was not generated with ChatGPT: how AI is changing scienceThis talk was not generated with ChatGPT: how AI is changing science
This talk was not generated with ChatGPT: how AI is changing science
Elena Simperl32 views
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue199 views
What is Authentication Active Directory_.pptx by HeenaMehta35
What is Authentication Active Directory_.pptxWhat is Authentication Active Directory_.pptx
What is Authentication Active Directory_.pptx
HeenaMehta3515 views
PCCC23:日本AMD株式会社 テーマ1「AMD Instinct™ アクセラレーターの概要」 by PC Cluster Consortium
PCCC23:日本AMD株式会社 テーマ1「AMD Instinct™ アクセラレーターの概要」PCCC23:日本AMD株式会社 テーマ1「AMD Instinct™ アクセラレーターの概要」
PCCC23:日本AMD株式会社 テーマ1「AMD Instinct™ アクセラレーターの概要」
Business Analyst Series 2023 - Week 4 Session 8 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 8Business Analyst Series 2023 -  Week 4 Session 8
Business Analyst Series 2023 - Week 4 Session 8
DianaGray10145 views
The Power of Generative AI in Accelerating No Code Adoption.pdf by Saeed Al Dhaheri
The Power of Generative AI in Accelerating No Code Adoption.pdfThe Power of Generative AI in Accelerating No Code Adoption.pdf
The Power of Generative AI in Accelerating No Code Adoption.pdf
Saeed Al Dhaheri39 views
Business Analyst Series 2023 - Week 4 Session 7 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 7Business Analyst Series 2023 -  Week 4 Session 7
Business Analyst Series 2023 - Week 4 Session 7
DianaGray10146 views
GDSC GLAU Info Session.pptx by gauriverrma4
GDSC GLAU Info Session.pptxGDSC GLAU Info Session.pptx
GDSC GLAU Info Session.pptx
gauriverrma415 views
Cocktail of Environments. How to Mix Test and Development Environments and St... by Aleksandr Tarasov
Cocktail of Environments. How to Mix Test and Development Environments and St...Cocktail of Environments. How to Mix Test and Development Environments and St...
Cocktail of Environments. How to Mix Test and Development Environments and St...

Getting sh*t done with Azure Functions (on AKS!)

  • 2. Getting sh*t done with Azure Functions (on AKS!)
  • 3. Who’s who? Daniël te Winkel Rick van den Bosch
  • 4. Agenda • Introduction • Hosting platforms • Triggers & Bindings • Dependency Injection • Managed Identities • Azure Functions on AKS
  • 6. Azure Functions “Accelerate your development with an event-driven, serverless compute experience. Scale on demand and pay only for the resources you consume.”
  • 7. Azure Functions • Accelerate & simplify development with Serverless compute • Improve your end-to-end development experience • Simplify complex orchestration challenges resolution • Connect other services without hard-coding integrations for faster solutions development • Choose the best hosting option for your application • Develop your way
  • 10. Consumption plan • The default hosting plan • Pay only when your Functions are running • Scale out automatically • Billing is based on # of executions, execution time, and memory used • GB-s: average memory size in gigabytes * execution time in ms • Free grant: 1 million executions, 400.000 GB-s
  • 11. App Service plan • Consider if you want to • Take advantage of existing, underutilized VMs • Provide a custom image to run Functions on • Enable Always On • Runtime goes idle after a few minutes • Only HTTP triggers “wake up” the Functions
  • 12. Premium plan • Consider if you want to • Run function apps continuously, or nearly continuously • Have more CPU or memory options than what is provided by the Consumption plan • Run your code longer than the max. on the Consumption plan • Have features that are only available on a Premium plan (VNET/VPN) • Billing is based on the number of vCPU-s and GB-s
  • 14. Premium plan – Features • Perpetually warm instances to avoid any cold start • VNet connectivity • Unlimited execution duration • Premium instance sizes (one core, two core, and four core instances) • More predictable pricing • High-density app allocation for plans with multiple function apps
  • 15. Premium plan – Pre-warmed instances
  • 16. Hosting Platforms AKS / Kubernetes / Docker
  • 17. What is Kubernetes / AKS? • Docker: Create, deploy and run applications in Containers • Kubernetes (k8s): open source container orchestration engine for automating deployment, scaling, and management of containerized applications (e.g. Docker containers) • Azure Kubernetes Service (AKS): Managed Kubernetes in Azure 17
  • 19. Deployments • Manages lifecycle of app • Across nodes 19
  • 20. Pods • Unit of Deployment • One or a few Containers • Persistent volumes 20
  • 21. Azure functions in AKS • Add serverless capabilities with Virtual Nodes • Scale Event driven applications with KEDA (preview) • Scale HTTP driven applications with Osiris (experimental) • Managed identity with AAD Pod Identity 21
  • 22. Azure Functions in Kubernetes The good news: • Easy to write and small pieces of code • Triggers and bindings • Portable between all hosting options The not-so-good news: • You lose most of what you are used to with Azure Functions in the portal 22
  • 23. Azure Functions in Kubernetes – Pitfalls • Scaling, without KEDA, does not work as expected • Host ID different per Pod • Poor fix by setting: AzureFunctionsWebHost:hostId 23
  • 25. Triggers & Bindings • Triggers • cause a function to run • function must have exactly one trigger • have associated data, which is often provided as the payload of the function • Bindings • way of declaratively connecting another resource to the function • may be connected as input bindings, output bindings, or both • provide their data to the function as parameters
  • 27. Dual abstraction • Azure Functions abstract away the infrastructure • Triggers & Bindings abstract away the resources you interact with
  • 28. Triggers • Example: • Blob Trigger on a Consumption plan • Up to 10 minute delay Solution: • Switch to App Service plan with Always On enabled. • Use Event Grid trigger with your Blob storage account.
  • 29. DEMO
  • 31. Dependency Injection • Microsoft.NET.Sdk.Functions >= 1.0.28 • Constructor injection • Same as DI in ASP.Net core • Already provided services: • Microsoft.Extensions.Configuration.IConfiguration • Microsoft.Azure.WebJobs.Host.Executors.IHostIdProvider 32
  • 32. DI – Scopes • Singleton – Created once, on first request, or when created before registration • Scoped – Created once per client request (connection / trigger) • Transient – Created on each request 33
  • 33. DI – Extension • NuGet: Microsoft.Azure.Functions.Extensions • Makes dependency registrations a bit easier • Provides IServiceCollection on IFunctionHostBuilder 34
  • 34. DI – Migrating 35 public static class Function { [FunctionName(nameof(Ping))] public static async Task<string> Ping( [HttpTrigger(AuthorizationLevel.Function, "get"] HttpRequest req, ILogger log, CancellationToken cancellationToken) { var pingService = new PingService(log); return await pingService.Ping(cancellationToken); } } public class Function { private readonly IPingService _pingService; public Function(IPingService pingService) { _pingService = pingService; } [FunctionName(nameof(Ping))] public async Task<string> Ping( [HttpTrigger(AuthorizationLevel.Function, "get")] HttpRequest req, CancellationToken cancellationToken) => await _pingService.Ping(cancellationToken); }
  • 35. DI – Registration 36 using Microsoft.Azure.Functions.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection; [assembly: FunctionsStartup(typeof(Startup))] public class Startup : FunctionsStartup { public override void Configure(IFunctionsHostBuilder builder) { builder.Services.AddScoped<IPingService, PingService>(); } }
  • 37. Managed Identities a.k.a. Managed Service Identifier
  • 38. Managed Identities for Azure resources • Provide Azure services with a managed identity in Azure AD • Use the identity to authenticate to any service (that supports Azure AD authentication)
  • 39. Supporting services “We are in the process of integrating managed identities for Azure resources and Azure AD authentication across Azure.” • Azure Resource Manager • Azure Key Vault • Azure Data Lake • Azure SQL • Azure Event Hub • Azure Service Bus • Azure Storage blobs and queues • Azure Analysis Services
  • 40. DEMO

Editor's Notes

  1. After intro: who has worked with Azure Functions? Who has worked with Kubernetes/AKS?
  2. GB-s: Gigabyte seconds Memory used by a function is measured by rounding up to the nearest 128 MB, up to the maximum memory size of 1,536 MB, With execution time calculated by rounding up to the nearest 1 ms. Minimum: 100 ms and 128 mb
  3. Also: dedicated plan
  4. Regardless of the function app timeout setting, 230 seconds is the maximum amount of time that an HTTP triggered function can take to respond to a request.
  5. Images are from a Serverless360.com blog post, and aren’t available without Jeff Hollan and Alex Karcher 🤣
  6. https://phippy.io/
  7. Images taken from Kubernetes site: https://kubernetes.io/docs/tutorials/kubernetes-basics/
  8. AAD Pod Identity
  9. E.g. manual scaling or scaling using HPA (Horizontal Pod Autoscaler)
  10. monitors the rate of events and determines whether to scale out or scale in Heuristics for each trigger type For example, when you're using an Azure Queue storage trigger, it scales based on the queue length and the age of the oldest queue message.
  11. For the first bullet: A single instance may process more than one message or request at a time though, so there isn't a set limit on number of concurrent executions.