Search
StarWind is a hyperconverged (HCI) vendor with focus on Enterprise ROBO, SMB & Edge

Deploy your AKS application with GitOps and Flux

  • December 9, 2021
  • 6 min read
Cloud and Virtualization Architect. Florent is specializing in public, hybrid, and private cloud technologies. He is a Microsoft MVP in Cloud and Datacenter Management and an MCSE in Private Cloud.
Cloud and Virtualization Architect. Florent is specializing in public, hybrid, and private cloud technologies. He is a Microsoft MVP in Cloud and Datacenter Management and an MCSE in Private Cloud.

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.

Hey! Found Florent’s article helpful? Looking to deploy a new, easy-to-manage, and cost-effective hyperconverged infrastructure?
Alex Bykovskyi
Alex Bykovskyi StarWind Virtual HCI Appliance Product Manager
Well, we can help you with this one! Building a new hyperconverged environment is a breeze with StarWind Virtual HCI Appliance (VHCA). It’s a complete hyperconverged infrastructure solution that combines hypervisor (vSphere, Hyper-V, Proxmox, or our custom version of KVM), software-defined storage (StarWind VSAN), and streamlined management tools. Interested in diving deeper into VHCA’s capabilities and features? Book your StarWind Virtual HCI Appliance demo today!