Kubeflow GitOps Deployment (Air-gapped on Azure AKS)
This article summarizes the experience of re-architecting the Kubeflow
community-distribution (release-26.03.1) into an air-gapped GitOps deployment on
Azure AKS. The upstream distribution is never modified directly; instead, images and
settings are injected non-invasively through overlays under overlays/dev/.
This article focuses on deployment structure. The detailed behavior of each component (authentication flow, pipeline execution model, etc.) is out of scope.
Overview
Section titled “Overview”- Goal: Operate the entire Kubeflow platform (including Notebooks) via GitOps in an air-gapped environment.
- Baseline: The distribution’s CI-verified
tests/*.shinstall scripts. - Method: Keep the upstream untouched; inject images/settings only through overlays
under
overlays/dev/. - Result: kustomize overlays mapped 1:1 to the script steps (
NN). Each overlay maps to a single GitOps (Argo CD) Application, while the batch-apply script remains only a secondary path. - Target: Azure AKS (single-tenant cluster). External exposure goes through an Azure LoadBalancer + ingress-nginx (TLS termination).
Design Rationale
Section titled “Design Rationale”Why the full distribution instead of a partial install
Section titled “Why the full distribution instead of a partial install”Because the goal is an end-to-end platform that includes Notebooks (the Jupyter notebook environment). Notebooks is not a standalone component; it depends on the platform as a whole.
- Istio: notebook traffic routing and authorization policies (AuthorizationPolicy)
- Dex + oauth2-proxy: OIDC login and multi-tenant sessions
- Profile/KFAM: per-user namespaces and permissions
- Central Dashboard: notebook menu and spawner UI
- cert-manager: admission webhook certificates
In short, a “notebook controller + web app” alone does not yield a working login, namespace, routing chain. Rather than cherry-picking components and inheriting compatibility/integration problems, we adopted the full configuration whose version compatibility the distribution already validates (Istio 1.30.1, Knative 1.22.0, cert-manager 1.20.2, etc.) as the baseline.
Why re-architect into GitOps
Section titled “Why re-architect into GitOps”The default distribution install is an imperative script of the form
kustomize build ... | kubectl apply. That is convenient for a quick trial, but it has clear limits in long-term operations.
| Aspect | Default distribution | After GitOps re-architecture |
|---|---|---|
| Change tracking | Result exists only in the cluster | All intent is declaratively in Git |
| air-gap | References external registries (quay.io, etc.) | Rewritten to internal registry (images:) |
| Customization | Tempts direct edits to upstream manifests | Non-invasive injection via overlay patches |
| Reproducibility | Depends on re-running scripts | Same commit → same result |
| Upgrades | Manual diff | Swap the upstream reference, then rebuild |
Design Principles
Section titled “Design Principles”- Never touch the upstream (
applications/,common/). Update it only via upstream sync. - Inject environment-specific changes only through overlays under
overlays/dev/. - Limit change mechanisms to two (the patch strategy below). No runtime policy engine (Kyverno, etc.).
Patch Strategy: Two Mechanisms
Section titled “Patch Strategy: Two Mechanisms”images:: Registry host rewrite (air-gap)
Section titled “images:: Registry host rewrite (air-gap)”In each overlay’s kustomization.yaml, rewrite only that component’s images to the internal
registry.
images: - name: quay.io/jetstack/cert-manager-controller # upstream newName: REGISTRY/jetstack/cert-manager-controller # internal mirror newTag: v1.20.2- Each overlay manages only its own 2–6 images (no single, centralized inventory).
- Keep the path/tag; rewrite only the host.
- Limitation:
images:applies only to Deployment container images. It does not catch the notebook-server image (jupyter-scipy, etc., a jupyter-web-app spawner ConfigMap string) or args strings such as cert-manager’s--acme-http01-solver-image, which require a separate patch.
patches:: Everything else (resource/env/config/secret-ref)
Section titled “patches:: Everything else (resource/env/config/secret-ref)”Resource tuning, environment variables, ConfigMap values, etc. are injected via separate patch files.
patches: - path: patches/controller-resources.yaml- A strategic-merge patch matches its target only when both
nameandnamespaceagree. - Confirm container names against the rendered manifest (no guessing).
Reference implementation: overlays/dev/cert-manager/base (three image rewrites plus a controller resource patch).
Per-component Deployment Structure (by script step NN)
Section titled “Per-component Deployment Structure (by script step NN)”For each tests/NN-*.sh install step, there is an overlay that reproduces it identically.
Below, each step lists component role (brief) + deployment structure + kustomize
management approach.
deployment view: Post-deployment placement and relationships by namespace
Section titled “deployment view: Post-deployment placement and relationships by namespace”Rather than install order, this shows (after deployment completes) which namespace each major component lands in and how they connect.
Interactive Diagram
00: Namespace
Section titled “00: Namespace”- Role: Create the Kubeflow namespaces (
kubeflow, and the transitionalkubeflow-system). - Structure: See
common/kubeflow-namespace/base. - Overlay:
namespace/
01: cert-manager
Section titled “01: cert-manager”- Role: Issue admission webhook certificates for many components. This repo’s HTTPS self-signed certificate also operates on top of it.
- Structure: Two stages:
base(core) →overlays/kubeflow(a Kubeflow ClusterIssuer). Apply the overlay after the base webhook is Ready. - Overlay:
cert-manager/base,cert-manager/overlays/kubeflow - Management: The reference for the patch pattern: 3 image rewrites + controller resource patch.
02: Istio (CNI)
Section titled “02: Istio (CNI)”- Role: Inter-component traffic security/routing/authorization. CNI mode (removes the privileged init container). Integrates oauth2-proxy as ExtAuthZ.
- Structure:
istio-crds→istio-namespace→istio-install/overlays/oauth2-proxy. - Overlay:
istio/base,istio/overlays/oauth2-proxy - Note: Cluster-scoped (CRD/webhook). On a shared cluster, beware conflicts with an existing Istio.
03: oauth2-proxy
Section titled “03: oauth2-proxy”- Role: Extend the Istio Ingress-Gateway into an OIDC client. User sessions + M2M token authentication.
- Structure: Adopts the
m2m-dex-and-kindoverlay (OPTION 2). - Overlay:
oauth2-proxy/overlays/m2m-dex-and-kind - Rationale: It lets a Kubernetes ServiceAccount token be used from outside the cluster via the ingress-gateway (e.g., CI automation), which is advantageous for M2M auth. It does require patching issuer/jwksUri on the istio-system request authentication resource (reflected in the overlay).
04: Kubeflow Istio Resources
Section titled “04: Kubeflow Istio Resources”- Role: Create
kubeflow-gateway(an istio Gateway) and thekubeflow-istio-adminClusterRole. - Structure: See
common/istio/kubeflow-istio-resources/base. - Overlay:
kubeflow/base/kubeflow-istio-resources - Management: Add the external HTTPS exposure resources (self-signed certificate, ingress) here (see Section 6).
05: Multi-tenancy Roles
Section titled “05: Multi-tenancy Roles”- Role: Install the multi-tenancy Kubeflow ClusterRoles (admin/edit/view).
- Structure: See
common/kubeflow-roles/base. - Overlay:
kubeflow/base/roles
06: Dex
Section titled “06: Dex”- Role: OIDC IdP. Provides the default static user (
user@example.com); theauthnamespace. - Structure: See
common/dex/overlays/oauth2-proxy. - Overlay:
dex/overlays/oauth2-proxy - Management: In production, replace the static password/email via an overlay patch (no plaintext).
07: Dashboard
Section titled “07: Dashboard”- Role: Central Dashboard + Profiles controller/KFAM + PodDefaults webhook. The core of multi-tenant namespace creation (the Profile CRD).
- Structure: See
applications/dashboard/overlays/istio. - Overlay:
kubeflow/overlays/dashboard - Note: The Profile/PodDefaults CRDs are established here (later steps depend on them).
08-01: Knative Serving
Section titled “08-01: Knative Serving”- Role: The serverless runtime KServe uses (activator/autoscaler/controller/webhook).
- Structure:
knative-serving/overlays/gateways+cluster-local-gateway/overlays/m2m-auth+kubeflow-istio-resources. - Overlay:
knative-serving/overlays/gateways,knative-serving/overlays/cluster-local-gateway - Note: Cluster-scoped. Needs retry logic on apply failure (the script’s 3-attempt loop).
08-02: Knative Eventing (optional)
Section titled “08-02: Knative Eventing (optional)”- Role: Event handling such as inference request logging (optional component).
- Structure:
knative-eventing/overlays/security. - Overlay:
knative-eventing/overlays/security
09: KServe (+ Models Web App)
Section titled “09: KServe (+ Models Web App)”- Role: Model serving (InferenceService). Includes the model-management web UI.
- Structure:
applications/kserve/kserve(applied server-side twice due to CRD ordering) +models-web-app/overlays/kubeflow. - Overlay:
kubeflow/overlays/kserve/controller,.../kserve/models-web-app - Management: Establish CRDs → apply CRs in order. Requires
--server-side --force-conflicts.
10: Pipelines (Kubernetes-native, opt-2 chosen)
Section titled “10: Pipelines (Kubernetes-native, opt-2 chosen)”- Role: Pipeline definition/execution. Artifact store is SeaweedFS.
- Structure:
applications/pipeline/upstream/env/cert-manager/platform-agnostic-multi-user-k8s-native. - Overlay:
kubeflow/overlays/pipeline - Why opt-2 (K8s-native) over opt-1 (DB-based):
- GitOps alignment: opt-2 stores pipeline definitions as
Pipeline/PipelineVersioncustom resources (CRs). Pipelines are thus managed as declarative Kubernetes state rather than an external MySQL DB, matching this repo’s principle of “all intent through Git/kubectl.” - Standard-tooling alignment: They can be handled consistently with K8s-native tools (kubectl, admission webhook validation, etc.). With opt-1, pipeline state hides in a DB.
- cert-manager reuse: The opt-2 path reuses the already-installed cert-manager (webhook certificates) as-is.
- Operational simplicity: Well suited to declarative, idempotent apply, fitting trunk-based and reproducibility requirements.
- We judged that the declarative-management benefit in air-gapped GitOps operations outweighs opt-1’s advantage (familiarity of the existing UI workflow).
- GitOps alignment: opt-2 stores pipeline definitions as
11: Katib
Section titled “11: Katib”- Role: Hyperparameter tuning/AutoML.
- Structure: Based on Katib v1beta1 manifests.
- Overlay:
kubeflow/overlays/katib - Note: To work under multi-tenancy, a Profile namespace must exist first.
12: Notebooks v1
Section titled “12: Notebooks v1”- Role: The Jupyter notebook environment. Installs the notebook controller, Jupyter Web App, PVC Viewer, Tensorboard controller/web app, and Volumes Web App together.
- Structure:
applications/notebooks-v1/overlays/istio. - Overlay:
kubeflow/overlays/notebooks-v1 - Management: The controller image is handled by
images:, but the notebook-server image is a spawner ConfigMap string, so it needs a separate ConfigMap patch.
13: Trainer (Training Operator v2)
Section titled “13: Trainer (Training Operator v2)”- Role: Distributed training (TrainJob). JobSet-based.
- Structure:
upstream/base/crds→overlays(platform) →upstream/overlays/runtimes→ roles, in that order. - Overlay:
kubeflow/overlays/trainer/crds,.../trainer/platform - Management: Combining
crdsandplatformcauses a duplicate-id build error because the platform bundle already includes the CRDs. Split into two sub-parts and apply in order. Namespace iskubeflow-system. Waiting on the webhook caBundle, restarting the jobset rollout, etc. remain imperative steps.
14: Hub (Model Registry)
Section titled “14: Hub (Model Registry)”- Role: Model registry (server + PostgreSQL + Istio routing + UI). Includes the CSI that
lets KServe pull models via a
model-registry://URI. - Structure:
overlays/model-registry(deployed in the profile namespace) +upstream/options/csi(a cluster-scoped ClusterStorageContainer). - Overlay:
kubeflow/overlays/hub/registry,.../hub/csi - Note: The profile namespace (
kubeflow-user-example-com) must exist first for the Pods to come up (step 99 is a prerequisite).
99: User Profile
Section titled “99: User Profile”- Role: Create the default user Profile namespace (
kubeflow-user-example-com). - Structure:
common/user-namespace/base. - Note: Waiting on the Profile controller reconcile and applying the PSS
baselinelabel remain imperative steps. It must exist before the model-registry (14).
Deployment Model and Operations
Section titled “Deployment Model and Operations”Primary deployment model: overlay = GitOps Application 1:1
Section titled “Primary deployment model: overlay = GitOps Application 1:1”This repo’s actual deployment model is that each overlay’s kustomization.yaml corresponds
to a single GitOps (Argo CD) Application. That is, the steps (NN) in Section 4 become
Application units directly.
- Each Application points at its overlay directory as the source, and Argo CD runs
kustomize buildto declaratively sync cluster state. - Ordering: The
argocd.argoproj.io/sync-waveannotation orders resources within a single Application, not Applications relative to each other. Since this repo maps one overlay to one Application, ordering the Applications themselves requires an App-of-Apps layout: a parent Application deploys the child Application manifests, and each child manifest carries the sync-wave annotation that produces the cert-manager → istio → knative → apps order. TheNNnumbers are the basis for the wave values. - Drift detection / self-healing: Git is the single source of truth, but Argo CD’s
default behaviour is manual sync, when it detects drift it only marks the app
OutOfSync, it does not revert anything. Reverting manual cluster changes requiressyncPolicy.automated.selfHeal: true, and deleting resources that were removed from Git requiresprune: true. Upgrades are just merging a commit that swaps the upstream reference.
A child Application manifest deployed by the App-of-Apps parent looks like this:
apiVersion: argoproj.io/v1alpha1kind: Applicationmetadata: name: cert-manager namespace: argocd annotations: # Order in which this Application itself is synced (lower goes first) argocd.argoproj.io/sync-wave: "10"spec: project: kubeflow source: repoURL: https://git.example.invalid/kubeflow-gitops.git targetRevision: main path: overlays/dev/cert-manager/base destination: server: https://kubernetes.default.svc namespace: cert-manager syncPolicy: automated: prune: true # Delete resources removed from Git selfHeal: true # Revert manual cluster changes back to the Git state syncOptions: - CreateNamespace=trueWithout selfHeal and prune, Argo CD reports the difference and fixes nothing.
Interactive Diagram
Secondary path: the imperative batch-apply script
Section titled “Secondary path: the imperative batch-apply script”When bootstrapping or validating without Argo CD, we render the overlay output into per-step
files (temp-NN.yaml) and apply them in dependency order with
apply_rendered_manifests.sh. It follows the same ordering principles imperatively (CRD → CR,
cert-manager → istio → knative → apps). The normal deployment path for an operational cluster is the Argo CD path above; this script is for bootstrap, local validation, and troubleshooting.
# Validate the overlay render (e.g., cert-manager)kustomize build overlays/dev/cert-manager/base
# Fill the air-gap registry — mirror images-dev.txt (93) to the internal registry# Replicate large images separately from heavy-images.txt via stage-mirror.sh
# (secondary) Imperative batch apply./apply_rendered_manifests.shImperative steps that kustomize cannot express
Section titled “Imperative steps that kustomize cannot express”The following remain outside declarative apply (handled via Argo CD health checks or post-scripts).
- trainer: jobset rollout restart, wait on the webhook caBundle, propagation
sleep - profile: wait on the controller reconcile, apply the namespace PSS label
- knative/kserve: re-apply CRs after the CRDs are established (server-side)
Image inventory
Section titled “Image inventory”Air-gap mirroring targets are split across three files under overlays/dev/.
| File | Active images | Role |
|---|---|---|
images-origin.txt | 109 | Full extraction from kustomize build + ConfigMap/args, as upstream (includes examples/large images, pre-processing) |
images-dev.txt | 93 | The actual mirroring target. Large/example images are commented out; CVE-blocked images are promoted to the base ACR as copa patch builds (-patched-...) |
heavy-images.txt | 18 (kept as comments) | Notebook servers + GPU/ML runtimes. Large enough to frequently time out on a normal mirror, so replicated single-arch (linux/amd64) in two stages (pull→local dir→push) via stage-mirror.sh |
- Mirroring (filling the registry) and each overlay’s
images:rewrite (so the cluster pulls internally) are separate tasks; both are required. - Security: images blocked by the base ACR scan for CVEs keep their original ref as
mirror/patch input, while deployment uses the copa patch-build tag (targets/status in
patch-targets.txt,patch-pending-push.txt).
Upstream Update and Change-Verification Boundaries
Section titled “Upstream Update and Change-Verification Boundaries”A successful kustomize build does not mean an upstream release update is safe to deploy. This platform separates change verification into three boundaries: declarative structure, air-gap execution prerequisites, and user flows. Each boundary catches a different class of failure, so none substitutes for another.
Declarative structure: the differences that should remain after vendor replacement
Section titled “Declarative structure: the differences that should remain after vendor replacement”First, replace applications/ and common/ with the new upstream snapshot. The rule against direct edits in the vendor tree is not merely a code-style preference; it is an operational rule that keeps every remaining difference explainable after an upgrade. The only differences that should remain are documented intentional deviations, such as local manifest vendoring for air-gapped deployment, excluded components outside the deployment scope, and environment-specific overlays.
At this stage, verify the following.
- Every file that differs from upstream is in the intentional-deviation list.
- Resource names, namespaces, and container names introduced by the new upstream have not changed in a way that conflicts with or invalidates existing patch targets.
- New CRDs or components do not duplicate resources already owned by an overlay.
Skipping this check can leave a patch silently unapplied, or mistake an upstream change for a local customization and accumulate conflicts in the next update.
Air-gap execution prerequisites: render and mirror checks are separate
Section titled “Air-gap execution prerequisites: render and mirror checks are separate”kustomize build shows whether the rendered manifests point to the internal registry, but it does not prove that the image exists in the mirror registry. Conversely, an image can exist in the mirror inventory while an overlay still points to an external registry or an outdated tag, causing the workload to use the wrong image.
| Check target | Failure signal | How to check |
|---|---|---|
| Overlay image rewrite | Reference to an external registry or an unintended tag | Inspect image references in rendered output |
| Mirror inventory | A Pod remains in ImagePullBackOff | Compare the mirror target list with registry state |
| Images inside ConfigMaps or args | Ordinary container images work, but a specific runtime fails to pull | Extract string image references separately from rendered output |
In particular, images inside notebook-spawner ConfigMaps and controller arguments may not be handled by images:. That is why these paths must remain separate patch and inventory targets.
Runtime verification: Application state and user flows are different
Section titled “Runtime verification: Application state and user flows are different”Even when an Argo CD Application is Synced and Healthy, it does not follow that users can operate the platform. After a change or upstream update, verify the following flows in order.
- A browser login creates a session and reaches the Dashboard.
- A workload can be created in a Profile namespace.
- A Pipeline or training workload pulls its image from the internal mirror.
- An artifact can be written to object storage and retrieved again.
- A model-serving request passes through the gateway and Authorization Boundary.
This is not a generic smoke-test list. Login crosses identity and ingress; workload creation crosses multi-tenancy; image pull crosses the air-gap mirror; artifacts cross storage; and serving crosses gateway and authorization boundaries. Classifying a failing flow by its boundary first narrows the cause quickly.
Scope and limitations
Section titled “Scope and limitations”This verification sequence assumes the single-tenant AKS and air-gapped operating model described in this article. Environments with multi-cluster promotion, external-registry fallback, or a shared Istio control plane require additional verification for promotion policy, network boundaries, and shared-control-plane compatibility. This procedure should not be generalized unchanged to those environments.
External Exposure (HTTPS)
Section titled “External Exposure (HTTPS)”Kubeflow web apps use Secure Cookies, so login breaks over non-localhost HTTP. External
exposure therefore requires HTTPS. With no domain available, we use nip.io wildcard DNS
(kubeflow.<LB-IP>.nip.io).
Adopted configuration (B-2, TLS termination at the ingress controller):
Browser ──HTTPS──▶ ingress-nginx (TLS termination, self-signed) ──HTTP──▶ istio-ingressgateway:80 ──▶ kubeflow-gateway- Certificate: a cert-manager self-signed ClusterIssuer. The standard choice for air-gap (no external CA/ACME). Let’s Encrypt is not viable since it requires external connectivity.
- Files:
kubeflow/base/kubeflow-istio-resources/resources/ingress-certificate.yaml,.../resources/ingress.yaml - Inbound restriction: handled not by ingress rules but by the Azure LoadBalancer’s
loadBalancerSourceRanges(blocking at the network layer via NSG → safer).
Appendix: Design principles in one line each
Section titled “Appendix: Design principles in one line each”- Never touch the upstream. All changes go through overlay patches.
- Only two change mechanisms:
images:(registry) andpatches:(everything else). - Each overlay = one GitOps (Argo CD) Application 1:1. The batch script is a secondary path.
- The distribution’s
tests/*.shis the baseline. Always validate via render. - Pipelines go K8s-native (opt-2), aligned with declarative GitOps.
- air-gap = self-signed + internal registry mirroring. No dependence on external connectivity.
The source repository is private. The design rationale is summarized for public reading in ModelOps GitOps Architecture and Rationale.