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 releaseName
required string
ReleaseName of the helm configuration
releaseName
required string chart
required
Chart holds the chart configuration and where DevSpace can find the chart
chart
required name
required string
Name is the name of the helm chart to deploy. Can also be a local path or an oci url
name
required string version
required string
Version is the version of the helm chart to deploy
version
required string repo
required string
RepoURL is the url of the repo to deploy the chart from
repo
required string username
required string
Username is the username to authenticate to the chart repo. When using an OCI chart, used for registry auth
username
required string password
required string
Password is the password to authenticate to the chart repo, When using an OCI chart, used for registry auth
password
required string path
required string
Path is the local path where DevSpace can find the artifact.
This option is mutually exclusive with the git option.
path
required string 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.
git
required string subPath
required string
SubPath is a path within the git repository where the artifact lies in
subPath
required string branch
required string
Branch is the git branch to pull
branch
required string tag
required string
Tag is the tag to pull
tag
required string revision
required string
Revision is the git revision to pull
revision
required string cloneArgs
required string[]
CloneArgs are additional arguments that should be supplied to the git CLI
cloneArgs
required string[] disableShallow
required boolean false
DisableShallow can be used to turn off shallow clones as these are the default used
by devspace
disableShallow
required boolean false disablePull
required boolean false
DisablePull will disable pulling every time DevSpace is reevaluating this source
disablePull
required boolean false values
required object
Values are additional values that should get passed to deploying this chart
values
required object valuesFiles
required string[]
ValuesFiles are additional files that hold values for deploying this chart
valuesFiles
required string[] displayOutput
required boolean false
DisplayOutput allows you to display the helm output to the console
displayOutput
required boolean false upgradeArgs
required string[]
UpgradeArgs are additional arguments to pass to helm upgrade
upgradeArgs
required string[] helm upgrade
templateArgs
required string[]
TemplateArgs are additional arguments to pass to helm template
templateArgs
required string[] helm template
disableDependencyUpdate
required boolean false
DisableDependencyUpdate disables helm dependencies update, default to false
disableDependencyUpdate
required boolean false kubectl
required
Kubectl tells DevSpace to deploy this deployment via kubectl or kustomize
kubectl
required manifests
required string[]
Manifests is a list of files or folders that will be deployed by DevSpace using kubectl
or kustomize
manifests
required string[] applyArgs
required string[]
ApplyArgs are extra arguments for kubectl apply
applyArgs
required string[] kubectl apply
createArgs
required string[]
CreateArgs are extra arguments for kubectl create
which will be run before kubectl apply
createArgs
required string[] kubectl create
which will be run before kubectl apply
kubectlBinaryPath
required string
KubectlBinaryPath is the optional path where to find the kubectl binary
kubectlBinaryPath
required string inlineManifest
required string
InlineManifests is a block containing the manifest to deploy
inlineManifest
required string kustomize
required boolean false
Kustomize can be used to enable kustomize instead of kubectl
kustomize
required boolean false kustomizeArgs
required string[]
KustomizeArgs are extra arguments for kustomize build
which will be run before kubectl apply
kustomizeArgs
required string[] kustomize build
which will be run before kubectl apply
kustomizeBinaryPath
required string
KustomizeBinaryPath is the optional path where to find the kustomize binary
kustomizeBinaryPath
required string patches
required object[]
Patches are additional changes to the pod spec that should be applied
patches
required object[] 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