After seeing how to integrate your AKS cluster into Azure Arc (prerequisite), we will see how to use GitOps to deploy applications, from a GitHub repo, to the AKS cluster. This feature is currently in preview.

GitOps is a new way to work, to manage infrastructures, and configuration of applications, based on Git. For example, if you modify your reference code, it will be applied automatically, to the current infrastructure, without doing anything. The agent is looking every 5 minutes if a change appears into the Git repo.

We will deploy a custom Web Application, try it, and after, we will modify the code on the Git. It should be deployed automatically, without doing anything.

You have 2 ways to do this:

– With aks-gitops add-on, currently in preview

– With Flux and Azure Arc

We will choose the second option, because it is currently supported. Because we integrated our cluster into Azure Arc, the GitOps extension is already deployed, with Flux:

GitOps extension is already deployed

Now, you have 2 possibilities to deploy sources to AKS:

– Fork the Microsoft repo, and modify it in your own repo

– Download sources, and upload them in a repo in a Git account

The link where sources are located is here:

Azure/arc-k8s-demo: Artifacts for Arc For Kubernetes Demo (github.com)

All resources that I will use in this article are available here: Flodu31/Starwind-AKS-Arc-Gitops (github.com)

I will use the second option on my side. I will download the full repo, and upload it to my private git repo, on my Azure DevOps account:

Azure DevOps account

Everything that we will do now can be done through CLI: Tutorial: Deploy configurations using GitOps on an Azure Arc-enabled Kubernetes cluster – Azure Arc | Microsoft Docs

To start, go onto your Azure Arc AKS cluster, and click on GitOps. Add a new configuration:

Add a new configuration

You will need the following information:

– Give a name to this configuration

– Give a name to the instance

– Give a name to the namespace where resources will be deployed

– Choose cluster as scope, to be sure that everything can be created, included namespaces

– Provide parameters of flux. For example, because my repo is new, I need to provide the branch name that I will use, because by default, Flux looks for the repo master. For me, it is main: –git-branch=main

– Provide the URL of your repo: https://dev.azure.com/florentappointaire/Arc-Aks-Starwind/_git/Arc-Aks-Starwind

– Choose the repo type, for me, Private

– Choose the authentication type, for me HTTPS. Get credentials to connect through HTTPS on Azure DevOps git:

Clone Repository

Add a GitOps configuration

The configuration is now added, and the deployment will be able to start:

The deployment will be able to start

After few minutes, you can see your new namespace with the project that you configured:

New namespace with the project

Namespace installed

Now, the agent will check what he needs to deploy to the cluster. Starting with the 2 namespaces that I have in my namespaces folder:

Namespaces folder

The service is deployed correctly, and I can browse the web page:

The service is deployed correctly

Browse the web page

If I do a modification on the CM on Azure DevOps, after maximum 5 minutes, the configuration is applied:

The configuration is applied

Modification on the CM on Azure DevOps

As you can see, it is very easy to deploy applications, and do updates on an application, without modifying anything, and without building complex CI/CD pipelines.

VSAN from StarWind is software-defined storage (SDS) solution created with restricted budgets and maximum output in mind. It pulls close to 100% of IOPS from existing hardware, ensures high uptime and fault tolerance starting with just two nodes. StarWind VSAN is hypervisor and hardware agnostic, allowing you to forget about hardware restrictions and crazy expensive physical shared storage.

Build your infrastructure with off-the-shelf hardware, scale however you like, increase return on investment (ROI) and enjoy Enterprise-grade virtualization features and benefits at SMB price today!

Back to blog