Slide 1

Slide 1 text

@mark_heath Getting Started with Containers in Azure

Slide 2

Slide 2 text

@mark_heath About Me Pluralsight author markheath.net @mark_heath

Slide 3

Slide 3 text

@mark_heath

Slide 4

Slide 4 text

@mark_heath Why Docker? Portability Sharing Cost Savings Productivity Isolation Continuous Integration Compatibility Rapid Deployment Security

Slide 5

Slide 5 text

@mark_heath

Slide 6

Slide 6 text

@mark_heath Web App for Containers Service Fabric (Mesh) Azure Container Registry Azure Container Instances Azure Kubernetes Service

Slide 7

Slide 7 text

@mark_heath What about IaaS? • Virtual Machine Images • Docker on Ubuntu • Windows Server 2016 Datacenter – with containers • Docker for Azure CE (Docker Inc) • Virtual Machine Docker Extension • Marketplace • Docker EE for Azure • ARM Templates • github.com/Azure/azure-quickstart-templates

Slide 8

Slide 8 text

@mark_heath Azure Container Registry • Private container image hosting • Minimise download times • Geo-replication • Control access with Azure AD • Tasks • docker build with multi-stage Dockerfiles • Automate container OS and framework patching

Slide 9

Slide 9 text

@mark_heath Azure Container Instances (ACI) • The quickest and easiest way to get containers running in Azure • “Serverless” containers • No need to provision VMs • Per second pricing (based on cores and memory) • Linux and Windows containers • Restart policy - Always, never, on failure • Mount Azure file shares

Slide 10

Slide 10 text

@mark_heath Azure Container Instances # create resource group $location = "westeurope" $resourceGroup = "miniblogaci" az group create -l $location -n $resourceGroup # create container $dockerRepo = "markheath/miniblogcore:v1-linux" $containerName="miniblogcore" az container create -n $containerName --image $dockerRepo ` -g $resourceGroup --ip-address public --ports 80 # check that its working $site = az container show -n $containerName ` -g $resourceGroup --query "ipAddress.ip" -o tsv Start-Process http://$site # examine the logs az container logs -n $containerName -g $resourceGroup

Slide 11

Slide 11 text

@mark_heath Azure Web App for Containers • App Services expanded to support containers • Linux containers • Windows containers in preview • Provides (most) App Service features • Auto-scaling • Deployment slots • Custom domain name • App settings • Easy auth

Slide 12

Slide 12 text

@mark_heath Azure Web App for Containers $rg = "AzureThamesValleyAppService" az group create -l "westeurope" -n $rg # create an app service plan to host $planName="linuxappservice" az appservice plan create -n $planName -g $rg --is-linux --sku S1 # create a new webapp based on our DockerHub image $appName="ghostatv" az webapp create -n $appName -g $rg --plan $planName -i "ghost" # configure settings az webapp config appsettings set -n $appName -g $rg --settings ` WEBSITES_PORT=2368 # launch in a browser $site = az webapp show -n $appName -g $rg --query "defaultHostName" -o tsv Start-Process https://$site

Slide 13

Slide 13 text

@mark_heath Orchestrators • Scheduling • Health monitoring & self-healing • Scaling • Service discovery • Ingress • Upgrades • Resource constraints

Slide 14

Slide 14 text

@mark_heath Service Fabric • Microservices hosting platform • Powers many key Microsoft cloud services • SQL Azure, Bing, XBOX, Power BI, Cosmos DB … • Stateful services using “Reliable Collections” programming model

Slide 15

Slide 15 text

@mark_heath Service Fabric Hosting Options Bring your own infrastructure Service Fabric Standalone On-premises Any cloud Dev machine Dedicated Azure clusters Azure Service Fabric Azure Service Fabric Mesh Serverless microservices Full Control Fully managed

Slide 16

Slide 16 text

@mark_heath Service Fabric Mesh • Define your application as JSON / YAML • Services, networking configuration, persistent volumes, secrets etc • No need to pre-provision a cluster • Simply define the CPU/memory requirements of each service • …but Mesh apps can run on a regular SF cluster • Currently in preview

Slide 17

Slide 17 text

@mark_heath Service Fabric Mesh # create a resource group $resGroup = "AzureThamesValleySFMesh" az group create -n $resGroup -l "westeurope" # deploy the mesh application $templateFile = ".\sfmesh-example-voting-app.json" az mesh deployment create -g $resGroup --template-file $templateFile # get public ip address $publicIp = az mesh network show -g $resGroup -n "votingNetwork" ` --query "ingressConfig.publicIpAddress" -o tsv # get status of application az mesh app show -g $resGroup -n "votingApp"

Slide 18

Slide 18 text

@mark_heath Azure Kubernetes Service (AKS) • Azure managed Kubernetes • Automated upgrades and patching • Easy cluster scaling • Free control plane • Pay only for worker nodes • Linux containers only (Windows coming soon)

Slide 19

Slide 19 text

@mark_heath Demo Voting Application Voting web app Results web app Redis Worker service Postgres

Slide 20

Slide 20 text

@mark_heath AKS – creating a cluster # create resource group $location = "westeurope" $resourceGroup = "AKSDemo" az group create -l $location -n $resourceGroup # create AKS cluster az provider register -n Microsoft.ContainerService $clusterName = "MarkAks" az aks create -g $resourceGroup -n $clusterName --node-count 3 ` --generate-ssh-keys # configuring kubectl az aks get-credentials -g $resourceGroup -n $clusterName kubectl get nodes

Slide 21

Slide 21 text

@mark_heath AKS – deploying an app # deploy app kubectl apply -f azure-vote.yaml # discover IP address kubectl get service azure-vote-front --watch # scale az aks scale -g $resourceGroup -n $clusterName --node-count 3 kubectl scale --replicas=3 deployment/azure-vote-front kubectl get pod # run kubernetes dashboard az aks browse -g $resourceGroup -n $clusterName # upgrade kubectl set image deployment azure-vote-front ` azure-vote-front=markheath/azure-vote-front:v2

Slide 22

Slide 22 text

@mark_heath AKS Integration • Azure Monitor • Mount Azure File Shares & Disks • Secure with RBAC and AD • Virtual network integration • Elastic scale with ACI • Develop and debug with Dev Spaces

Slide 23

Slide 23 text

@mark_heath AKS vs Service Fabric Azure Service Fabric Azure Kubernetes Service Both are excellent orchestrators! Scheduling Upgrades Health monitoring Service discovery Windows Stateful services Serverless (Mesh) Open source tooling ecosystem Other clouds Virtual Kubelet Dev Spaces

Slide 24

Slide 24 text

@mark_heath More Information • https://github.com/markheath/azure-docker-talk • https://markheath.net • https://pluralsight.com/authors/mark-heath