Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Getting Started with Containers on Azure

Mark Heath
December 12, 2018

Getting Started with Containers on Azure

An overview of the various ways of running Docker Containers on Azure
Covers:
1) Azure Container Registry
2) Azure Container Instances
3) Azure Web App for Containers
4) Service Fabric & Service Fabric Mesh
5) Azure Kubernetes Service

Mark Heath

December 12, 2018
Tweet

More Decks by Mark Heath

Other Decks in Technology

Transcript

  1. @mark_heath Web App for Containers Service Fabric (Mesh) Azure Container

    Registry Azure Container Instances Azure Kubernetes Service
  2. @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
  3. @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
  4. @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
  5. @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
  6. @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
  7. @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
  8. @mark_heath Orchestrators • Scheduling • Health monitoring & self-healing •

    Scaling • Service discovery • Ingress • Upgrades • Resource constraints
  9. @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
  10. @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
  11. @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
  12. @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"
  13. @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)
  14. @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
  15. @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
  16. @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
  17. @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