Deploy Kubernetes Manifests
To deploy Kubernetes manifests with kubectl apply
, you need to configure them within the deployments
section of the devspace.yaml
.
#
ExampleThe above example will be executing during the deployment process as follows:
Kubectl
Deployments with kubectl
require kubectl
to be installed. If the kubectl
binary cannot be found within the $PATH
variable and it is not specified by specifying the cmdPath
option, DevSpace will download the kubectl
binary into the $HOME/.devspace/bin
folder.
#
Manifestsmanifests
#
The manifests
option is mandatory and expects an array of paths or path globs that point to Kubernetes manifest files (yaml or json files) or to folders containing Kubernetes manifests or Kustomizations.
#
Example: Manifestskustomize
#
The kustomize
option expects a boolean stating if DevSpace should deploy using kustomize
(or alternatively: kubectl apply -k
).
warning
If you set kustomize = true
, all of your manifests
must be paths to Kustomizations. If you want to deploy some plain manifests and some Kustomizations, create multiple deployments for each of them.
kustomize
#
Default Value for #
Example: KustomizereplaceImageTags
#
The replaceImageTags
option expects a boolean stating if DevSpace should replace/update all image tags before deploying the project.
By default, DevSpace searches all your manifests for images that are defined in the images
section of the devspace.yaml
. If DevSpace finds an image, it replaces or appends the image tag with the tag it created during the image building process. Image tag replacement makes sure that your application will always be started with the most up-to-date image that DevSpace has built for you.
In-Memory Tag Replacement
Tag replacement takes place in-memory and is not writing anything to the filesystem, i.e. it will never change any of your configuration files.
replaceImageTags
#
Default Value for #
Example: Disable Tag Replacement#
Kubectl OptionsapplyArgs
#
The applyArgs
option expects an array of strings stating additional arguments (and flags) that should be used when calling kubectl apply
.
Apply for Kustomize Deployments
Even if you set kustomize: true
, DevSpace only renders the manifest templates using kustomize but the actual deployment will be executed using kubectl apply
.
applyArgs
#
Default Value for #
Example: Custom Kubectl Args & FlagsExplanation:
Deploying the above example would roughly be equivalent to this command:
createArgs
#
The createArgs
option expects an array of strings stating additional arguments (and flags) that should be used when calling kubectl create
.
Kustomize Deployments
DevSpace only uses kustomize create
to render the manifests using the default flags --dry-run --output yaml --validate=false
. The actual deployment will be executed using kubectl apply
after DevSpace has replaced the image tags within the rendered manifests in memory.
createArgs
#
Default Value for #
Example: Custom Kubectl Args & FlagsExplanation: Deploying the above example would roughly be equivalent to this command:
deleteArgs
#
The deleteArgs
option expects an array of strings stating additional arguments (and flags) that should be used when calling kubectl delete
.
Purging Deployments
For plain manifests or Kustomizations, DevSpace uses kubectl delete
to remote deployments when you run the command devspace purge
.
deleteArgs
#
Default Value for #
Example: Custom Kubectl Args & FlagsExplanation:
Deploying the above example would roughly be equivalent to this command:
cmdPath
#
The cmdPath
option expects an array of strings stating additional flags and flag values that should be used when calling kubectl apply
.
warning
Setting cmdPath
makes it much harder to share your devspace.yaml
with other team mates. It is recommended to add kubectl
to your $PATH
environment variable instead.
#
Example: Setting Path To Kubectl BinaryExplanation:
Deploying the above example would roughly be equivalent to this command:
#
General Optionsname
#
The name
option is required and expects a string to identify this deployment.
#
Example: Deployment Namenamespace
#
The namespace
option is required and expects a string with the namespace used to deploy the manifests.
warning
Only use this option if you really need to. Hard-coding the namespace in devspace.yaml
makes it harder to share the configuration with your colleagues. It is recommended to set the default namespace of the current context instead using:
#
Example: Deployment Namespacedisabled
#
If true, the deployment will not be deployed, rendered or purged. Can be useful in combination with config expressions or command variables.