Post

Setup Flux GitOps Operator in Azure

Set up Flux GitOps on Azure to automate Kubernetes deployments using Git as the single source of truth.

Flux is an open-source continuous delivery tool designed to automate Kubernetes application deployments using GitOps. It runs as a set of controllers inside Kubernetes cluster that continuously monitor connected Git repositories for changes.

Setup prerequisites:

  • GitHub repo
  • Azure Kubernetes cluster

Setup steps:

  • Navigate to the cluster in Azure portal and then go to Settings -> GitOps
  • Select Create

azure-gitops-setup

Enter GitOps details:

  • Configuration name: ex. aks-gitops
  • Namespace: ex. flux-namespace (namespace should match the namespace defined in Kubernetes deployment file)
  • Scope: in this example let’s use Namespace
  • Select Next

In the Source section:

  • In Source type (Source kind), select Git Repository
  • Repository URL: path to the repo
  • Reference type: Branch
  • Branch: Enter branch name (usually master but any test repo can be used as well)
  • In this example let’s use Private repo
  • HTTP User: enter your GitHub username
  • HTTP Key: Generate private access token in GitHub and paste it here
  • Set sync interval and timeout to desired minutes
  • Click Next

In the Kustomization section:

  • Create kustomization, let’s name it gitops-test
  • Inside GitHub project repo, create folder git-ops folder and inside that folder create kustomization file (kustomization.yml). This file will list resource files (deployment, services).
1
2
3
4
apirVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
    - gitops-test.depoloyment.yml
  • Set the path to the kustomization file, e.g. ./gitops-test (which is folder name created before with kustomization file in it)
  • Click Create to create Flux configuration in Azure.

Once configuration is initiated, Azure might take some time to perform configuration (around 7-10 minutes).

Potential issues:

  • Non-Compliant status message.
  • Image pulling from Container registry.
  • Auth to Azure services.
This post is licensed under CC BY 4.0 by the author.