Build and deploy
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.
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:
| Setting | Where | Effect |
|---|---|---|
cache_build | The system configuration | Every 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_deploy | The 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:
| File | What it gives you |
|---|---|
Tiltfile | A 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.md | The 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.
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:
| Way | How it works | When to use it |
|---|---|---|
| kubectl | You, or your CI, run the commands above | The default |
| The stack agent's deploy arm | The agent applies a committed branch in a fixed order: jobs removed first, server-side apply, then a bounded wait for every rollout | When the stack opts in with the agent's deploy_access attribute. Without it the agent has no permission to write |
| Argo CD | An Argo CD component generates one Application per managed component and keeps it in sync with git | When the stack should deploy itself from every commit |
Argo CD
Which components Argo CD manages is decided on the graph:
| On the graph | What Argo CD manages |
|---|---|
gitops off | Nothing — Argo CD is installed and idle |
gitops on, no links from Argo CD | Every component in the stack except cert-manager |
gitops on, links to some components | Only 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 component | That stack's Argo CD manages it |
| A link between two Argo CD components | Multi-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 attribute | Effect |
|---|---|
argocd_self_heal_enabled | Automatic 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_enabled | Off 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_mode | auto: 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_duration | Retries of a failed sync; raise them for a component whose first sync races its CRDs or its network policies |
argocd_ignore_rbac_drift | Off: roles and bindings are enforced from git. On: only for an operator that rewrites its own roles |
argocd_custom_ignore_differences, argocd_skip_schema_validation | Extra ignore rules for this Application; schema validation off for a CRD that rejects a valid manifest |
imageupdater_update_strategy, imageupdater_allow_tags | For applications with the image updater on: latest, semver, digest or name, and which tags qualify |
argocd_app_project | The Argo CD project of this Application |
build_hook | On 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:
| Generated | When |
|---|---|
| Jobs as sync hooks | A 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 Application | automate_networkpolicies on: syncs the generated policies, prunes the dropped ones, retries while namespaces appear |
| Runtime tools for the MCP server | A 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.
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.
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.
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.