ReferenceConsole commands

Reference

Console commands

The k8s:* commands the bundle registers: render, dump and make.

Every command the bundle registers, under the k8s: prefix: rendering to standard output, dumping to files, and scaffolding new classes. How to take the output to a cluster is in Rendering and deploying.

The environment for all of them is Symfony's: APP_ENV=prod bin/console k8s:render:apps.

Render: YAML to stdout

CommandArgumentsRenders
k8s:render:apps[apps-aliases…] (default: all)App manifests
k8s:render:helm[helm-releases…] (default: all)Helm releases (adds missing helm repos first)
k8s:render:all: alias k8s:render:everything: Apps first, then releases, one stream

Output is a multi-document YAML stream, documents joined with --- and each prefixed by a # File: comment naming its virtual path (# File: /shop/api.deployment.yaml). The stream is deterministic and pipe-friendly:

bin/console k8s:render:apps shop | kubectl diff -f -

Dump: YAML to files

CommandArgumentsDumps
k8s:dump:apps[apps-aliases…]App manifests
k8s:dump:helm[helm-releases…]Helm releases
k8s:dump:all: alias k8s:dump:both

Options (all three):

OptionMeaning
-D, --output-dir <dir>override the configured manifests_dir
-R, --recreate-output-dirdelete and recreate the target env directory first: guarantees no stale files from removed manifests

The output base is always suffixed with the current environment, then split by origin:

<manifests_dir>/<env>/apps/<app-alias>/<short-name>.<kind>.yaml
<manifests_dir>/<env>/helm/<release>/<resource-name>.<kind>.yaml

Kinds are kebab-cased in file names (api.deployment.yaml, session-prune.cron-job.yaml). The # File: headers appear only in rendered streams, not in dumped files: dumped YAML is exactly what kubectl will see.

Without -R, dumping never deletes: a manifest you removed from code leaves its old file behind. Use -R (or a fresh -D target) for anything that feeds a deploy.

Make: scaffolding

CommandArgumentsCreates
k8s:make:app <name>App name without the App suffix (shop → ShopApp)the App class plus its Manifest/, Container/, and Resources/ directories
k8s:make:manifest <name> [type]manifest short name (DNS-subdomain-validated) + kinda manifest class in the chosen App

k8s:make:manifest options and behavior:

  • --app=<alias> selects the target App; omitted, the command asks interactively: as it does for the type argument.
  • Available kinds out of the box: config-map, cron-job, deployment, ingress, job, secret, service. Kinds without a template (StatefulSet, HPA, PVC, RBAC, Gateway API, …) are written by hand: the manifest types reference is the map.
  • The generator refuses duplicate short names per kind within an App, and validates the name against Kubernetes' DNS-subdomain rules before writing anything.

Scaffolding targets are controlled by code_dir and namespace_prefix (see the configuration reference); the directory is created by the first command that writes there. The commands write a new class next to the App class they find. In a Phaenon project (a phaenon.json beside composer.json) the App class loads from a compiled output, so the class is written instead as Phaenon, from the templates under templates/phn/, into the source root that output is built from (src/ for .src/), and laid out by the project's own vendor/bin/phn fmt; the command's message names that path. When the formatter fails, the file stays written and the command fails with "<file>" was written, but "phn fmt" could not lay it out: … (what it writes).

The kind list is extensible: manifest generator contexts are tagged services (klass8s.manifest_generator.context), so a platform team can teach k8s:make:manifest its own house kinds: e.g. a worker type scaffolding your AbstractWorkerDeployment subclass.

Exit behavior

Render and dump commands succeed (exit 0) or fail with an uncaught exception: a missing referenced Secret, an invalid name, a failed helm template all abort the render with a stack trace rather than emitting partial output. Make commands print a friendly error and exit 1. There is deliberately no "best effort" mode: partial manifest streams applied to a cluster are worse than no stream. An App with no manifests renders nothing, without an error.

See also