Deliver with GitOps
The Quickstart used ksail workload apply to push manifests straight at a cluster.
That’s great for experimenting, but real environments should be driven by GitOps: your manifests are
the source of truth, KSail packages them as a versioned OCI artifact, and a GitOps engine
(Flux or ArgoCD) continuously reconciles the cluster to match. This is the
workflow KSail is built around, and the one that scales from your laptop to production unchanged.
The GitOps loop
Section titled “The GitOps loop”edit k8s/ ──► ksail workload push ──► ksail workload reconcile ──► Flux/ArgoCD applies ▲ (compile + (tell the engine │ └──────────────── push OCI artifact) to pull & apply) ──────────────┘ksail workload pushcompiles your source directory and pushes it as an OCI artifact to a registry.ksail workload reconciletriggers the in-cluster GitOps engine to pull that artifact and apply it.
1. Initialize a GitOps project
Section titled “1. Initialize a GitOps project”mkdir gitops-demo && cd gitops-demoksail cluster init \ --name gitops-demo \ --distribution K3s \ --gitops-engine Flux \ --local-registry localhost:5050This scaffolds a ksail.yaml with a GitOps engine and a local OCI registry already wired up:
# ksail.yaml (excerpt)apiVersion: ksail.io/v1alpha1kind: Clustermetadata: name: gitops-demospec: cluster: distribution: K3s gitOpsEngine: Flux localRegistry: registry: localhost:5050 workload: sourceDirectory: k8s2. Create the cluster
Section titled “2. Create the cluster”ksail cluster createKSail provisions the cluster, installs the GitOps engine, and bootstraps it to watch the local registry —
no separate flux bootstrap step required.
3. Push and reconcile
Section titled “3. Push and reconcile”Add or edit manifests under k8s/, then:
ksail workload push # compile k8s/ and push the OCI artifactksail workload reconcile # tell Flux to pull and apply itWatch it converge:
ksail workload get pods -AEvery change from now on is the same two commands — or just a git push once you wire push/reconcile
into CI/CD.
4. Add a second environment
Section titled “4. Add a second environment”The same project can describe many clusters. Keep a second config — say ksail.prod.yaml — and target it
with --config:
# Validate the prod config's manifests offline — no cluster neededksail --config ksail.prod.yaml workload validate
# Deliver to prodksail --config ksail.prod.yaml workload pushksail --config ksail.prod.yaml workload reconcile--config is the backbone of multi-environment work: one repository, one workflow, a config per
environment. See the Multi-Environment guide for the full pattern.
What’s next
Section titled “What’s next”-
Project Structure & GitOps Layout → — how a flat
k8s/grows into a layered repository (shared bases, provider overlays, per-cluster overlays) as you add environments. -
GitOps Workflows → — Flux and ArgoCD in depth: artifacts, reconciliation, and failure diagnostics.
-
Reference Architecture → — what a complete multi-environment KSail platform looks like end to end.