Deployments
The deployments
section in devspace.yaml
defines Helm charts, Kubernetes manifests and Kustomizations that can deployed using the create_deployments
function.
Workflow
To deploy resources with DevSpace, you need to:
- Define the
deployments
section ofdevspace.yaml
- Call the
create_deployments
function inside thepipelines
section ofdevspace.yaml
- Execute the respective pipeline
1. Define Deployments
To deploy to Kubernetes using DevSpace, we need to define deployments
in devspace.yaml
:
version: v2beta1
deployments:
configs:
kubectl:
manifests:
- ./api/deploy/configmap.yaml
- ./payments/deploy/configmap.yaml
api:
helm:
chart:
name: component-chart
repo: https://charts.devspace.sh
values:
containers:
- image: ghcr.io/loft-sh/devspace-example-api
service:
ports:
- port: 8080
payments:
helm:
chart:
name: ./payments/chart/
valuesFiles:
- ./payments/helm-values-dev.yaml
auth:
helm:
chart:
name: auth-server-chart
version: 3.2.1
repo: https://mycompany.tld/helm/
values:
...
The example above defines 4 deployments:
configs
which deploys two ConfigMap objects to Kubernetes from plain manifest filesapi
which is deployed from the component chart provided by DevSpacepayments
which is deployed using a local Helm chart that is located in a folderauth
which is deployed from a chart that has been pushed to a Helm repository
2. Call create_deployments
in Pipeline
DevSpace deploys resources to Kubernetes when the create_deployments
function is called within pipelines
as shown in this example:
version: v2beta1
pipelines:
dev: |-
create_deployments --all
start_dev --all
deploy: |-
build_images --all
create_deployments --all
deploy-api: |-
create_deployments api
deploy-ordered: |-
create_deployments auth
create_deployments api payments
deployments:
api: ... # see example above
payments: ... # see example above
auth: ... # see example above
3. Run Pipeline
Given the example above, you can now run:
devspace deploy
ordevspace dev
to deploy all deploymentsdevspace run-pipeline deploy-api
to deploy only the component chart deployment namedapi
devspace run-pipeline deploy-ordered
to- First deploy
auth
(blocking) - Then deploy
api
andpayments
in parallel
- First deploy
Config Reference
deployments
required <deployment_name>:object
Deployments holds configuration of how DevSpace should deploy resources to Kubernetes. By default, DevSpace will deploy all defined deployments.
If you are using a custom pipeline, you can dynamically define which deployment is deployed at which time during the
execution.
deployments
required <deployment_name>:object <deployment_name>
required string
Name of the deployment
<deployment_name>
required string helm
required
Helm tells DevSpace to deploy this deployment via helm
helm
required kubectl
required
Kubectl tells DevSpace to deploy this deployment via kubectl or kustomize
kubectl
required updateImageTags
required boolean true
UpdateImageTags lets you define if DevSpace should update the tags of the images defined in the
images section with their most recent built tag.
updateImageTags
required boolean true namespace
required string
Namespace where to deploy this deployment
namespace
required string