Version: 5.3

Initialize a Project

Choose a Project

You can either deploy one of your own projects or alternatively, checkout one of our demo applications using git:

git clone https://github.com/devspace-cloud/quickstart-nodejs
cd quickstart-nodejs
Tutorials

Initialize Your Project

Run this command in your project directory to create a devspace.yaml config file for your project:

devspace init
DevSpace CLI - Initialize Project

While initializing your project, DevSpace will ask you a couple of questions and then create the config file devspace.yaml which will look similar to this one:

# Config version
version: v1beta9
# Defines all Dockerfiles that DevSpace will build, tag and push
images:
app: # Key 'app' = Name of this image
image: reg.tld/username/devspace # Registry and image name for pushing the image
preferSyncOverRebuild: true
injectRestartHelper: true
build: ...
# Defines an array of everything (component, Helm chart, Kubernetes maninfests)
# that will be deployed with DevSpace in the specified order
deployments:
- name: quickstart # Name of this deployment
helm: # Deploy using Helm
componentChart: true # Use the Component Helm Chart
values: # Override Values for chart (can also be set using valuesFiles option)
containers: # Defines an array of containers that run in the same pods started by this component
- image: reg.tld/username/devspace # Image of this container
service: # Expose this component with a Kubernetes service
ports: # Array of container ports to expose through the service
- port: 3000 # Exposes container port 3000 on service port 3000
# Settings for development mode (will be explained later)
dev: ...
# Settings for development mode (will be explained later)
profiles: ...

Prepare Kube-Context

To develop and deploy your project with DevSpace, you need a valid kube-context because DevSpace uses the kube-config file just like kubectl or helm.

Local Clusters

Local clusters run on your local dev machine and include: minikube, kind, k3s, mikrok8s etc.

If you want to deploy to a local Kubernetes cluster, make sure your current kube-context points to this cluster and tell DevSpace which namespace to use:

devspace use namespace my-namespace # will be automatically created during deployment
Kube-Context Namespace

Running the command above will change the default namespace of your kube-context, i.e. instead of using the default namespace, kubectl and other tools will now use a different namespace when working with this kube-context. That also means, you will not always need to use the --namespace / -n flag.