Skip to main content

Build and deploy

Delivery
Two commands, repeatable forever

Images are built inside the cluster. Manifests are applied with kustomize. Both steps are designed to be run again at any time without special handling.

IMAGESGITyour app repositoryin-cluster buildNO LOCAL DOCKERsourceimageYOUR REGISTRYMANIFESTSGITyour stack repositorybase · overlaysencrypted secretsdecryptOFFLINE · YOUR KEYapply -kSAFE TO REPEATCLUSTERdevelopmentsame base · own overlaystagingsame base · own overlayproductionsame base · own overlaypulled
Two lanes into the cluster. Your code becomes an image built inside the cluster; your stack repository is decrypted offline with your key and applied with kustomize, one overlay per environment.

Build images in the cluster​

Container images are built by an in-cluster builder from the generated build manifests. There is no local container daemon in the loop, no image pushed from a laptop, and no credential that has to leave the cluster.

kubectl apply -k k8s/build/base/<component>/

For every environment at once, apply the build overlay instead:

kubectl apply -k k8s/build/overlays/<environment>/ --server-side=true --force-conflicts=true

The loop for an application change is therefore: edit the code in your application repository → build → deploy. The stack itself only changes when the graph changes.

Two settings shorten that loop:

SettingWhereEffect
cache_buildThe system configurationEvery application build pushes its layers to a sibling repository <component>-cache in your registry and reads them back on the next build, so a code-only change reuses the dependency layers. A cache miss or a failed cache push never fails a build
push_and_deployThe application component (and the MCP server)The build Job records the digest of the image it pushed and rolls the Deployment onto exactly that image. A failed push leaves the running version alone

Develop against the cluster​

Each application component's folder in the stack repository carries a dev_tools/ kit:

FileWhat it gives you
TiltfileA live-update loop against the cluster, generated from the component's framework_type — Spring, Node.js, Python frameworks, Rails, Laravel or generic — so a code change syncs into the running pod instead of waiting for an image
AGENTS.mdThe brief for any AI coding agent working on the application: where the source of truth is, and what the stack has already wired, so the agent writes application code instead of rebuilding what the stack provides
spec-kit/Spec-driven development, with a constitution generated from the actual stack — switched on for the whole stack by the MCP component's ai_workflow attribute

Deploy​

kubectl apply -k k8s/deploy/base/<component> --server-side=true --force-conflicts=true

Or the whole environment:

kubectl apply -k k8s/deploy/overlays/<environment>/ --server-side=true --force-conflicts=true

Two generated folders sit outside the overlays and are applied on their own — the network policies the links imply, and the cluster roles granted to people:

kubectl apply -f networkpolicy/
kubectl apply -f rbac/rbac.yaml

With Argo CD and its automate_networkpolicies attribute on, the network policies are synced by their own Application instead — see Network policies.

The apply contract

kubectl apply -k must always succeed, and must always be safe to repeat. That is a design rule for everything the platform generates, not an aspiration — it is what makes moving a cluster to a new stack version a single idempotent command rather than a runbook.

The one exception is a Kubernetes Job, whose spec is immutable once created: those are deleted before being re-applied.

If you see no matches for kind ... in version ... on a first install, apply again. It means a custom resource was applied in the same pass that installed its definition.

Three ways to apply​

The same rendered files reach the cluster in one of three ways:

WayHow it worksWhen to use it
kubectlYou, or your CI, run the commands aboveThe default
The stack agent's deploy armThe agent applies a committed branch in a fixed order: jobs removed first, server-side apply, then a bounded wait for every rolloutWhen the stack opts in with the agent's deploy_access attribute. Without it the agent has no permission to write
Argo CDAn Argo CD component generates one Application per managed component and keeps it in sync with gitWhen the stack should deploy itself from every commit

Argo CD​

Which components Argo CD manages is decided on the graph:

On the graphWhat Argo CD manages
gitops offNothing — Argo CD is installed and idle
gitops on, no links from Argo CDEvery component in the stack except cert-manager
gitops on, links to some componentsOnly the linked ones — the recommended way. With no links, drawing the first one later shrinks the managed set, and the Applications of the other components stay until someone deletes them
Another stack's Argo CD links a componentThat stack's Argo CD manages it
A link between two Argo CD componentsMulti-cluster: one Argo CD manages the stacks of other clusters — see External stacks

argocd_mode decides when it syncs: Automatic applies every new commit, Manual waits for someone to press Sync. Every Application tracks the branch or tag in argocd_target_revision — normally the build branch, see The stack repository.

Each argo_cd-<type> link tunes its one Application:

Link attributeEffect
argocd_self_heal_enabledAutomatic mode only: re-sync a drifted resource at once, then with backoff. Off by default for CloudNativePG and MongoDB; turn it off for an application changed by a development loop
argocd_prune_enabledOff by default: a resource that leaves git stays in the cluster. On: it is deleted at the next sync — the data guard below still refuses volumes, definitions and data resources
argocd_replicas_modeauto: replicas are ignored only where the diagram owns the count (the component's autoscaler attribute or a KEDA scaler); ignore or enforce to decide yourself
argocd_sync_retry_limit, argocd_sync_retry_max_durationRetries of a failed sync; raise them for a component whose first sync races its CRDs or its network policies
argocd_ignore_rbac_driftOff: roles and bindings are enforced from git. On: only for an operator that rewrites its own roles
argocd_custom_ignore_differences, argocd_skip_schema_validationExtra ignore rules for this Application; schema validation off for a CRD that rejects a valid manifest
imageupdater_update_strategy, imageupdater_allow_tagsFor applications with the image updater on: latest, semver, digest or name, and which tags qualify
argocd_app_projectThe Argo CD project of this Application
build_hookOn a link to Dagster, the MCP server or the stack agent: their image builds run as an Argo CD sync hook of a <name>-build Application, triggered when the generated build source changes

What else the Argo CD component generates:

GeneratedWhen
Jobs as sync hooksA component's setup Jobs (database grants, seeding, the single sign-on sync) become Argo CD hooks when Argo CD manages that component. Each sync deletes the old Job and creates it again, so an immutable finished Job never blocks an apply
The networkpolicy Applicationautomate_networkpolicies on: syncs the generated policies, prunes the dropped ones, retries while namespaces appear
Runtime tools for the MCP serverA fastmcp-argo_cd link: argocd_flow_check (sync, health, failed hooks, workloads not ready beneath custom resources, out-of-memory kills, the data guard), argocd_why_out_of_sync, argocd_refresh_application, and with write_access on the link, sync and terminate

The Applications themselves are applied with the Argo CD component's own folder: after changing an Argo CD setting or link, build and apply that folder once.

Argo CD never deletes data

Pruning and cascade deletion are off on every Application, and the Argo CD component installs an admission policy that refuses any deletion by Argo CD of volumes, namespaces, resource definitions and database or storage resources — whatever a person clicks. Removing data stays a deliberate action outside Argo CD.

Argo CD and the platform's own kubectl apply --server-side work on the same objects without fighting, so either can deploy at any time. A changed secret or configuration is applied but read only by new pods: add a Reloader component when a configuration change should restart the pods that use it.

Environments​

The base tree is shared; each environment is an overlay carrying only what differs — replica counts, resource sizes, domains, which optional components exist.

An environment is not a branch and not a copy of the design. It is the same graph rendered again with different values, which is why promoting a change between environments is a value change rather than a merge.

Secrets in the repository​

Secrets are encrypted in the repository. Decryption is a local, offline step that runs before kustomize, using a key you hold:

export SOPS_AGE_KEY_FILE=<your key file>
scripts/stacktic/decrypt-secrets.sh

Nothing contacts a key service, and nothing decrypts inside CI unless you put the key there deliberately.

→ Identity and secrets

Validate the result​

scripts/stacktic/validate-all.sh

The generated repository also carries per-component documentation and a rendered architecture diagram for the whole system, so the repository explains itself without a separate wiki.

Air-gapped installation​

The same stack installs with no internet access. Set the section value air_gapped to true and the build inventories every image the stack references, writes a migration script that copies them into the registry on your configuration page, and rewrites the kustomizations to pull from there. You run the script once, then apply as usual.

The graph, the policies and the validation surface are the same stack's; what moves is where images come from — and your registry has to be on the image policy's allowed list.

→ Air-gapped installation

Rolling behaviour​

Workloads whose storage can only be attached to one node at a time roll with a surge of zero rather than being torn down first. The pod is replaced in place, the volume is never contended, and the deployment is still a rolling update — so a failed new version does not leave you with nothing running.