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

.NET Day 2022 - Kubernetes in Azure for .NET De...

dotnetday
February 27, 2023

.NET Day 2022 - Kubernetes in Azure for .NET Developers - Zero to Hero

dotnetday

February 27, 2023
Tweet

More Decks by dotnetday

Other Decks in Technology

Transcript

  1. Who am I? @AnnieTalvasto Sr. Product Marketing Mgr at Camunda

    oCNCF Ambassador oAzure MVP oKubernetes & CNCF meetup co-organizer oStartup-coach oCo-host of Cloudgossip podcast - cloudgossip.net @annietalvasto 3 @annietalvasto 3 @AnnieTalvasto
  2. What value do you get by attending this talk? oLearn

    Kubernetes in the cloud @annietalvasto 4 @annietalvasto 4 @AnnieTalvasto
  3. Impact of cloud native oKubernetes has crossed the adoption chasm

    to become a mainstream global technology. oAccording to CNCF9s respondents, 96% of organizations are either using or evaluating Kubernetes 3 a record high since the surveys began in 2016. oCNCF 2021 Survey @annietalvasto 5 @annietalvasto 5 @annietalvasto 5 @annietalvasto 5 @AnnieTalvasto
  4. Agenda: oContainers & Kubernetes oKubernetes services in Azure oHow to

    use AKS oDeploying a .NET app to Kubernetes oNext steps in Kubernetes o Helm o Linkerd o Keda oResources @annietalvasto 8 @annietalvasto 8 @annietalvasto 8 @AnnieTalvasto
  5. @annietalvasto 11 @annietalvasto 11 @annietalvasto 11 @AnnieTalvasto oDocker is an

    open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly.
  6. On-premises Cloud Anywhere Monolith Microservice Any app .Net Java Python

    Node Any language Linux Windows Any OS The benefits of using containers
  7. @annietalvasto 13 @annietalvasto 13 @annietalvasto 13 @AnnieTalvasto oKubernetes, also known

    as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications.
  8. Azure Kubernetes Service (AKS) Simplify the deployment, management, and operations

    of Kubernetes Deploy and manage Kubernetes with ease Scale and run applications with confidence Secure your Kubernetes environment Accelerate containerized application development Work how you want with open-source tools & APIs Set up CI/CD in a few clicks
  9. Increase agility with containers on demand Secure applications with hypervisor

    isolation Run containers without managing servers Azure Container Instances (ACI) Easily run containers on Azure without managing servers
  10. Azure Kubernetes Service (AKS) Deploy a Kubernetes cluster in Azure:

    Create a resource group: az group create Create AKS cluster : az aks create Connect to cluster az aks get-credentials Run the application! @annietalvasto 29 @annietalvasto 29 @annietalvasto 29 @AnnieTalvasto
  11. Azure Kubernetes Service (AKS) How to scale a cluster? To

    see the number and state of pods: kubectl get pods To manually change: kubectl scale --replicas=5 deployment/azure-vote-front Verify with: kubectl get pods Automation: use cluster autoscaler! @annietalvasto 30 @annietalvasto 30 @annietalvasto 30 @AnnieTalvasto
  12. Azure Kubernetes Service (AKS) How to upgrade a cluster? Part

    1 Find out: az aks get-upgrades Example: az aks get-upgrades --resource-group myResourceGroup --name myAKSCluster --output table When you can upgrade: Name ResourceGroup MasterVersion Upgrades ------- --------------- --------------- -------------- default myResourceGroup 1.18.10 1.19.1, 1.19.3 If not: ERROR: Table output unavailable. Use the --query option to specify an appropriate query. Use --debug for more info. @annietalvasto 31 @annietalvasto 31 @annietalvasto 31 @AnnieTalvasto
  13. Azure Kubernetes Service (AKS) How to upgrade a cluster? Part

    2 To upgrade: az aks upgrade \ --resource-group myResourceGroup \ --name myAKSCluster \ --kubernetes-version KUBERNETES_VERSION Check with az aks show command: az aks show --resource-group myResourceGroup --name myAKSCluster -- output table @annietalvasto 32 @annietalvasto 32 @annietalvasto 32 @AnnieTalvasto
  14. Takes a few steps Andrew Lock blog series: o Part

    1 - An Introduction to Kubernetes o Part 2 - Configuring resources with YAML manifests o Part 3 - An introduction to deploying applications with Helm o Part 4 - Creating a Helm chart for an ASP.NET Core app o Part 5 - Setting environment variables for ASP.NET Core apps in a Helm chart o Part 6 - Adding health checks with Liveness, Readiness, and Startup probes o Part 7 - Running database migrations when deploying to Kubernetes o Part 8 - Running database migrations using jobs and init containers o Part 9 - Monitoring Helm releases that use jobs and init containers o Part 10 - Creating an 'exec-host' deployment for running one-off commands o Part 11 - Avoiding downtime in rolling deployments by blocking SIGTERM o Part 12 - Tips, tricks, and edge cases @annietalvasto 34 @annietalvasto 34 @annietalvasto 34 @AnnieTalvasto
  15. Building sustainable ecosystems for cloud native software The Cloud Native

    Computing Foundation (CNCF) hosts critical components of the global technology infrastructure. CNCF brings together the world9s top developers, end users, and vendors and runs the largest open source developer conferences. CNCF is part of the nonprofit Linux Foundation. @annietalvasto 37
  16. 39

  17. What is Helm? oPackage manager for Kubernetes oHomebrew, snap or

    chololatey for kubernetes oHelm maintainer: oPackage management: Tooling that enables someone who has knowledge of an application and a platform to package up an application so that someone else who has neither extensive knowledge of the aplication or the way it needs to be run on the platform can use it. @annietalvasto 40 @annietalvasto 40 @annietalvasto 40 @AnnieTalvasto
  18. What are the benefits of Helm? oManage Complexity oEasy Updates

    oSimple Sharing oRollbacks @annietalvasto 41 @annietalvasto 41 @annietalvasto 41 @AnnieTalvasto
  19. How is Helm used? oCharts oWhat are the prerequisites? o

    A Kubernetes cluster o Deciding what security configurations to apply to your installation, if any o Installing and configuring Helm. @annietalvasto 42 @annietalvasto 42 @annietalvasto 42 @AnnieTalvasto
  20. Helm Demo: Easily deploy complex application (WordPress) to Kubernetes using

    a helm chart @annietalvasto 43 @annietalvasto 43 @annietalvasto 43 @AnnieTalvasto
  21. Linkerd oService mesh oUltralight, ultrafast, security-first service mesh for Kubernetes.

    oThe overall goal is to reduce mental overhead of having service mesh oWhat does it do? o Observability o Realiability o Security @annietalvasto 45 @annietalvasto 45 @annietalvasto 45 @AnnieTalvasto
  22. What are the benefits of Linkerd? oThriving open source community

    oSimple, minimalist design oDeep Runtime Diagnostics oUltralight and ultra fast oInstalls in seconds with zero config oActionable service metrics @annietalvasto 46 @annietalvasto 46 @annietalvasto 46 @AnnieTalvasto
  23. What is needed to use Linkerd: cat deployment.yml | linkerd

    inject - | kubectl apply -f - @annietalvasto 47 @annietalvasto 47 @annietalvasto 47 @AnnieTalvasto
  24. 48

  25. What is Keda? oDefault Kubernetes Scaling is not well suited

    for event driven applications, kubernetes is more for resource based scaling (CPU and memory). oKeda: Event driven scale controlling that can run inside any kubernetes cluster. oYou can install it into new or existing clusters. @annietalvasto 49 @annietalvasto 49 @annietalvasto 49 @AnnieTalvasto
  26. What are the Keda principles? oNot rebuilding anything that Kubernetes

    offers out of the box. oSingle purpose, simple, non-intrusive. oWorks with any container and any workload @annietalvasto 50 @annietalvasto 50 @annietalvasto 50 @annietalvasto 50 @AnnieTalvasto
  27. Demo KEDA: Scaling .NET Core worker with Azure Service Bus

    @annietalvasto 51 @annietalvasto 51 @annietalvasto 51 @AnnieTalvasto
  28. What is Flux? oWhat is GitOps? Kubectl apply Kubectl set

    image Helm upgrade Kubectl upgrade -> git push GitOps provides one model for making infrastructure, apps and Kubernetes add-on changes, you have consistent end-to-end workflow across your entire organization oWhy is Flux great for GitOps? @annietalvasto 53 @annietalvasto 53 @annietalvasto 53 @annietalvasto 53 @AnnieTalvasto
  29. Flux practices & benefits Defined GitOps practices: o1) Describe your

    system declaratively o2) Keep configuration under source control o3) Use software agents to reconcile and ensure correctness and alert for drfit Benefits o Collaboration on infra o Access Control o Auditable History o Drift Correction o Clear boundaries between dev-team and kubernetes @annietalvasto 54 @annietalvasto 54 @annietalvasto 54 @annietalvasto 54 @AnnieTalvasto
  30. o Azure Docs Resourcews o https://docs.microsoft.com/en-us/azure/aks/kubernetes- walkthrough o https://docs.microsoft.com/en-us/azure/aks/tutorial- kubernetes-scale?tabs=azure-cli

    o https://docs.microsoft.com/en-us/azure/aks/cluster-autoscaler o https://docs.microsoft.com/en-us/azure/aks/upgrade-cluster o Kubernetes for .NET Developers - Hossam Barakat o https://www.youtube.com/watch?v=uh4V2IjSrlI o Deploying ASP.NET Core applications to Kubernetes - Part 1 o https://andrewlock.net/deploying-asp-net-core-applications-to- kubernetes-part-1-an-introduction-to-kubernetes/ o Project Tye o https://github.com/dotnet/tye o Workshop: o https://docs.microsoft.com/en-us/learn/modules/aks- workshop/ o Cncf yYoutube - https://www.youtube.com/channel/UCvqbFHwN- nwalWPjPUKpvTA o Techworld with Nana - https://www.youtube.com/channel/UCdngmbVKX1Tgre699- XLlUA o Links and slides: github.com/annietalvasto Learn more @annietalvasto 61 @annietalvasto 61 @annietalvasto 61 @AnnieTalvasto