A machine-readable index of this documentation for AI agents is available at https://kubevela.io/llms.txt. Markdown versions of documentation pages are available by appending .md to their URLs.
Skip to main content
Version: Next

Deploy an Advanced Application

This guide takes one application to two environments: it deploys to development, waits for you to approve, and then deploys to production with more replicas and different settings. Along the way it introduces policies and workflows.

It follows on from Deploy First Application.

Policies and workflows​

Components and traits say what to run and how. Two more parts of an Application say where and when:

  • Policies describe where and with what changes an application is deployed. A topology policy picks the clusters and namespace; an override policy changes component properties or traits for one environment. The policies reference lists the rest.
  • The workflow is the ordered list of steps that delivers the application. A deploy step deploys with the policies it names; a suspend step waits until someone resumes it. Others send notifications, call webhooks or group steps; see the workflow steps reference.

Put together: the same component goes to development with one set of policies, the workflow waits, and then it goes to production with another set.

Create the production namespace​

The production deployment goes to a prod namespace, which must exist before deploying:

kubectl create namespace prod

Create the application​

Save the following as advanced-app.yaml:

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
name: advanced-app
namespace: default
spec:
components:
- name: backend-api
type: webservice
properties:
image: oamdev/hello-world
ports:
- port: 8000
expose: true
env:
- name: APP_ENV
value: "development"
traits:
- type: scaler
properties:
replicas: 1

policies:
# Where development runs
- name: env-development
type: topology
properties:
clusters: ["local"]
namespace: "default"

# Where production runs
- name: env-production
type: topology
properties:
clusters: ["local"]
namespace: "prod"

# What changes in production
- name: production-configs
type: override
properties:
components:
- name: backend-api
properties:
env:
- name: APP_ENV
value: "production"
traits:
- type: scaler
properties:
replicas: 3

workflow:
steps:
- name: deploy-to-dev
type: deploy
properties:
policies: ["env-development"]

- name: manual-approval
type: suspend
properties:
message: "Please review the development deployment before promoting to production"

- name: deploy-to-prod
type: deploy
properties:
policies: ["env-production", "production-configs"]
PartWhat it does
backend-apiOne web service with 1 replica and APP_ENV=development.
env-developmentDeploys to the default namespace of the local cluster, the one KubeVela runs in.
env-productionDeploys to the prod namespace of the same cluster.
production-configsIn production, sets APP_ENV=production and 3 replicas.
deploy-to-devDeploys with the development policy.
manual-approvalWaits for you, showing its message.
deploy-to-prodDeploys with the production policies.

Deploy to development​

vela up -f advanced-app.yaml

The workflow deploys to development and stops at the approval step:

vela status advanced-app -n default
expected output
About:

Name: advanced-app
Namespace: default
Created at: 2026-11-22 22:04:28 +0000 GMT
Healthy: ✅
Details: workflowSuspending

Workflow:

mode: StepByStep-DAG
finished: false
Suspend: true
Terminated: false
Steps
- id: 5yz1bd5o7t
name: deploy-to-dev
type: deploy
phase: succeeded
- id: os4jpov5sk
name: manual-approval
type: suspend
phase: suspending
message: Please review the development deployment before promoting to production

Services:

- Name: backend-api
Cluster: local
Namespace: default
Type: webservice
Health: ✅
Message: Ready:1/1
Traits:
Type: scaler
Health: ✅

Check the development deployment at http://localhost:8001:

vela port-forward advanced-app -n default 8001:8000

Approve production​

Happy with development? Resume the workflow:

vela workflow resume advanced-app -n default
expected output
Successfully resume workflow: advanced-app

The workflow carries on to deploy-to-prod. Check the status again:

vela status advanced-app -n default
expected output
...
Services:

- Name: backend-api
Cluster: local
Namespace: prod
Type: webservice
Health: ✅
Message: Ready:3/3
Traits:
Type: scaler
Health: ✅

- Name: backend-api
Cluster: local
Namespace: default
Type: webservice
Health: ✅
Message: Ready:1/1
Traits:
Type: scaler
Health: ✅

One component, two deployments: 1 replica in default, 3 in prod. To see the production settings:

kubectl get deployment backend-api -n prod -o jsonpath='{.spec.template.spec.containers[0].env}'
[{"name":"APP_ENV","value":"production"}]

And to open production at http://localhost:8002:

kubectl port-forward -n prod svc/backend-api 8002:8000

Run it again​

Change anything in advanced-app.yaml and run vela up again: the workflow starts from the top, deploys to development, and waits for your approval before production changes. To run the workflow again without a change:

vela workflow restart advanced-app -n default

Clean up​

vela delete advanced-app -n default -y
kubectl delete namespace prod

Troubleshooting​

The workflow is still suspended

That's the approval step waiting. vela status advanced-app -n default shows phase: suspending on manual-approval; resume it with vela workflow resume advanced-app -n default.

The production deployment fails

Check the prod namespace exists with kubectl get namespace prod, and look at the resources behind each environment:

vela status advanced-app -n default --tree --detail
Production has the development settings

Check deploy-to-prod names both env-production and production-configs, and that the override's component name matches the component (backend-api).

Next steps​