Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Latest commit

 

History

History
105 lines (83 loc) · 4.09 KB

gitops.md

File metadata and controls

105 lines (83 loc) · 4.09 KB

GitOps

Prepare the git repo

cluster administrator repo

operations folder
|-- <cluster-name>
  |-- <non-namespaced-workloads>
  |-- <namespace>
    |-- <rbac>
    |-- <limits>
    |-- <cluster-workloads>

application repo

deploy folder

|-- manifests OR kustomize OR helm chart

Onboard an AKS cluster directly

cluster extensions

az aks enable-addons --resource-group rg-aks-primary --name aks-primary-cluster --addons gitops
az k8s-configuration create \
    --name aks-primary-cluster --resource-group rg-aks-primary --cluster-name aks-primary-cluster \
    --operator-instance-name global-configuration \
    --operator-namespace azure-gitops \
    --repository-url https://github.com/dexmach/k8sarc \
    --scope cluster \
    --cluster-type managedClusters \
    --operator-params "--git-poll-interval 10s --git-readonly --git-path=operations/aks-azure,operations/common --git-branch main" \
    --enable-helm-operator --helm-operator-chart-version='1.4.0' --helm-operator-params='--set helm.versions=v3'

edge clusters (arc onboarded)

az k8s-configuration create \
    --name edge-hardware-02 --resource-group rg-aks-arc --cluster-name edge-hardware-02 \
    --operator-instance-name global-configuration \
    --operator-namespace azure-gitops \
    --repository-url https://github.com/dexmach/k8sarc \
    --scope cluster \
    --cluster-type connectedClusters \
    --operator-params "--git-poll-interval 10s --git-readonly --git-path=operations/aks-edge,operations/common --git-branch main" \
    --enable-helm-operator --helm-operator-chart-version='1.4.0' --helm-operator-params='--set helm.versions=v3'

onboard the sample app

az k8s-configuration create \
    --name sample-app-config --resource-group rg-aks-primary --cluster-name aks-primary-cluster \
    --operator-instance-name sample-app-config \
    --operator-namespace demo \
    --repository-url https://github.com/dexmach/k8sarc \
    --scope namespace \
    --cluster-type managedClusters \
    --operator-params "--git-poll-interval 10s --git-readonly --git-path=sample-app-repo/deploy --git-branch main"

az k8s-configuration create \
    --name sample-app-config --resource-group rg-aks-arc --cluster-name edge-hardware-02 \
    --operator-instance-name sample-app-config \
    --operator-namespace demo \
    --repository-url https://github.com/dexmach/k8sarc \
    --scope namespace \
    --cluster-type connectedClusters \
    --operator-params "--git-poll-interval 10s --git-readonly --git-path=sample-app-repo/deploy --git-branch main"

Flux v1 vs Flux v2

all differences: https://fluxcd.io/docs/migration/faq-migration/#what-are-significant-new-differences-between-flux-v1-and-flux-v2

Clean up

az k8s-configuration delete --name edge-hardware-02 --resource-group rg-aks-arc --cluster-name edge-hardware-02 --cluster-type connectedClusters
az k8s-configuration delete --name sample-app-config --resource-group rg-aks-arc --cluster-name edge-hardware-02 --cluster-type connectedClusters
az k8s-configuration delete --name aks-primary-cluster --resource-group rg-aks-primary --cluster-name aks-primary-cluster --cluster-type managedClusters
az k8s-configuration delete --name sample-app-config --resource-group rg-aks-primary --cluster-name aks-primary-cluster --cluster-type managedClusters
az aks disable-addons --resource-group rg-aks-primary --name aks-primary-cluster --addons gitops