Skip to main content
Version: 6.x (Latest)

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:

  1. Define the deployments section of devspace.yaml
  2. Call the create_deployments function inside the pipelines section of devspace.yaml
  3. Execute the respective pipeline

1. Define Deployments

To deploy to Kubernetes using DevSpace, we need to define deployments in devspace.yaml:

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 files
  • api which is deployed from the component chart provided by DevSpace
  • payments which is deployed using a local Helm chart that is located in a folder
  • auth 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:

devspace.yaml
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 or devspace dev to deploy all deployments
  • devspace run-pipeline deploy-api to deploy only the component chart deployment named api
  • devspace run-pipeline deploy-ordered to
    1. First deploy auth (blocking)
    2. Then deploy api and payments in parallel

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.

<deployment_name> required string

Name of the deployment

helm required

Helm tells DevSpace to deploy this deployment via helm

releaseName required string

ReleaseName of the helm configuration

chart required

Chart holds the chart configuration and where DevSpace can find the chart

Source: Helm Repository
name required string

Name is the name of the helm chart to deploy. Can also be a local path or an oci url

version required string

Version is the version of the helm chart to deploy

repo required string

RepoURL is the url of the repo to deploy the chart from

username required string

Username is the username to authenticate to the chart repo. When using an OCI chart, used for registry auth

password required string

Password is the password to authenticate to the chart repo, When using an OCI chart, used for registry auth

Source: Local Filesystem
path required string

Path is the local path where DevSpace can find the artifact. This option is mutually exclusive with the git option.

Source: Git Repository
git required string

Git is the remote repository to download the artifact from. You can either use https projects or ssh projects here, but need to make sure git can pull the project. This option is mutually exclusive with the path option.

subPath required string

SubPath is a path within the git repository where the artifact lies in

branch required string

Branch is the git branch to pull

tag required string

Tag is the tag to pull

revision required string

Revision is the git revision to pull

cloneArgs required string[]

CloneArgs are additional arguments that should be supplied to the git CLI

disableShallow required boolean false

DisableShallow can be used to turn off shallow clones as these are the default used by devspace

disablePull required boolean false

DisablePull will disable pulling every time DevSpace is reevaluating this source

values required object

Values are additional values that should get passed to deploying this chart

valuesFiles required string[]

ValuesFiles are additional files that hold values for deploying this chart

displayOutput required boolean false

DisplayOutput allows you to display the helm output to the console

upgradeArgs required string[]

UpgradeArgs are additional arguments to pass to helm upgrade

templateArgs required string[]

TemplateArgs are additional arguments to pass to helm template

disableDependencyUpdate required boolean false

DisableDependencyUpdate disables helm dependencies update, default to false

kubectl required

Kubectl tells DevSpace to deploy this deployment via kubectl or kustomize

manifests required string[]

Manifests is a list of files or folders that will be deployed by DevSpace using kubectl or kustomize

applyArgs required string[]

ApplyArgs are extra arguments for kubectl apply

createArgs required string[]

CreateArgs are extra arguments for kubectl create which will be run before kubectl apply

kubectlBinaryPath required string

KubectlBinaryPath is the optional path where to find the kubectl binary

inlineManifest required string

InlineManifests is a block containing the manifest to deploy

Kustomize

kustomize required boolean false

Kustomize can be used to enable kustomize instead of kubectl

kustomizeArgs required string[]

KustomizeArgs are extra arguments for kustomize build which will be run before kubectl apply

kustomizeBinaryPath required string

KustomizeBinaryPath is the optional path where to find the kustomize binary

patches required object[]

Patches are additional changes to the pod spec that should be applied

target required

Target describes where to apply a config patch

apiVersion required string

ApiVersion is the Kubernetes api of the target resource

kind required string

Kind is the kind of the target resource (eg: Deployment, Service ...)

name required string

Name is the name of the target resource

op required string

Operation is the path operation to do. Can be either replace, add or remove

path required string

Path is the config path to apply the patch to

value required

Value is the value to use for this patch.

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.

namespace required string

Namespace where to deploy this deployment