AKS(Azure Kubernetes Deployment)

Photo by Growtika on Unsplash

AKS(Azure Kubernetes Deployment)

End 2 End Azure DevOps (CI) & (CD) Deployment

ยท

6 min read

Required Tools and Technologies

Cloud Platform: Azure Cloud

  1. Azure Container Registry (ACR)

    Azure Container Registry is a private registry service for building, storing, and managing container images and related artifacts, managed and maintained by Microsoft Azure cloud

Azure Container Webapplications

  1. Azure App Service is an HTTP-based service for hosting web applications, REST APIs, and mobile backends. You can develop in your favorite language, be it .NET, .NET Core, Java, Node.js, PHP, and Python. Applications run and scale with ease on both Windows and Linux-based environments.

    App Service adds the power of Microsoft Azure to your application, such as security, load balancing, autoscaling, and automated management. Additionally, you can take advantage of its DevOps capabilities, such as continuous deployment from Azure DevOps, GitHub, Docker Hub, and other sources, package management, staging environments, custom domain, and TLS/SSL certificates.

    Why use App Service?

    Azure App Service is a fully managed platform as a service (PaaS) offering for developers. Here are some key features of App Service

    1. Multiple languages and frameworks

    2. Managed production environment

    3. Containerization and Docker

    4. DevOps optimization

    5. Global scale with high availability

    6. Connections to SaaS platforms and on-premises data

Azure Kubernetes Service (AKS)

Azure Kubernetes Service (AKS) simplifies deploying a managed Kubernetes cluster in Azure by offloading the operational overhead to Azure. As a hosted Kubernetes service, Azure handles critical tasks, like health monitoring and maintenance. When you create an AKS cluster, a control plane is automatically created and configured. This control plane is provided at no cost as a managed Azure resource abstracted from the user. You only pay for and manage the nodes attached to the AKS cluster.

SonarQube

SonarQube is an open-source platform that provides static code analysis and code quality management. It is designed to help developers and development teams identify and fix code issues early in the software development lifecycle. SonarQube analyzes source code for bugs, vulnerabilities, code smells, and code duplications, and provides detailed reports with actionable insights.

OWASP Dependency check

OWASP The Open Web Application Security Project (OWASP) Dependency-Check is a software composition analysis (SCA) tool that identifies project dependencies with known vulnerabilities. It helps developers and security professionals identify and mitigate potential risks associated with using vulnerable libraries and components

Azure DevOps Platform

Azure DevOps supports a collaborative culture and set of processes that bring together developers, project managers, and contributors to develop software. It allows organizations to create and improve products at a faster pace than they can with traditional software development approaches.

Azure Boards

    • Azure Boards is a web-based service that enables teams to plan, track, and discuss work across the entire development process, while it supports agile methodologies, including Scrum and Kanban. Azure Boards provides a customizable platform for managing work items, allowing teams to collaborate effectively and streamline their workflow.

Azure Repos

    • Azure Repos is a set of version control tools that you can use to manage your code. Whether your software project is large or small, using version control as soon as possible is a good idea.

      Version control systems are software that helps you track changes you make in your code over time. As you edit your code, you tell the version control system to take a snapshot of your files. The version control system saves that snapshot permanently so you can recall it later if you need it. Use version control to save your work and coordinate code changes across your team.

Azure Build and Release Pipelines

    • Azure Pipelines automatically builds and tests code projects. It supports all major languages and project types and combines continuous integration, continuous delivery, and continuous testing to build, test, and deliver your code to any destination.

Azure Test Plans

    • Azure Test Plans provides rich and powerful tools everyone in the team can use to drive quality and collaboration throughout the development process. The easy-to-use, browser-based test management solution provides all the capabilities required for planned manual testing, user acceptance testing, exploratory testing, and gathering feedback from stakeholders.

Azure Artifacts

    • Azure Artifacts enable developers to consume and publish different types of packages to Artifacts feeds and public registries such as NuGet.org and npmjs.com. You can use Azure Artifacts in conjunction with Azure Pipelines to deploy packages, publish build artifacts, or integrate files between your pipeline stages to build, test, or deploy your application.

Create a container Registry from Azure Portal

Reference Doc

https://learn.microsoft.com/en-us/azure/container-registry/container-registry-get-started-portal?tabs=azure-cli

Create Docker Container Web application From Azure Portal

Reference Doc

https://learn.microsoft.com/en-us/azure/developer/python/tutorial-containerize-deploy-python-web-app-azure-04?tabs=azure-portal%2Cterminal-bash

Create AKS cluster in Azure Portal

Cluster is Up and Running

Reference Doc

https://learn.microsoft.com/en-us/azure/aks/learn/quick-kubernetes-deploy-portal?tabs=azure-cli

Sonarqube Server is Running

Azure DevOps

Build Pipelines

Clone the Source Code from local or any of the source code management

use the classic editor for Building the CI pipeline and use the maven template because this is a java based project so we need to use the maven template.

Define maven goals maven compile & maven package

then add Docker task from the add button,sonarqube and Wasp dependency check

in the docker task provide a Service connection and proper ACR registry endpoint

create a new service connection with the help of the Sonarqube Server URL along with the SonarQube token use the service connection for the sonar qube analysis.

once the build got succeed we will get artifacts in the drop location we can use those build artifacts for the release pipelines as input

Release pipelines

now it's time to release the Build Artifacts with the help of Release Pipelines as Continuous Deployment

from the pipeline section select Release >> add new new release Pipeline >> Select required template as per the requirement

provide names like test and prod .

make sure put a checkmark on the Continuous Deployment trigger and add build artifacts

once the Release is successful verify the aks cluster deployment and services with the help of Kubernetes commands

Verify the Deployments Using K8s Commands

Kubectl get deployments

Kubectl get nodes

Kubectl get pods

kubectl get svc

External-IP along with port 8080

K8schet Sheet for the Reference

https://kubernetes.io/docs/reference/kubectl/cheatsheet/

With the help of Azure Monitor, we can monitor the Azure Resources

these are the basic metrics of the K8s Cluster

for the source code check out the below GitHub URL

https://github.com/Raghava0684/Secreat-Santa

Thank you so much for reading my blog...๐Ÿ˜Š!!!

ย