KEMBAR78
Container Orchestration for .NET Developers | PPTX
Container Orchestration for
.NET Developers
Mike Melusky – Philly.NET
About me
• Michael Melusky (@mrjavascript)
• Lives in Harrisburg, PA
• Software Developer for Audacious Inquiry in Baltimore, MD
• College Professor (Penn State / Franklin and Marshall)
• BBQ and Lawn Care
• XBOX One
• Regular speaker at Philly.NET events (Code Camps and Monthlies)
What are we talking about tonight?
• ā€œDot Netā€
• Amazon AWS and Microsoft Azure
• Serverless Computing
• AWS Lambdas and Azure Functions
• Docker
• Kubernetes
• Container Registries (ACR and ECR)
• Containers as a Service with Amazon ECS and Microsoft AKS
Amazon v. Microsoft
• I’m not here to cheerlead for either Microsoft or Azure
• If you are tasked with the decision of migrating from a hosted region
to the cloud
• Please don’t use this talk as sole factor in your decision 
• This decision takes significant research
• Weighing pros and cons
Themes for Tonight
• Serverless Architecture
• Being able to deploy a product without having to worry about
underlying infrastructure
• Portability
• If you ever need to migrate from Amazon to Microsoft or vice versa…
• How difficult will that be?
Dot Net
Dot Net
• I spoke here (at Code Camp) back in November
• Showcased containerization of numerous technologies (Java, Python
et al.)
• Focusing solely on ā€œDot Netā€ this evening
• What is Dot Net?
Dot Net
• Software Framework from Microsoft
• You can use it for building any type of app
• Mobile, Web (MVC), Micro-Service
• Two flavors:
• .NET Framework
• .NET Core
• What is the difference between each?
.NET Framework
• Framework from Microsoft
• Runs primarily on Windows systems
• Does not run on Linux
• Latest version is 4.8 (April 2019)
• Does not support C# 8.0
.NET Core
• Framework from Microsoft
• Cross-platform (can run on Windows, Linux and Mac
OSX)
• Current version is 3.1
• C# 8.0 is supported!
.NET
Standard
• .NET Standard is a set of APIs that all .NET platforms must implement
Why .NET Core?
• We are focusing on .NET Core tonight
• Main advantage: cross-platform!
• Let’s look at a .NET Core MVC app
• ** DEMO **
Deploying .NET Core
Applications
Traditional
ā€œWeb Deployā€
• Traditionally we can deploy a .NET
Core application to IIS server
• Right click on project and ā€œdeployā€
• How else can we deploy?
• Where can we deploy to?
Cloud Providers
Cloud Providers
• Tonight we’re going to look at two cloud providers
• Amazon and Microsoft
• Amazon AWS
• Microsoft Azure
Amazon AWS
• On-demand cloud computing platform
• Servers in 22 geographic regions
• 60+ managed services
• Managed services such as services for
queueing, relational database services,
caching
• Two managed services we are
interested in for tonight:
• AWS Lambdas
• Containerization Services
Microsoft Azure
• Cloud computing platform
• Servers available in 52 geographic
regions
• Multiple managed services very similar
to AWS
• Such as Cosmos DB, Azure Cache, Azure
Search, et al
• Of note for tonight:
• Azure Functions
• Azure Container Services
Functions
Functions
• Relate an input to an output
• Examples:
• X^2 (squaring)
• X^3 + 1
• Trigonometric functions (sin, cos, tan)
How does this relate to Azure and AWS?
• Both cloud providers offers ā€œfunctionsā€
• Allows you to run a ā€œquick piece of codeā€ on Microsoft/Amazon’s
hardware
• Azure Functions: runtime cannot exceed 5 minutes
• AWS Lambdas: runtime cannot exceed 15 minutes
• Let’s look at both providers
Example Function
• Let’s look at a sample function
• Calculate area of a circle
Creating Azure Function
• Let’s implement the previous
example with an Azure Function
• Can write the function in a variety
of languages
• Let’s use .NET Core
• Install ā€œAzure Developmentā€
option with Visual Studio
• ** DEMO **
Creating AWS Lambda
• Now let’s do the same with AWS!
• Like Azure, many languages are supported (Java, Python, etc.)
• Like before, let’s use .NET Core
• The Visual Studio project templates come from AWS Toolkit for Visual
Studio: https://aws.amazon.com/visualstudio/
• ** DEMO **
Compare and Contrast
What’s the difference between the two?
• We implemented the same function for different cloud providers
• Both are .NET Core implementations
• Looking at the code can the AWS Lambda run in Azure Functions?
• And vice versa?
Functions in Cloud Providers
• Functions/Lambdas are provider dependent
• Hypothetically consider the case of an AWS customer
• With 100+ Lambdas
• Requirement to migrate the cloud infrastructure to Azure
• How will the lambdas transfer?
• (Spoiler alert: rewrite)
ā€œFunctions as a Serviceā€ (FaaS)
• Both AWS Lambdas and Azure Functions fall under the ā€œFunctions as
a Serviceā€ model (FaaS)
• Developers simply write the code and run the application
• Don’t have to worry about the infrastructure management
Acronyms
• IaaS – Infrastructure as a Service
• Caas – Containers as a Service
• PaaS – Platform as a Service
• FaaS – Functions as a Service
Serverless Architecture
• Cloud provider runs the server
• Customer pays for the resources that are consumed
Benefits of Serverless Computing
• As a developer (that’s you), don’t need to worry about the following:
• Security updates
• Anti-virus software
• Operating System Updates
• Hardware Upgrades
• You simply write, deploy and run code!
Serverless Computing
• Since we identified that the servers are managed by the cloud
provider
• What do we know about the underlying infrastructure?
• Mostly abstracted, but we can assume:
• Linux!
• (Azure has Windows in Preview discussion coming soon)
Linux
• Since these host servers run Linux,
the code we write needs to run on
this operating system
• Main reason why we want .NET
Core!
• .NET Core is cross platform
(Windows, Mac OSX, Linux)
• You can’t write AWS Lambdas
using .NET Framework 4.8
TL;DR; version
• As developers, we like Serverless Computing
• If we’re working with .NET Core deployment is a breeze
• Only downside so far?
• Lambdas and platforms are provider dependent
• Is there a solution where we have serverless benefits but also cloud
provider independence?
Before we get to Docker…
Azure Service Fabric
• Platform as a Service (PaaS) from
Microsoft
• Allows you to build and deploy
micro-services with ease
• Runs in containers
• Facilitates solutions for
communication between micro-
services
• Also facilitates container
orchestration
Building a Backend
• Choice for building a backend API for front end apps
• Technically you can run your backend API in AWS Lambda
• Not necessarily purpose of Lambda, meant for quick, serverless code
invocations
• Can use Azure Service Fabric for the backend
• Main downside of Azure Service Fabric?
• You are locked in with Azure
• Is there a portable alternative?
Docker
Docker
• Docker is software which provides
the concept of application
containerization
• Uses OS virtualization under the
hood
Containerization?
• A technique which allows you to deploy distributed applications
without launching a virtual machine for each app!
• Each application (or instance of the application) is isolated from each
other
• All code and resources and configuration needed to run the
application is part of the container
• Containers differ from virtual machines
Virtual Machines vs. Containers
Docker
• Can install the Docker Engine from Docker Hub
• Docker Desktop is available for Mac OSX and Windows
• With Docker for Windows, Windows 10 Professional is required
• Virtualization is needed
Docker Images
Docker Images
• Docker Containers are instances of Docker Images
• So for us to run our applications in the Docker Engine, we will need to
build a Docker Image (coming soon)
• For now let’s look at the Docker Command Line Interface (CLI)
• As well as some common commands
ā€œdocker imagesā€
• Will show all ā€œtop levelā€ images
• Included in response is the tag, the size, creation date
ā€œdocker psā€
• Lists all running containers
• If you want to see all containers (e.g. stopped containers)
• docker ps –a
Running a Docker Image
• docker run
• Allows you to run container using an image
• docker stop
• Allows you to stop a particular container
Building Docker Images
Building the .NET Core Image
• To run the .NET Core application
in Docker we need to build an
image to run on the Docker
engine
• For building images, we are
required to provide a Dockerfile
Dockerfile
• A Dockerfile is a file that lists instructions needed for building a image
• Based off a source image
• You can run OS commands in the Dockerfile as well (move, copy, et
al.)
• You can also expose any port numbers your application uses
Dockerfile ports
• Generally for web applications we expose either 80 or 8080
• We can also expose the secure ports if we want as well (443 and
8443)
• Docker allows you to port forward from a source port
• For instance if you want to expose 5050 as your external port and
route to the internal (exposed) port 80, Docker allows this
• Incredibly useful for cloud providers where AWS/Azure will assign
these ports dynamically at runtime
Dockerfile and .NET Core
• Let’s build our application for Docker
• That is produce an image using a Dockerfile
• And then run the image on the Docker engine
• ** DEMO **
Docker and .NET
Docker and .NET
• With the Docker image we just build, we build for .NET Core
• With this .NET Core image, the image can run on any host operating
system (Windows, Linux, et al.)
• What about .NET Framework (4.X)?
• Yes, you can containerize a .NET Framework application!
• However this image can only run on Docker Engine on Microsoft
Windows hosts
Cloud Providers and
Containers
Containers as a Service (CaaS)
• We saw Functions as a Service earlier tonight
• Do cloud providers have the same ability except being able to run
Docker containers on demand?
• Yes!
Kubernetes
Kubernetes (K8S)
• Open-source container
orchestration software
• Will monitor the health of the
containers
• If a container dies, Kubernetes will
restart the container
Kubernetes
• Used in many applications
• For instance, Red Hat’s OpenShift platform is based on Kubernetes
• The Telcom industry uses it for cable management and routing!
• Both Microsoft and Amazon offer managed services for Kubernetes
clusters
• Amazon offers EKS (Elastic Kubernetes Service)
• Azure offers AKS (Azure Kubernetes Service)
Wait…
• The Meetup.com description for this event
• Listed ā€œNo Kubernetes Required!ā€
• Unfortunately, we will be using some K8 tonight
• At least with Azure
Containers as a Service
(CaaS)
Containers as a Service (CaaS)
• Both Amazon and Microsoft offer the managed service for running
your containers
• Both Microsoft and Amazon offer two different managed services for
each
• One managed service is based on proprietary technology
• The other managed service is based on K8
• Let’s look in the console for each
• ** DEMO **
Containers and Cloud Providers
Provider Managed Service Service Type Notes
Amazon
Elastic Container
Service (ECS)
Proprietary
Elastic Kubernetes
Service (EKS)
Kubernetes
Microsoft
Azure Container
Service (ACS)
Proprietary End of life
1/31/2020
Azure Kubernetes
Service (AKS)
Kubernetes
About Me
• I personally use AWS for both full time job and side projects
• ECS is used actively in each
• When preparing this session, I emailed a Microsoft Developer
• I was able to contact someone on the Azure Product Team
• Azure team member was confused about this presentation, and told
me to learn Kubernetes
• Microsoft is sunsetting (end of month) Azure Container Services (ACS)
and is mandating customers migrate to Azure Kubernetes Services
(AKS)
Amazon and ECS
• What I also found out from this exchange
• Amazon considers ECS a legacy product
• Eventually customers will presumably need to migrate to EKS
• If Microsoft’s decision is any predictor of future events
Plan for Remainder of
Tonight
Plan for Tonight
• Originally was planning to show both ECS and ACS
• Technically I can still demonstrate ACS since it’s available for one
more week
• But there would be more value doing the same demonstration using
AKS
Amazon AWS - ECS
• Proprietary solution from Amazon to
dynamically run and orchestrate
Docker containers
• You can specify how many instances
of the application you want to run
• ECS will automatically scale up and
down the instances based on load
• Make sure your code can run in
parallel and be careful about mutual
exclusion and locking!
Amazon AWS ECS
• For running Docker images in the cloud
• Amazon needs to be able to pull your image from a repository
• You have a few options
• If your image is public, you can simply push to Docker Hub
• However most code is proprietary, and the general public shouldn’t
be allowed to pull the image
Amazon ECR
Amazon ECR
• Elastic Container Registry
• Managed service from Amazon to
store Docker images (as well as
their tags)
• Microsoft offers a similar
managed service
• Azure Container Registry (ACR)
Pushing to container registry
• To push to ECR
• (1) Build the image (using docker build)
• (2) Obtain credentials from Amazon (with docker login command)
• (3) Optionally tag the image (otherwise latest is default tag)
• (4) Push the Image to ECR (or ACR) using docker push
• ** DEMO **
Deployment with ECS
Amazon ECS tasks
• With ECS, each instance of the Docker image is based off an ECS Task
• An ECS task specifies:
• Which Docker image is used
• How much memory each instance
• How much vCPU should be allocated
• Let’s create our ECS task for the .NET Core application
• ** DEMO **
AWS Fargate
Running the task in ECS
• With our ECS task created, now we can create the service in ECS
• When we do this, we need to specify the Docker Engine the task will
run against
• Amazon gives you two options
• Docker Engine on an EC2 instance you provide (virtual machine)
• AWS Fargate (serverless!)
AWS Fargate
• Serverless approach for running Docker
images
• Containers run on Amazon’s underlying
Docker Engine
• Under the hood: LINUX
• With regards to .NET, .NET Core will work
with Fargate since it’s cross platform
• .NET Framework 4.8 WILL NOT WORK with
Fargate since that requires Windows
Docker Engine
• You can use ECS with .NET Framework but a
backing Windows EC2 instance is needed!
AWS Fargate
• Let’s create a service now in ECS for our task
• And run our .NET Core application in AWS Fargate
• ** DEMO **
Let’s Do the Same With
Azure!
Similarities to AWS
• As mentioned earlier, Microsoft is ending Azure Container Services
(ACS)
• We need to spin up a Kubernetes cluster in AKS
• There are some similar steps however
• Let’s push our Docker image to Azure Container Registry (ACR)
• Let’s then deploy our image into AKS (using their serverless runtime
called Azure Container Instances or ACI)
• ** DEMO **
Wrapping Up
Serverless Matrix
Provider Managed Service Type Host OS Notes
Amazon
AWS Lambda FaaS Linux
ECS/EKS Fargate CaaS Linux Fargate support for
EKS added 12/2019
Microsoft
Azure Functions FaaS Linux
AKS with Container
Instances
CaaS Linux and Windows Windows is in
Preview
Next Steps for Me
• Since I use AWS
• Spin up EKS cluster for personal micro-services
• Test and eventually cut over from ECS
• But will bite the bullet and learn Kubernetes
Learning K8 on Azure
• Kubernetes Learning Path 2.0:
• https://azure.microsoft.com/en-us/resources/kubernetes-learning-
path/
Thank you for coming
Thank you for Coming
• Visual Studio Solution (code) is on Github
• https://github.com/mrjavascript/phillynet_jan2020
• Slides on SlideShare
• @mrjavascript

Container Orchestration for .NET Developers

  • 1.
    Container Orchestration for .NETDevelopers Mike Melusky – Philly.NET
  • 2.
    About me • MichaelMelusky (@mrjavascript) • Lives in Harrisburg, PA • Software Developer for Audacious Inquiry in Baltimore, MD • College Professor (Penn State / Franklin and Marshall) • BBQ and Lawn Care • XBOX One • Regular speaker at Philly.NET events (Code Camps and Monthlies)
  • 3.
    What are wetalking about tonight? • ā€œDot Netā€ • Amazon AWS and Microsoft Azure • Serverless Computing • AWS Lambdas and Azure Functions • Docker • Kubernetes • Container Registries (ACR and ECR) • Containers as a Service with Amazon ECS and Microsoft AKS
  • 4.
    Amazon v. Microsoft •I’m not here to cheerlead for either Microsoft or Azure • If you are tasked with the decision of migrating from a hosted region to the cloud • Please don’t use this talk as sole factor in your decision  • This decision takes significant research • Weighing pros and cons
  • 5.
    Themes for Tonight •Serverless Architecture • Being able to deploy a product without having to worry about underlying infrastructure • Portability • If you ever need to migrate from Amazon to Microsoft or vice versa… • How difficult will that be?
  • 6.
  • 7.
    Dot Net • Ispoke here (at Code Camp) back in November • Showcased containerization of numerous technologies (Java, Python et al.) • Focusing solely on ā€œDot Netā€ this evening • What is Dot Net?
  • 8.
    Dot Net • SoftwareFramework from Microsoft • You can use it for building any type of app • Mobile, Web (MVC), Micro-Service • Two flavors: • .NET Framework • .NET Core • What is the difference between each?
  • 9.
    .NET Framework • Frameworkfrom Microsoft • Runs primarily on Windows systems • Does not run on Linux • Latest version is 4.8 (April 2019) • Does not support C# 8.0
  • 10.
    .NET Core • Frameworkfrom Microsoft • Cross-platform (can run on Windows, Linux and Mac OSX) • Current version is 3.1 • C# 8.0 is supported!
  • 11.
    .NET Standard • .NET Standardis a set of APIs that all .NET platforms must implement
  • 12.
    Why .NET Core? •We are focusing on .NET Core tonight • Main advantage: cross-platform! • Let’s look at a .NET Core MVC app • ** DEMO **
  • 13.
  • 14.
    Traditional ā€œWeb Deployā€ • Traditionallywe can deploy a .NET Core application to IIS server • Right click on project and ā€œdeployā€ • How else can we deploy? • Where can we deploy to?
  • 15.
  • 16.
    Cloud Providers • Tonightwe’re going to look at two cloud providers • Amazon and Microsoft • Amazon AWS • Microsoft Azure
  • 17.
    Amazon AWS • On-demandcloud computing platform • Servers in 22 geographic regions • 60+ managed services • Managed services such as services for queueing, relational database services, caching • Two managed services we are interested in for tonight: • AWS Lambdas • Containerization Services
  • 18.
    Microsoft Azure • Cloudcomputing platform • Servers available in 52 geographic regions • Multiple managed services very similar to AWS • Such as Cosmos DB, Azure Cache, Azure Search, et al • Of note for tonight: • Azure Functions • Azure Container Services
  • 19.
  • 20.
    Functions • Relate aninput to an output • Examples: • X^2 (squaring) • X^3 + 1 • Trigonometric functions (sin, cos, tan)
  • 21.
    How does thisrelate to Azure and AWS? • Both cloud providers offers ā€œfunctionsā€ • Allows you to run a ā€œquick piece of codeā€ on Microsoft/Amazon’s hardware • Azure Functions: runtime cannot exceed 5 minutes • AWS Lambdas: runtime cannot exceed 15 minutes • Let’s look at both providers
  • 22.
    Example Function • Let’slook at a sample function • Calculate area of a circle
  • 23.
    Creating Azure Function •Let’s implement the previous example with an Azure Function • Can write the function in a variety of languages • Let’s use .NET Core • Install ā€œAzure Developmentā€ option with Visual Studio • ** DEMO **
  • 24.
    Creating AWS Lambda •Now let’s do the same with AWS! • Like Azure, many languages are supported (Java, Python, etc.) • Like before, let’s use .NET Core • The Visual Studio project templates come from AWS Toolkit for Visual Studio: https://aws.amazon.com/visualstudio/ • ** DEMO **
  • 25.
  • 26.
    What’s the differencebetween the two? • We implemented the same function for different cloud providers • Both are .NET Core implementations • Looking at the code can the AWS Lambda run in Azure Functions? • And vice versa?
  • 27.
    Functions in CloudProviders • Functions/Lambdas are provider dependent • Hypothetically consider the case of an AWS customer • With 100+ Lambdas • Requirement to migrate the cloud infrastructure to Azure • How will the lambdas transfer? • (Spoiler alert: rewrite)
  • 28.
    ā€œFunctions as aServiceā€ (FaaS) • Both AWS Lambdas and Azure Functions fall under the ā€œFunctions as a Serviceā€ model (FaaS) • Developers simply write the code and run the application • Don’t have to worry about the infrastructure management
  • 29.
    Acronyms • IaaS –Infrastructure as a Service • Caas – Containers as a Service • PaaS – Platform as a Service • FaaS – Functions as a Service
  • 30.
    Serverless Architecture • Cloudprovider runs the server • Customer pays for the resources that are consumed
  • 31.
    Benefits of ServerlessComputing • As a developer (that’s you), don’t need to worry about the following: • Security updates • Anti-virus software • Operating System Updates • Hardware Upgrades • You simply write, deploy and run code!
  • 32.
    Serverless Computing • Sincewe identified that the servers are managed by the cloud provider • What do we know about the underlying infrastructure? • Mostly abstracted, but we can assume: • Linux! • (Azure has Windows in Preview discussion coming soon)
  • 33.
    Linux • Since thesehost servers run Linux, the code we write needs to run on this operating system • Main reason why we want .NET Core! • .NET Core is cross platform (Windows, Mac OSX, Linux) • You can’t write AWS Lambdas using .NET Framework 4.8
  • 34.
    TL;DR; version • Asdevelopers, we like Serverless Computing • If we’re working with .NET Core deployment is a breeze • Only downside so far? • Lambdas and platforms are provider dependent • Is there a solution where we have serverless benefits but also cloud provider independence?
  • 35.
    Before we getto Docker…
  • 36.
    Azure Service Fabric •Platform as a Service (PaaS) from Microsoft • Allows you to build and deploy micro-services with ease • Runs in containers • Facilitates solutions for communication between micro- services • Also facilitates container orchestration
  • 37.
    Building a Backend •Choice for building a backend API for front end apps • Technically you can run your backend API in AWS Lambda • Not necessarily purpose of Lambda, meant for quick, serverless code invocations • Can use Azure Service Fabric for the backend • Main downside of Azure Service Fabric? • You are locked in with Azure • Is there a portable alternative?
  • 38.
  • 39.
    Docker • Docker issoftware which provides the concept of application containerization • Uses OS virtualization under the hood
  • 40.
    Containerization? • A techniquewhich allows you to deploy distributed applications without launching a virtual machine for each app! • Each application (or instance of the application) is isolated from each other • All code and resources and configuration needed to run the application is part of the container • Containers differ from virtual machines
  • 41.
  • 42.
    Docker • Can installthe Docker Engine from Docker Hub • Docker Desktop is available for Mac OSX and Windows • With Docker for Windows, Windows 10 Professional is required • Virtualization is needed
  • 43.
  • 44.
    Docker Images • DockerContainers are instances of Docker Images • So for us to run our applications in the Docker Engine, we will need to build a Docker Image (coming soon) • For now let’s look at the Docker Command Line Interface (CLI) • As well as some common commands
  • 45.
    ā€œdocker imagesā€ • Willshow all ā€œtop levelā€ images • Included in response is the tag, the size, creation date
  • 46.
    ā€œdocker psā€ • Listsall running containers • If you want to see all containers (e.g. stopped containers) • docker ps –a
  • 47.
    Running a DockerImage • docker run • Allows you to run container using an image • docker stop • Allows you to stop a particular container
  • 48.
  • 49.
    Building the .NETCore Image • To run the .NET Core application in Docker we need to build an image to run on the Docker engine • For building images, we are required to provide a Dockerfile
  • 50.
    Dockerfile • A Dockerfileis a file that lists instructions needed for building a image • Based off a source image • You can run OS commands in the Dockerfile as well (move, copy, et al.) • You can also expose any port numbers your application uses
  • 51.
    Dockerfile ports • Generallyfor web applications we expose either 80 or 8080 • We can also expose the secure ports if we want as well (443 and 8443) • Docker allows you to port forward from a source port • For instance if you want to expose 5050 as your external port and route to the internal (exposed) port 80, Docker allows this • Incredibly useful for cloud providers where AWS/Azure will assign these ports dynamically at runtime
  • 52.
    Dockerfile and .NETCore • Let’s build our application for Docker • That is produce an image using a Dockerfile • And then run the image on the Docker engine • ** DEMO **
  • 53.
  • 54.
    Docker and .NET •With the Docker image we just build, we build for .NET Core • With this .NET Core image, the image can run on any host operating system (Windows, Linux, et al.) • What about .NET Framework (4.X)? • Yes, you can containerize a .NET Framework application! • However this image can only run on Docker Engine on Microsoft Windows hosts
  • 55.
  • 56.
    Containers as aService (CaaS) • We saw Functions as a Service earlier tonight • Do cloud providers have the same ability except being able to run Docker containers on demand? • Yes!
  • 57.
  • 58.
    Kubernetes (K8S) • Open-sourcecontainer orchestration software • Will monitor the health of the containers • If a container dies, Kubernetes will restart the container
  • 59.
    Kubernetes • Used inmany applications • For instance, Red Hat’s OpenShift platform is based on Kubernetes • The Telcom industry uses it for cable management and routing! • Both Microsoft and Amazon offer managed services for Kubernetes clusters • Amazon offers EKS (Elastic Kubernetes Service) • Azure offers AKS (Azure Kubernetes Service)
  • 60.
    Wait… • The Meetup.comdescription for this event • Listed ā€œNo Kubernetes Required!ā€ • Unfortunately, we will be using some K8 tonight • At least with Azure
  • 61.
    Containers as aService (CaaS)
  • 62.
    Containers as aService (CaaS) • Both Amazon and Microsoft offer the managed service for running your containers • Both Microsoft and Amazon offer two different managed services for each • One managed service is based on proprietary technology • The other managed service is based on K8 • Let’s look in the console for each • ** DEMO **
  • 63.
    Containers and CloudProviders Provider Managed Service Service Type Notes Amazon Elastic Container Service (ECS) Proprietary Elastic Kubernetes Service (EKS) Kubernetes Microsoft Azure Container Service (ACS) Proprietary End of life 1/31/2020 Azure Kubernetes Service (AKS) Kubernetes
  • 64.
    About Me • Ipersonally use AWS for both full time job and side projects • ECS is used actively in each • When preparing this session, I emailed a Microsoft Developer • I was able to contact someone on the Azure Product Team • Azure team member was confused about this presentation, and told me to learn Kubernetes • Microsoft is sunsetting (end of month) Azure Container Services (ACS) and is mandating customers migrate to Azure Kubernetes Services (AKS)
  • 65.
    Amazon and ECS •What I also found out from this exchange • Amazon considers ECS a legacy product • Eventually customers will presumably need to migrate to EKS • If Microsoft’s decision is any predictor of future events
  • 66.
  • 67.
    Plan for Tonight •Originally was planning to show both ECS and ACS • Technically I can still demonstrate ACS since it’s available for one more week • But there would be more value doing the same demonstration using AKS
  • 68.
    Amazon AWS -ECS • Proprietary solution from Amazon to dynamically run and orchestrate Docker containers • You can specify how many instances of the application you want to run • ECS will automatically scale up and down the instances based on load • Make sure your code can run in parallel and be careful about mutual exclusion and locking!
  • 69.
    Amazon AWS ECS •For running Docker images in the cloud • Amazon needs to be able to pull your image from a repository • You have a few options • If your image is public, you can simply push to Docker Hub • However most code is proprietary, and the general public shouldn’t be allowed to pull the image
  • 70.
  • 71.
    Amazon ECR • ElasticContainer Registry • Managed service from Amazon to store Docker images (as well as their tags) • Microsoft offers a similar managed service • Azure Container Registry (ACR)
  • 72.
    Pushing to containerregistry • To push to ECR • (1) Build the image (using docker build) • (2) Obtain credentials from Amazon (with docker login command) • (3) Optionally tag the image (otherwise latest is default tag) • (4) Push the Image to ECR (or ACR) using docker push • ** DEMO **
  • 73.
  • 74.
    Amazon ECS tasks •With ECS, each instance of the Docker image is based off an ECS Task • An ECS task specifies: • Which Docker image is used • How much memory each instance • How much vCPU should be allocated • Let’s create our ECS task for the .NET Core application • ** DEMO **
  • 75.
  • 76.
    Running the taskin ECS • With our ECS task created, now we can create the service in ECS • When we do this, we need to specify the Docker Engine the task will run against • Amazon gives you two options • Docker Engine on an EC2 instance you provide (virtual machine) • AWS Fargate (serverless!)
  • 77.
    AWS Fargate • Serverlessapproach for running Docker images • Containers run on Amazon’s underlying Docker Engine • Under the hood: LINUX • With regards to .NET, .NET Core will work with Fargate since it’s cross platform • .NET Framework 4.8 WILL NOT WORK with Fargate since that requires Windows Docker Engine • You can use ECS with .NET Framework but a backing Windows EC2 instance is needed!
  • 78.
    AWS Fargate • Let’screate a service now in ECS for our task • And run our .NET Core application in AWS Fargate • ** DEMO **
  • 79.
    Let’s Do theSame With Azure!
  • 80.
    Similarities to AWS •As mentioned earlier, Microsoft is ending Azure Container Services (ACS) • We need to spin up a Kubernetes cluster in AKS • There are some similar steps however • Let’s push our Docker image to Azure Container Registry (ACR) • Let’s then deploy our image into AKS (using their serverless runtime called Azure Container Instances or ACI) • ** DEMO **
  • 81.
  • 82.
    Serverless Matrix Provider ManagedService Type Host OS Notes Amazon AWS Lambda FaaS Linux ECS/EKS Fargate CaaS Linux Fargate support for EKS added 12/2019 Microsoft Azure Functions FaaS Linux AKS with Container Instances CaaS Linux and Windows Windows is in Preview
  • 83.
    Next Steps forMe • Since I use AWS • Spin up EKS cluster for personal micro-services • Test and eventually cut over from ECS • But will bite the bullet and learn Kubernetes
  • 84.
    Learning K8 onAzure • Kubernetes Learning Path 2.0: • https://azure.microsoft.com/en-us/resources/kubernetes-learning- path/
  • 85.
  • 86.
    Thank you forComing • Visual Studio Solution (code) is on Github • https://github.com/mrjavascript/phillynet_jan2020 • Slides on SlideShare • @mrjavascript