Deploy your first app

Create an app and a deployment in the web app, push a change, and watch Wardn render a snapshot, apply it and report health, with the same steps through the API.

This guide deploys a small web service from git and then changes it with a push. It is the whole loop Wardn is built around: an app says where manifests come from, a deployment says where the app runs and how new versions arrive, and every push becomes a snapshot that is applied and then watched. The quickstart does the same with one ConfigMap; here you deploy a real workload and look at each stage.

You need:

  • A connected cluster (Connect a cluster). The examples call it dev.
  • A git repository you can push to, readable by Wardn: public over https://, or private through the GitHub App (Connect a source).
  • A person or token that may create apps (app:create) and manage deployments on the cluster (deployment:manage). The Owner of the organization holds both.

For the API tabs, set WARDN_API_URL and WARDN_TOKEN as in Connect a cluster and define the helper once:

api() { curl -fsS -H "Authorization: Bearer $WARDN_TOKEN" -H 'Content-Type: application/json' "$@"; }

What you will deploy

Three manifests in a deploy/web directory of the repository:

configmap.yaml
deployment.yaml
service.yaml

Give Wardn a namespace to deploy into

Wardn applies every deployment as the service account wardn-deployer in the deployment's namespace, so that account's permissions are the limit of what Wardn can change there. Make the namespace and the account once:

kubectl create namespace shop
kubectl -n shop create serviceaccount wardn-deployer
kubectl -n shop create rolebinding wardn-deployer --clusterrole=admin --serviceaccount=shop:wardn-deployer

Connect a cluster explains why, and how to bind a narrower role.

Put the manifests in git

Create the three files, commit them and push to main. They do not name a namespace: Wardn puts them in the deployment's.

deploy/web/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: web-config
data:
  GREETING: hello from git
deploy/web/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: web
spec:
  replicas: 2
  selector:
    matchLabels:
      app: web
  template:
    metadata:
      labels:
        app: web
    spec:
      containers:
        - name: web
          image: nginx:1.27-alpine
          ports:
            - containerPort: 80
          envFrom:
            - configMapRef:
                name: web-config
          readinessProbe:
            httpGet:
              path: /
              port: 80
deploy/web/service.yaml
apiVersion: v1
kind: Service
metadata:
  name: web
spec:
  selector:
    app: web
  ports:
    - port: 80
      targetPort: 80

The image has a tag, not a digest. When Wardn renders, it looks up the digest the tag points at and writes nginx:1.27-alpine@sha256:... into the snapshot, so the snapshot always means the same bytes even if the tag moves later. That lookup needs to reach the image's registry.

Create the app

An app is a source plus a render type. The source here is your repository and the deploy/web directory; the render type is Plain manifests, which reads the YAML and JSON files directly in that directory.

Open Deployments. On a fresh install the list is empty and offers New app; otherwise open /apps/new. Fill in:

SectionFieldValue
SourceSourceA new repository
KindGit repository
Repository URLthe https:// address of your repository
Pathdeploy/web
Credentialsempty for a public repository, or the github-app:<id> of your installation
Source nameleave empty to use the app's name
AppNameweb
Rendered withPlain manifests (the form starts on Helm)
Serviceschoose Add service: http, 80, http

Choose Create app. You land on the app's page, which lists its source, its services and, later, the deployments that run it.

Create the deployment

On the app's page, choose New deployment. The form opens with the app already chosen.

FieldValueWhy
Nameweb-devHow people and the API name this deployment.
Runs onCluster, then Cluster devWhere it applies. Environment would apply it to every cluster of an environment.
NamespaceshopThe namespace from the first step.
Snapshots arriveTrack a branch, Branch mainSync on push: every push to main makes a new snapshot.
PruneOrganization defaultWhether objects that leave the snapshot are deleted. See Deployment settings.
Observe onlyoffAn observing deployment renders and compares but never applies.

Choose Create deployment. You land on the deployment's page.

Watch the first snapshot arrive

A new deployment is first noticed by the one-minute check (how pushes arrive). Wardn then asks the repository where main points, renders the directory in a sandbox, pins the image to a digest and stores the result as a snapshot. The control plane signs an apply command, the operator in dev applies the objects as wardn-deployer, and waits for each object to become ready.

Open Deployments and then web-dev. The one status the deployment shows moves through Waiting for a snapshot, Applying and Progressing to Healthy. On the deployment:

  • The Apps tab shows each app at the snapshot it runs.
  • The Snapshots tab shows Snapshot history. Open the first snapshot to see where it came from (repository, branch, commit, who pushed) and what it holds.
  • The app's own pages have Resources (each object with its health), Logs, Events and Jobs.

Check the cluster:

kubectl -n shop get deploy,svc,cm

Every object Wardn applied carries the annotation wardn.dev/deployment. That mark is how Wardn knows what it owns: it only ever deletes objects that carry its own deployment's id.

Push a change

Edit the ConfigMap and set the replicas to three, then commit and push:

deploy/web/configmap.yaml
data:
  GREETING: hello again from git
deploy/web/deployment.yaml
spec:
  replicas: 3

Within a minute (at once if the repository has the GitHub App) a second snapshot appears. It holds the same objects with two changed, and Wardn applies it in order: the ConfigMap first, then the Deployment, because a wave must be ready before the next one starts (Jobs and waves).

On the Snapshots tab, the newest entry is the new snapshot with its commit and the person who pushed. Open it for the objects that changed. Live diff compares what Wardn wants with what is in the cluster, and Compare snapshots compares any two snapshots.

kubectl -n shop get deploy web
kubectl -n shop get cm web-config -o jsonpath='{.data.GREETING}'

The Deployment shows three replicas and the ConfigMap shows the new greeting.

See what a bad change does

Change the image tag to one that does not exist, such as nginx:1.27-nope, and push. Wardn cannot turn the tag into a digest, so the render fails and no snapshot is made. The deployment keeps running its last good snapshot, untouched.

The deployment stays on the snapshot it had. The new commit is seen, but nothing newer appears under Snapshots.

Fix the tag and push; the next snapshot applies as usual. A change that renders but breaks at runtime is caught later and differently: the apply waits for the Deployment to become ready, and gives up after five minutes (Jobs and waves). A render that produces nothing, or removes most of what is running, is held for a person instead (Held snapshots).

Several apps can share one deployment, each at its own branch and with its own values, and one snapshot then covers all of them. The web form picks one app; add more with the API. See Apps.

Clean up

Delete the deployment from its Settings tab (Delete deployment) or with the API. Its history is kept. Deleting a deployment stops Wardn tracking and applying it. Delete the namespace to remove what it deployed.

api -X DELETE "$WARDN_API_URL/api/v1/deployments/$DEPLOYMENT_ID"
kubectl delete namespace shop

Next

Related: Snapshots, Sync and arrival, Health, Restore and rollback.

On this page