Scaling containers with AKS and ACI

9e33a1d43a88f23f6c545c1e0f07f4b5?s=47 Nilesh Gule
September 06, 2020

Scaling containers with AKS and ACI

Slide deck from the virtual session for Dear Azure community in India. During the session, we covered the containerizing .net Core application, publish Docker images to private Azure Container Registry (ACR). These containers images are deployed to Azure Kubernetes Service cluster. Using Helm we deploy RabbitMQ and KEDA on the Kubernetes cluster. Finally, we extend the autoscaling to serverless environment with Azure Container Instances (ACI) and virtual node

The recording of the session is available on YouTube
https://youtu.be/ib-Jpfg6Iuk?WT.mc_id=DP-MVP-5003170

9e33a1d43a88f23f6c545c1e0f07f4b5?s=128

Nilesh Gule

September 06, 2020
Tweet

Transcript

  1. Nilesh Gule @nileshgule | www.HandsOnArchitect.com Scaling .Net Core Containers with

    Azure Kubernetes Service and Serverless ACI
  2. $whoami { “name” : “Nilesh Gule”, “website” : “https://www.HandsOnArchitect.com", “github”

    : “https://GitHub.com/NileshGule" “twitter” : “@nileshgule”, “linkedin” : “https://www.linkedin.com/in/nileshgule”, “likes” : “Technical Evangelism, Cricket”, “co-organizer” : “Azure Singapore UG” }
  3. None
  4. @nileshgule Containerize .Net Core App Build & publish Docker images

    to private Azure Container Registry (ACR) Autoscale using k8s K8s deployment, KEDA autoscaling, extending to serverless Azure Container Instences (ACI) Application Overview Docker Images Container Registries Kubernetes deployment Autoscaling with KEDA Serverless container with ACI Agenda
  5. None
  6. @nileshgule RabbitMQ Demo – Producer & Consumer 1000 (configurable) messages

    Batch of 50 (configurable) messages https://github.com/NileshGule/pd-tech-fest-2019
  7. @nileshgule Docker – main features Security Process isolation, resource limits

    Portability Runs across multiple env with Docker runtime Performance Smaller footprint than VM, lightning fast Multi-cloud Deploy Docker images to multi-cloud environments Isolation Isolates multiple versions of dependencies Agility Integrates into CI CD pipelines
  8. Demo build & publish docker images

  9. @nileshgule RabbitMQ Demo – Docker Images https://github.com/NileshGule/pd-tech-fest-2019  Docker multi-stage

    builds  Docker-compose, build & publish multiple images  Azure Container Registry (ACR) private registry
  10. @nileshgule RabbitMQ Demo –Docker Container Registry

  11. @nileshgule Kubernetes – main features Self healing Restart / Replace

    / kill containers based on heath checks Service discovery & LB Expose container using DNS name or IP Secrets & Config Mgt Manage sensitive info (pwd / Oauth tokens / SSH keys etc) Auto bin packing Fits containers to nodes based on resource limits Storage Orchestration Mount storage from local, public cloud oro ther sources Auto rollout & rollback Desired state configuration to manage rollouts & upgrades
  12. @nileshgule

  13. Demo deploy application containers

  14. @nileshgule RabbitMQ Demo – Kubernetes deployment https://github.com/NileshGule/pd-tech-fest-2019  Manifest files

    describe Deployment and Service  Helm charts to deploy third-party apps / services  Octant – visualize k8s cluster  Kubectl to deploy Manifest
  15. AKS Managed Identity (aksmqcluster-agentpool) nileshgule/techtalksmqproducer nileshgule/techtalksmqconsumer ngACRRegistry aksmqCluster ngacrregistry.azurecr.io/nileshgule /techtalksmqproducer

    ngacrregistry.azurecr.io/nileshgule/ techtalksmqconsumer Acr pull acrResourceGroup demo-kedaSeriesRG docker push using azure user token Acr login using AAD No need to use Admin user
  16. @nileshgule Kubernetes Scaling Options 1 2 3 Horizontal Pod Autoscaler

    Cluster Autoscaler Manual scaling
  17. KEDA Architecture

  18. Azure Event Hub Azure Service Bus Queues and Topics Azure

    Storage Queues Kafka Prometheus RabbitMQ Redis Lists Liiklus NATS AWS CloudWatch AWS Simple Queue Service GCP PubSub Integrates with Azure functions
  19. @nileshgule RabbitMQ Demo – KEDA Event driven autoscaling  RabbitMQ

    event source  KEDA autoscaler to scale consumer deployment 1000 (configurable) messages Batch of 50 (configurable) messages https://github.com/NileshGule/pd-tech-fest-2019
  20. Demo deploy KEDA on AKS cluster

  21. apiVersion: keda.k8s.io/v1alpha1 kind: ScaledObject metadata: name: rabbitmq-consumer namespace: default labels:

    deploymentName: rabbitmq-consumer-deployment spec: scaleTargetRef: deploymentName: rabbitmq-consumer pollingInterval: 5 # Optional. Default: 30 seconds cooldownPeriod: 30 # Optional. Default: 300 seconds minReplicaCount: 1 # Optional. Default: 0 maxReplicaCount: 30 # Optional. Default: 100 triggers: - type: rabbitmq metadata: queueName: hello queueLength : ‘5’ authenticationRef: name: trigger-auth-rabbitmq-host
  22. None
  23. Pros Cons

  24. Scale RabbitMQ Consumer with Virtual Node kedaVNet kedaAKSSubnet kedaVirtualNodeSubnet Producer

    - .Net Core API Consumers - .Net Core exe
  25. Demo extend KEDA with Virtual Node

  26. Summary • Self contained application with all its dependencies Docker

    • Orchestrates containers • Self healing • Service discovery • Scaling Kubernetes • Extends Kubernetes with event driven capabilities KEDA
  27. Play with Docker Play with Kubernetes Kubernetes Learning Path :

    MSLearn Linux Academy learning paths
  28. AKS cluster-autoscalar Virtual Node Horizontal pod autoscale virtual kubelet KEDA

    https://azure.microsoft.com/mediahandler/files/resourcefiles/kubernetes-learning- path/Kubernetes%20Learning%20Path%20version%201.0.pdf
  29. None
  30. Azure Kubernetes Service Workshop References

  31. https://github.com/NileshGule/pd-tech-fest-2019

  32. Thank you very much Code with Passion and Strive for

    Excellence https://www.slideshare.net/nileshgule/presentations https://speakerdeck.com/nileshgule/
  33. Nilesh Gule ARCHITECT | MICROSOFT MVP “Code with Passion and

    Strive for Excellence” nileshgule @nileshgule Nilesh Gule NileshGule www.handsonarchitect.com
  34. Q&A