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:
- Node.js
- Python
- Java
- Ruby
- Golang
- PHP
- ASP.NET
- Your Own Project
git clone https://github.com/devspace-cloud/quickstart-nodejs
cd quickstart-nodejs
After finishing this Getting Started Guide, make sure to also check out one of these tutorials:
git clone https://github.com/devspace-cloud/quickstart-python
cd quickstart-python
After finishing this Getting Started Guide, make sure to also check out the tutorial: Deploy Django Projects to Kubernetes using DevSpace
git clone https://github.com/devspace-cloud/quickstart-ruby
cd quickstart-ruby
After finishing this Getting Started Guide, make sure to also check out the tutorial: Deploy Ruby on Rails to Kubernetes using DevSpace
git clone https://github.com/devspace-cloud/quickstart-golang
cd quickstart-golang
git clone https://github.com/devspace-cloud/quickstart-php
cd quickstart-php
After finishing this Getting Started Guide, make sure to also check out the tutorial: Deploy Laravel Projects to Kubernetes using DevSpace
git clone https://github.com/devspace-cloud/quickstart-java
cd quickstart-java
git clone https://github.com/devspace-cloud/quickstart-asp-dotnet
cd quickstart-asp-dotnet
# Navigate to the root directory of your project
cd /path/to/your/project
If you are using DevSpace for the first time, it is highly recommended that you use one of the demo projects.
Initialize Your Project
Run this command in your project directory to create a devspace.yaml
config file for your project:
devspace init
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.
- Demo Cluster
- Local Cluster
- Remote Cluster
If you don't have a Kubernetes cluster or simply want to test DevSpace without using your own cluster, choose the free demo namespaces sponsored by DevSpace Cloud. Learn more about Demo Spaces.
Run the following command to create a free Kubernetes namespace:
devspace create space my-app # requires login via GitHub or email
DevSpace automatically sets up a kube-context for this Space, so you can also access your namespace using kubectl
, helm
or any other Kubernetes tool. Try it:
kubectl get pods
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
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.
Remote clusters run in a cloud or private data center and include: GKE, EKS, AKS, bare metal etc.
When using a remote cluster, you can either use it just for yourself or you can share the cluster with your colleagues.
- Use cluster alone
- Share cluster with others
devspace use namespace my-namespace # will be automatically created during deployment
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.
STEP 1
Connect cluster to DevSpace Cloud
devspace connect cluster
Learn more about connecting cluster in the documentation of DevSpace Cloud.
Instead of using the SaaS edition of DevSpace Cloud, you can also install the on-premise edition in your own cluster.
STEP 2
Create isolated namespace (= Space)
devspace create space my-app # requires login via GitHub or email
DevSpace automatically sets up a kube-context for this Space, so you can also access your namespace using kubectl
, helm
or any other Kubernetes tool. Try it:
kubectl get pods
STEP 3
Add cluster users and allow them to create Spaces
Learn more about how to do this in the documentation of DevSpace Cloud.