okteto-preview
Okteto Preview Environments Skill
A Preview Environment is a live, production-like instance of the application deployed from a git branch, usually tied to the lifecycle of a pull request. Okteto deploys it into a dedicated namespace named after the preview and gives you shareable URLs, so reviewers, PMs, and stakeholders can click through real functionality without any local setup.
This skill covers two jobs that meet in one ownership model: driving previews directly with the CLI (deploy a branch, hand back the URL) and authoring the CI automation that owns previews per-PR. Before touching a preview, know which of the two owns it — that decides who redeploys it, who posts its URL, and who tears it down.
Operating rules
- Previews deploy from the pushed branch, not your working tree.
okteto preview deployclones the repository at--branchand deploys that. Local uncommitted changes never reach a preview. Committing and pushing the developer's work is their call — in collaborative mode, show what's uncommitted and confirm before committing or pushing anything on their behalf. In autonomous mode, push the task branch you own before deploying. - Always name the preview explicitly (e.g.
pr-1234), and make it a valid name (see Naming previews). Redeploying with the same name updates the same preview; omitting the name generates a random one that CI and cleanup jobs can never find again. - Use a preview to share, a namespace to work. Iterating on code belongs in a dev environment (
oktetoskill). A preview is the artifact you hand to reviewers — it has no file sync and no dev containers of yours attached. - Never destroy a preview you did not create. Same doctrine as the
oktetoskill's cleanup rules: a preview you created for your own task is yours to destroy; shared/global previews and CI-owned previews are not (see Cleanup and teardown). - In CI, the pipeline owns the lifecycle. Deploy on PR open/update, destroy on PR close — via
okteto/deploy-previewandokteto/destroy-preview(GitHub) orokteto preview deploy/destroyjobs (GitLab).
Preview vs. namespace: which environment does this task need?
Both give you an isolated, deployed copy of the application. They answer different questions: