Skip to content

Kubeflow GitOps Deployment (Air-gapped on Azure AKS)

Interactive Diagram

새 탭 ↗

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.


  • Goal: Operate the entire Kubeflow platform (including Notebooks) via GitOps in an air-gapped environment.
  • Baseline: The distribution’s CI-verified tests/*.sh install 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).

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.

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.

AspectDefault distributionAfter GitOps re-architecture
Change trackingResult exists only in the clusterAll intent is declaratively in Git
air-gapReferences external registries (quay.io, etc.)Rewritten to internal registry (images:)
CustomizationTempts direct edits to upstream manifestsNon-invasive injection via overlay patches
ReproducibilityDepends on re-running scriptsSame commit → same result
UpgradesManual diffSwap the upstream reference, then rebuild
  1. Never touch the upstream (applications/, common/). Update it only via upstream sync.
  2. Inject environment-specific changes only through overlays under overlays/dev/.
  3. Limit change mechanisms to two (the patch strategy below). No runtime policy engine (Kyverno, etc.).

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 name and namespace agree.
  • 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 preview of ModelOps post-deployment component placement and relationships by namespace Interactive Diagram
  • Role: Create the Kubeflow namespaces (kubeflow, and the transitional kubeflow-system).
  • Structure: See common/kubeflow-namespace/base.
  • Overlay: namespace/
  • 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.
  • 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.
  • Role: Extend the Istio Ingress-Gateway into an OIDC client. User sessions + M2M token authentication.
  • Structure: Adopts the m2m-dex-and-kind overlay (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).
  • Role: Create kubeflow-gateway (an istio Gateway) and the kubeflow-istio-admin ClusterRole.
  • 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).
  • Role: Install the multi-tenancy Kubeflow ClusterRoles (admin/edit/view).
  • Structure: See common/kubeflow-roles/base.
  • Overlay: kubeflow/base/roles
  • Role: OIDC IdP. Provides the default static user (user@example.com); the auth namespace.
  • 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).
  • 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).
  • 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).
  • Role: Event handling such as inference request logging (optional component).
  • Structure: knative-eventing/overlays/security.
  • Overlay: knative-eventing/overlays/security
  • 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/PipelineVersion custom 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).
  • 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.
  • 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.
  • 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 crds and platform causes a duplicate-id build error because the platform bundle already includes the CRDs. Split into two sub-parts and apply in order. Namespace is kubeflow-system. Waiting on the webhook caBundle, restarting the jobset rollout, etc. remain imperative steps.
  • 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).
  • 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 baseline label remain imperative steps. It must exist before the model-registry (14).

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 build to declaratively sync cluster state.
  • Ordering: The argocd.argoproj.io/sync-wave annotation 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. The NN numbers 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 requires syncPolicy.automated.selfHeal: true, and deleting resources that were removed from Git requires prune: 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/v1alpha1
kind: Application
metadata:
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=true

Without selfHeal and prune, Argo CD reports the difference and fixes nothing.

Interactive diagram preview of the staged ModelOps component installation order and dependencies 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.

Terminal window
# 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.sh

Imperative 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)

Air-gap mirroring targets are split across three files under overlays/dev/.

FileActive imagesRole
images-origin.txt109Full extraction from kustomize build + ConfigMap/args, as upstream (includes examples/large images, pre-processing)
images-dev.txt93The 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.txt18 (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 targetFailure signalHow to check
Overlay image rewriteReference to an external registry or an unintended tagInspect image references in rendered output
Mirror inventoryA Pod remains in ImagePullBackOffCompare the mirror target list with registry state
Images inside ConfigMaps or argsOrdinary container images work, but a specific runtime fails to pullExtract 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.

  1. A browser login creates a session and reaches the Dashboard.
  2. A workload can be created in a Profile namespace.
  3. A Pipeline or training workload pulls its image from the internal mirror.
  4. An artifact can be written to object storage and retrieved again.
  5. 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.

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.


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) and patches: (everything else).
  • Each overlay = one GitOps (Argo CD) Application 1:1. The batch script is a secondary path.
  • The distribution’s tests/*.sh is 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.