What the agent does
The agent reads the flat manifests first and writes down what differs between environments in practice. In a repository like dockersamples/example-voting-app, k8s-specifications/ holds nine files: a Deployment and a Service each for vote, result, db and redis, plus worker-deployment.yaml with no Service. The README applies them with kubectl create -f k8s-specifications/. Everything is one shape for every environment: vote and result are NodePort Services pinned to 31000 and 31001, db runs postgres:15-alpine with POSTGRES_PASSWORD: postgres written as a literal env value and an emptyDir volume at /var/lib/postgresql/data, redis:alpine keeps /data in an emptyDir too, and the three app images (dockersamples/examplevotingapp_vote, _result, _worker) carry no tag. No manifest sets a namespace, resource requests or replica count above 1.
From that reading it builds k8s/base/ with the nine files moved in unchanged and a kustomization.yaml listing them as resources, so kubectl kustomize k8s/base renders exactly what the flat directory did. Then two overlays. k8s/overlays/dev/kustomization.yaml sets namespace: vote-dev, keeps the NodePort Services so the app is reachable on a local cluster, and adds a secretGenerator for the Postgres password with a patch that replaces the literal value in db-deployment.yaml with a secretKeyRef. k8s/overlays/prod/kustomization.yaml sets namespace: vote-prod, patches vote and result to two replicas, pins each image to a tag through the images transformer, swaps the db volume from emptyDir to a PersistentVolumeClaim added as a new resource, and changes the two front-end Services to ClusterIP so an Ingress of your choosing sits in front of them.
Each decision is a patch file, not a rewrite, so the base stays readable: k8s/overlays/prod/db-storage.yaml holds the PVC and the volume patch, replicas.yaml the replica change, and the Service type change is a strategic merge patch of a few lines. The agent then proves the result three ways in the sandbox: kubectl kustomize k8s/base diffed against the concatenated original files to show nothing in the base moved, kubectl kustomize k8s/overlays/dev and k8s/overlays/prod to show both render, and kubeconform -strict over each rendered stream to check the schemas. It updates the README so kubectl apply -k k8s/overlays/dev replaces the old create -f line.
What it does not do is guess at values it cannot know. The prod image tags are left as a clearly named placeholder in the images block with a comment pointing at the release that should fill them, the PVC asks for a size and no storage class, and no Ingress is added, because the hostnames are yours.
Start it with one API call
POST https://api.phoenix.so/o/{org}/sessions with this body:
{
"agent": "claude",
"input": "Convert the flat manifests in k8s-specifications/ into a Kustomize layout: move them unchanged into k8s/base with a kustomization.yaml, then add k8s/overlays/dev and k8s/overlays/prod. Dev sets its own namespace, keeps the NodePort services and moves the Postgres password into a secretGenerator with a secretKeyRef patch. Prod sets its own namespace, runs two replicas of vote and result, pins images by tag through the images transformer with a placeholder tag, gives the db Deployment a PersistentVolumeClaim instead of emptyDir, and makes the front-end services ClusterIP. Prove it: kubectl kustomize on the base must match the original files, both overlays must render, and kubeconform -strict must pass on each. Update the README's kubectl instructions and open a pull request that shows the three checks.",
"resources": [
{
"url": "https://github.com/your-org/your-app"
}
]
}- Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
- Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
- Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.
What comes back
The pull request moves the nine manifests under k8s/base/ with git recording them as renames, adds the base kustomization.yaml, and adds two overlay directories holding a kustomization.yaml and a handful of small patch files each. The README's apply command changes to the -k form. The description quotes the three checks: the empty diff between the rendered base and the original files, the rendered resource counts for each overlay, and the kubeconform summary for both.
A reviewer reads the prod overlay for the two things that need a human decision, the image tags and the PVC size, and confirms the dev overlay still exposes the two NodePorts the team is used to. Because the base is byte-for-byte the old manifests, the review of that part is a glance at the rename list. Every kubectl kustomize and kubeconform run, with its full output, is in the session transcript at GET /o/{org}/sessions/{id}/messages.
Nothing is applied to a cluster. The run renders YAML and checks it; applying an overlay stays a kubectl apply -k someone runs with the right kubeconfig after the merge.
Run it on every new environment
The first run makes the base and two overlays. When a staging cluster or a per-developer namespace appears, send POST /o/{org}/sessions to the same repository with a prompt naming the new overlay and what differs in it, and the agent adds a third directory under k8s/overlays/ with the same patch style, re-rendering every overlay to show the base still matches. A request_id that is a UUID v5 of the environment name keeps a retried send from starting two runs.
Put a webhook URL on the API key and the handler that receives run.completed can open the pull request link in the channel where the platform team reviews manifests. The same request with a different repository URL in resources converts another service's manifests, one sandbox per run.
The use case this job follows, with its automation and trigger: Hand off a long task.
Why run it on Rush?
The conversion is mostly bookkeeping with a high cost for a slip: a patch that targets the wrong kind, a namespace that lands on a cluster-scoped resource, an image name that no longer matches the transformer. Running kubectl kustomize and kubeconform after every edit is what catches those, and in a sandbox that loop costs nothing and leaves its output in the transcript rather than in a scrolled-off terminal.
A pull request that shows the rendered base equals the old files is a different kind of change from one that asks the reviewer to trust a move. Several services' manifest directories can be converted at once, each in its own run with its own proof, and none of them needs cluster access.
Frequently asked questions
Will the rendered base really be identical to my current manifests?
Yes, and the run proves it: the base kustomization.yaml only lists the files, so kubectl kustomize k8s/base is the same documents in a canonical order. The diff the agent runs is quoted in the pull request; if some field had changed, the diff would show it.
Where do the prod image tags come from?
They are placeholders in the images block of the prod overlay with a comment saying what should set them, because the run cannot know your release process. Many teams have their deploy job run kustomize edit set image to fill them; ask for that in the prompt if you want the workflow step written too.
Does it add an Ingress for prod?
No. It switches the front-end Services to ClusterIP so an Ingress can route to them, but hostnames and TLS are yours to name. A follow-up message to the session with the hostnames adds the Ingress to the prod overlay in the same style.
What happens to the plain-text Postgres password?
In both overlays the literal value is replaced by a secretKeyRef and a secretGenerator produces the Secret. The generator still reads a literal in dev, which is fine for a local cluster; for prod the agent points the generator at an env file that is listed in .gitignore and says so in the pull request.
Does it need cluster access to run?
No. kubectl kustomize renders without a cluster and kubeconform validates against published schemas, so the sandbox needs no kubeconfig. Applying the result is a step you take after the merge.
More Kubernetes jobs
More jobs like this: Hand off a long task
- Add Kyverno Policies to a Flux Repository (Flux)
- Add Kyverno Policies to a GKE Deployment (GKE)
- Add Lambda Powertools to a Serverless Framework Node.js API (Serverless Framework)