Skip to content

Getting Started

llms.txt lists every page for an agent
Optional: hand this page to your coding agentThe steps work by hand too.
Show the whole prompt
Read https://intentius.io/chant/lexicons/k8s/getting-started/.
In a new directory, install the k8s lexicon, write the `WebApp` from the page in `src/infra.k8s.ts`, and run `npx chant build --output dist/manifests.yaml`.
Create a local k3d cluster, apply the manifests to it, check that the pods are ready, and show me the output. Delete the cluster when you are done.
Never deploy to a real cloud account or shared environment (with `chant run`, `chant components` or a platform's own CLI), approve (a pull request review, `chant approve` or `chant run approve`), override a policy denial (`chant approve policy-override`), or merge; never cut or publish a release (`chant release cut --yes` or `chant release publish`), push or delete a `ci/*` tag (`chant ci tick` pushes them), or change the value of an existing flag; never touch `.chant/allowed_signers` or `chant/lifecycle`.

You write TypeScript, and chant builds it into Kubernetes YAML for kubectl apply.

Terminal window
npm install --save-dev @intentius/chant @intentius/chant-lexicon-k8s

Start with the WebApp composite, one function call that returns a Deployment, a Service and an optional Ingress:

src/infra.k8s.ts
import { WebApp } from "@intentius/chant-lexicon-k8s";
const app = WebApp({
name: "hello",
image: "nginx:1.25",
port: 80,
replicas: 2,
});
export const { deployment, service } = app;

Build and deploy:

Terminal window
# Generate YAML manifests
chant build --output dist/manifests.yaml
# Validate against the cluster API (no changes applied)
kubectl apply -f dist/manifests.yaml --dry-run=server
# Apply for real
kubectl apply -f dist/manifests.yaml

You can also call the resource constructors directly:

src/infra.k8s.ts
import { Deployment, Service, Container, Probe } from "@intentius/chant-lexicon-k8s";
export const deployment = new Deployment({
metadata: { name: "hello", labels: { "app.kubernetes.io/name": "hello" } },
spec: {
replicas: 2,
selector: { matchLabels: { "app.kubernetes.io/name": "hello" } },
template: {
metadata: { labels: { "app.kubernetes.io/name": "hello" } },
spec: {
containers: [
new Container({
name: "web",
image: "nginx:1.25",
ports: [{ containerPort: 80, name: "http" }],
livenessProbe: new Probe({ httpGet: { path: "/", port: 80 } }),
readinessProbe: new Probe({ httpGet: { path: "/", port: 80 } }),
}),
],
},
},
},
});
export const service = new Service({
metadata: { name: "hello" },
spec: {
selector: { "app.kubernetes.io/name": "hello" },
ports: [{ port: 80, targetPort: 80, name: "http" }],
},
});

Composites return plain prop objects. Resource constructors (new Deployment(...)) accept the same shape. Both produce identical YAML.

chant