- 15,512 lines of declarative code added
- 107 files changed
- 46 commits merged in a single coordinated transition
- Zero downtime and zero dropped packets
Public Write-up: Read the breakdown and engineering discussion of this migration on LinkedIn.
In typical cloud migrations, teams spin up an entirely separate cloud network or resource group, creating complete infrastructure isolation. In this environment, legacy dependencies and enterprise subscription constraints required both the existing AKS cluster and the newly provisioned AKS cluster to live inside the same Azure Resource Group.
GitOps controllers like Flux reconcile desired state against actual cluster state continuously. If cloud-mutating controllers (such as terraform-controller or Azure service operators) were allowed to run freely on the new cluster, they could detect resources already managed by the legacy cluster, trigger drift corrections, or delete active cloud dependencies.
To prevent catastrophic collision, I established a strict controller-first deployment runway with blast-radius containment.
The repository was organized into environment overlays under clusters/<env>/:
clusters/
├── dev/ # Live legacy cluster config
├── devnew/ # Target cluster staging config
├── qa/
├── uat/
└── prod/
The new cluster (devnew) was bootstrapped against an isolated Git feature branch (devnew) to ensure no commits on the main trunk could inadvertently trigger reconciliation on the staging cluster.
I authored modular Flux Kustomization manifests in clusters/devnew/infrastructure.yaml dividing workloads into two tiers:
- infrastructure/controllers/<component> (Custom Resource Definitions and operator controllers)
- infrastructure/config/<component> (Custom resources, storage classes, and configurations)
- Core Platform Controllers: ingress-nginx, external-secrets, sealed-secrets, weave-gitops, datadog, and keda.
- Data & Streaming Infrastructure: strimzi (Kafka), schema-registry, spark-operator, keycloak, airflow, and opensearch.
- Reconciliation Controls: Enforced wait: true, health check timeouts set to 5m, and prune: true for clean resource lifecycle management.
Building parallel infrastructure surfaces edge-case bugs that standard deployments miss. Here are the four critical bottlenecks I diagnosed and resolved:
- Incident: After encrypting the Azure service-principal secret using kubeseal and removing the plaintext credential, the sealed-secrets controller failed to decrypt it. The downstream External Secrets Operator starved, throwing ClusterSecretStore: InvalidProviderConfig.
- Root Cause: The secret had been sealed with the public certificate belonging to the legacy cluster rather than the newly bootstrapped cluster's sealing key.
- Resolution: Rather than restarting controllers or testing speculative fixes, I diagnosed the localized decryption failure from controller logs, recovered the underlying credentials, resealed them with the target cluster's public certificate, and restored automated secret synchronization across all namespaces.
- Incident: The grafana-config reconciliation stalled because the Loki HelmRelease timed out waiting for its PersistentVolumeClaim (PVC) to bind.
- Root Cause: The custom StorageClass required by Loki had not yet been applied at the cluster level when the Helm chart attempted to provision storage.
- Resolution: Reordered the dependency chain to apply cluster-wide StorageClasses before instantiating workload HelmReleases, unblocking PVC binding and bringing the observability stack online.
- Incident: Pre-cutover validation requests from the jump host directly to the new internal LoadBalancer IP returned HTTP 403 Forbidden.
- Root Cause: Enterprise Zscaler proxy rules intercepted traffic addressed to internal cluster IPs by default.
- Resolution: Bypassed proxy interception during internal endpoint verification using --noproxy "*" paired with explicit Host headers. This allowed end-to-end HTTP route validation through ingress-nginx prior to touching external DNS.
- Incident: Workloads backed by blob.csi.azure.com reported Attached: false on their VolumeAttachment objects, raising concerns that storage mounts were unstable.
- Root Cause: Unlike block storage (Azure Disks) that attaches directly to a VM host and sets Attached: true, Azure Blob storage mounts via BlobFuse directly from the node DaemonSet over the network. It bypasses the Kubernetes attach-detach-controller by design.
- Verification: Cross-referencing production cluster API states confirmed identical Attached: false states on healthy, running workloads.
- Outcome: Prevented hours of speculative CSI driver debugging; storage mounts were confirmed stable across all pods.
The most dangerous moment of any GitOps migration is swapping folder identities (devnew to dev). If both clusters read from the same directory at the same time, split-brain reconciliation will occur.
To make the transition blast-proof, I designed a "Double Padlock" freeze strategy:
I suspended both the GitRepository and Kustomization resources on the legacy cluster:
This ensured running workloads continued serving live traffic while completely ignoring any incoming Git commits.
In the cutover branch, I renamed clusters/dev to clusters/dev-backup and modified its gotk-sync.yaml to point to a non-existent Git branch (decommissioned):
Even if someone accidentally ran flux resume on the old cluster, it could never pull or apply live manifests.
I suspended GitRepository and Kustomization on devnew so it wouldn't throw a path not found error during the mid-merge directory rename.
- Merged the 15,512-line Pull Request into master, cleanly renaming clusters/devnew to clusters/dev across all patches and overlays.
- Updated external DNS CNAME records to point incoming traffic from the legacy ingress IP to the new cluster's public LoadBalancer IP.
- Zero Downtime: Active traffic transitioned seamlessly between clusters with 0 service interruption.
- Zero Shared-Resource Collisions: Strict controller sequencing and deferred Terraform operators prevented any destructive mutation of the shared Azure Resource Group.
- Declarative Audit Trail: 107 files and 15,512 lines of code reviewed, approved, and codified through version-controlled GitOps.
- Repeatable Runbook: The staged "Double Padlock" workflow established a blueprint for subsequent cluster upgrades across qa, uat, and prod.
- Blast radius is determined by controller capabilities, not just code: In shared cloud environments, deferring controllers that possess cloud-mutating permissions is the only foolproof safeguard against accidental destruction.
- Understand CSI storage mechanics before debugging: Network-mounted storage (BlobFuse) behaves fundamentally differently from block storage. Knowing that Kubernetes VolumeAttachments stay Attached: false saves hours of unnecessary troubleshooting.
- Double-padlock legacy infrastructure during cutovers: Never rely on a single suspension command. Pointing the legacy sync manifest to a non-existent Git branch guarantees that human error cannot trigger accidental re-reconciliation.
