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

Automate app deployment with Terraform & Azure ...

Asif Waquar
November 20, 2021

Automate app deployment with Terraform & Azure DevOps

In this session , We will discuss how to deploy apps and infrastructure with Iac tools such as Terraform and Azure Pipelines .
What are the benefits of Iac tools such as terraform ? Current challenges in app/infrastructure deployment and how to solve those challenges ?

What are some core challenges?

1- Managing your cloud infrastructure : Creating your cloud resources using the cloud provider Portal will not help you with repeatability. What you need is an automated way of creating your resources. Infrastructure as Code or IaC as it is popularly termed, provides you a mechanism to automate your resource creation by writing code. This ensure you can source control your infrastructure changes like the way you do with your application code.

2- Speed and Consistency : IaC is to make things faster by eliminating manual processes and eliminating the slack in the process. A code-based approach makes it easier to get more done in less time .Consistency is another benefit of IaC. We do not need to worry about tasks not being completed and it's not consistent .

3- Monitoring and Scaling : When you provision any resources you might need additional tools to track who is provisioning what, where, how often and what is the cost of that. You might find it challenging to track the usage/capacity . We can achieve better monitoring and scaling capability with Iac.

What problems does your sessions solves?
In this session, we will take a look at how to solve the above given challenges using Terraform and Azure pipelines .

Who is the target attendee?
IT Developers/Consultants

Why would that person want to attendee your session?
- To start your journey with Iac and build automated pipelines

What can the attendee walk away with?
- How to perform infrastructure management activities with Terraform
- How to build automated pipelines using Azure DevOps
- How to deploy, scale and monitor application with Terraform, Azure DevOps and Kubernetes

Asif Waquar

November 20, 2021
Tweet

More Decks by Asif Waquar

Other Decks in Technology

Transcript

  1. November 19, 2021, 9 AM - 5 PM EST -

    ONLINE Automate app deployment with Terraform & Azure DevOps
  2. Room 1 - Pennsylvania Friday, November 19, 2021 Ben Steinhauser

    Cloud Solution Architect Azure Static Web Apps: I am a Believer! Sergey Chubarov Ethical Hacker Offensive Azure Security Alpa Buddhabhatti Cluster reply , London , UK Azure Logic Apps for everyone Taiob Ali Microsoft MVP -Data Platform Options and considerations for migrating SQL Server databases to Azure Maxim Salnikov Developer Engagement Lead at Microsoft, Tech Communities Lead, Keynote Speaker Azure cloud for the web frontend developers Sam Cogan Solutions Architect & Azure MVP Regain Control with Azure Governance Rajaniesh Kaushikk Enterprise Cloud Solution Architect Deploying SQL server Always on Availability Group on Azure Kubernetes Services (AKS). Marco Obinu Azure MVP, Advisory Engineer @ Softjam S.p.A, Geek to the bone Train your Bicep to improve your ARM's strength! Thomas Hafermalz Azure Solution Architect@Trivadis AG Introduction to Azure Kubernetes Service (AKS) https://www.azurecommunitybc.com/sessions
  3. Room 2 – New York Friday, November 19, 2021 Deepthi

    Goguri SQL Database Administrator Azure Fundamentals 101 Roy Kim Azure Cloud Engineer Performance Testing and Monitoring your Azure Kubernetes Service Abhijeet Jadhav Microsoft MVP - Office 365 Development Azure Communication Services - What, Where and How to use Debasis Saha Microsoft Certified Trainer, C# Corner MVP Azure Functions - Zero to Hero Shruti Kuber Developer Advocate Cellular Network Diagnostics with Azure IoT Shweta Lodha C# Corner MVP, Speaker, Blogger, Data Analyst and Developer Finding Abnormalities in Data using Azure Cognitive Services Ron Dagdag Lead Software Engineer at Spacee and Microsoft MVP AI to the edge with Azure Percept Eric Cheng Digital Solutions Architect - Komatsu Australia Monitoring your Canvas Power Apps with Azure Application Insights asif waquar Cloud Solution Architect at ABN AMRO Bank / Microsoft Azure MVP Automate app deployment with Terraform & Azure DevOps https://www.azurecommunitybc.com/sessions
  4. Session Feedback / Raffle Entry https://bit.ly/acbc2021 We'll be giving away

    1 gift card per session. ENTER SPEAKER CODE 152973
  5. 2 about me Mohammad Asif Waquar Cloud Solution Architect |Singapore

    asifwaquar asifwaquar https://asifwaquar.com/ @asifwaquar
  6. Today’sAgenda How to perform infrastructure management activities with Terraform How

    to build automated pipelines using Azure DevOps How to deploy, scale and monitor application with Terraform, Azure DevOps and Kubernetes demo
  7. Development UAT Production ✓ Azure Resource Group ✓ Azure Storage

    ✓ Azure Container Service ✓ Azure Kubernetes Service ✓ Azure DevOps main azure_pipelines ARM Templates Azure DevOps
  8. Steps to Create Azure DevOps Pipeline Install • Install Pipeline

    Extensions Create • Create Service Connection and Provide Permissions Generate • Generate ssh keys to connect and create resources in Azure Cloud Create • Create Pipelines
  9. Azure Cloud Azure DevOps Azure Pipelines Github Developer Azure Container

    Registry Stage-1: Build & Push to ACR Stage-2: Deploy to AKS Azure AKS Cluster Nginx App1 default namespace 2 1 3 4 5 6 Blockchain App Demo Workflow
  10. docker build --tag asif1202/todolistapp:v1 . docker run --name v1 –p

    80:80 asif1202/todolistapp:v1 docker push asif1202/todolistapp:v1 Docker Build File
  11. Azure AKS – Cluster & HPA Autoscaling az aks get-credentials

    --resource-group terraform-aks-dev --name terraform-aks-dev-cluster -- admin Step-1 Get the credentials of existing cluster Step-2 Scale by increasing no of replica to 20 kubectl describe hpa/asifwaquardemo kubectl autoscale deployment asifwaquardemo --cpu- percent=20 --min=1 --max=10 kubectl get horizontalpodautoscaler.autoscaling/asifwaquardemo Step-3 HPA Scaling kubectl scale --replicas=20 deploy asifwaquardemo kubectl get pods kubectl get nodes -o wide
  12. kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.4.0/aio/deploy/recommended.yaml Step-1 kubectl cluster-info Step-2 kubectl -n

    kubernetes-dashboard get pods -o wide Step-3 kubectl -n kubernetes-dashboard get svc http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/prox Locally we can run using kubectl proxy . Run kubectl proxy and access dashboard using below link Step-4 kubectl create serviceaccount dashboard -n default To access dashboard we need service account token. Let’s create it using below command Step-5 Configure Kubernetes Monitoring Dashboard
  13. kubectl create clusterrolebinding dashbaord-admin -n default --clusterrole=cluster-admin -- serviceaccount=default:dashboard Now

    let’s create cluster binding with service account Step-6 kubectl get secret $(kubectl get serviceaccount dashboard -o jsonpath="{.secrets[0].name}") -o jsonpath="{.data.token}" | base64 –decode Get the secret token using below command – Step-7 kubectl -n kube-system get secret |grep namespace-controller-token |cut -f1 -d ' ' | xargs kubectl -n kube-system describe secret or
  14. Recap We have covered how to create Infrastructure pipeline with

    Terraform We have covered how to create Azure pipelines to deploy app using AKS and ACR. Package Application with Docker . Autoscaling. Monitoring Application with Kubernetes Dashboard
  15. Docker Playground - https://labs.play-with-docker.com Docker getting started - https://docs.docker.com/get-started/ Docker

    Multi-Stage builds - https://docs.docker.com/engine/userguide/eng-image/multistage-build/ Difference between Dotnet images - https://andrewlock.net/exploring-the-net-core-2-1-docker-files-dotnet-runtime-vs- aspnetcore-runtime-vs-sdk/ Docker Cheat sheets https://www.docker.com/sites/default/files/Docker_CheatSheet_08.09.2016_0.pdf https://github.com/wsargent/docker-cheat-sheet https://devhints.io/docker https://issues.jboss.org/secure/attachment/12405996/Docker http://files.zeroturnaround.com/pdf/zt_docker_cheat_sheet.pdf https://caylent.com/docker-commands-cheat-sheet/ Twelve Factor App - https://12factor.net Kubernetes Playground- https://labs.play-with-k8s.com/ DevOps- https://www.youtube.com/c/HoussemDellai , https://www.youtube.com/c/TechWorldwithNana Reference Links
  16. Session Feedback / Raffle Entry https://bit.ly/acbc2021 We'll be giving away

    1 gift card per session. ENTER SPEAKER CODE 152973