After installing DevSpace CLI, you are ready to deploy applications to Kubernetes with DevSpace CLI.
Choose a project to deploy
You can either deploy one of your own projects or alternatively, checkout one of our demo applications using git:
# Navigate to the root directory of your project
git clone https://github.com/devspace-cloud/quickstart-nodejs
git clone https://github.com/devspace-cloud/quickstart-python
git clone https://github.com/devspace-cloud/quickstart-golang
git clone https://github.com/devspace-cloud/quickstart-ruby
git clone https://github.com/devspace-cloud/quickstart-php
Initialize your project
Run this command in your project directory to initialize your application with DevSpace CLI:
If your project does not have a Dockerfile yet, DevSpace CLI will automatically create a Dockerfile for your project. Learn more about containerizing your projects using DevSpace.
While initializing your project, DevSpace CLI will ask you a couple of questions and then create a
devspace.yaml file within your project which contains a basic configuration for building and deploying your application.
What is defined in the basic configuration of this
# Config version version: v1beta2 # Development-specific configuration (will be explained later) dev: ... # Defines an array of everything (component, Helm chart, Kubernetes maninfests) # that will be deployed with DevSpace CLI in the specified order deployments: - name: quickstart-nodejs # Name of this deployment component: # Deploy a component (alternatives: helm, kubectl) containers: # Defines an array of containers that run in the same pods started by this component - image: dscr.io/username/devspace # Image of this container resources: limits: cpu: "400m" # CPU limit for this container memory: "500Mi" # Memory/RAM limit for 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 # Defines all Dockerfiles that DevSpace CLI will build, tag and push images: default: # Key 'default' = Name of this image image: dscr.io/username/devspace # Registry and image name for pushing the image (dscr.io is the private registry provided by DevSpace Cloud) createPullSecret: true # Let DevSpace CLI automatically create pull secrets in your Kubernetes namespace
Create a Space (DevSpace Cloud)
If you are not using DevSpace Cloud, you can skip this step.
You can create an isolated Kubernetes namespace with the command:
devspace create space my-app
This command would create a Space called
my-app. If you are using DevSpace Cloud with your own cluster (connected cluster), this namespace would be created within your own Kubernetes cluster but the Space would be isolated and managed by DevSpace Cloud.
DevSpace CLI automatically uses the Space you just created for all following commands. Learn how to switch between different Spaces.
Deploy your application
Now, you can deploy your application with the following command:
This command will do the following:
- Build the Dockerfiles specified in the
imagessection of your
- Push the resulting Docker images to the specified registries
- Create image pull secrets in your Kubernetes namespace
- Deploy everything that is defined unter
Congrats you have successfully deployed an application to kubernetes!
Learn more about image building with DevSpace
DevSpace CLI builds and pushes your Docker images before deploying your projects. Follow these links to learn more about how to:
DevSpace CLI will also create image pull secrets, if you configure this. Learn more about image pull secrets.
Learn more about deploying with DevSpace
DevSpace CLI lets you define the following types of deployments:
- Components (What are components?)
- Helm charts (What are Helm charts?)
- Kubernetes manifests (What are Kubernetes manifests?)
With DevSpace CLI, you can easily:
- Add predefined components (e.g. a database) to your deployments
- Add custom components to your deployments
You can fully customize your components (predefined and custom) within your
- Configure create and mount volumes
- Configure environment variables
- Configure resource limits
- Configure resource auto-scaling
- Expose components via services
Deploy Helm Charts
If you want to deploy Helm charts, you can easily add Helm charts to the deployment process. This works for local Helm charts within your project or with Helm charts hosted on a registry.
Deploy Kubernetes manifests
If you want to deploy your existing Kubernetes manifests, you can easily add these manifests to the deployment process.
Open your app in the browser (DevSpace Cloud)
If you are not using DevSpace Cloud, you will need to setup an ingress-controller, define an ingress and configure the DNS of your domain to point to your cluster in order to use
You can now view your application in the browser using the following command:
If you are using DevSpace Cloud, your application will automatically be available on a
Learn how to connect custom domains.
DevSpace CLI does more than simplify and streamline the process of deploying applications to Kubernetes. It also lets you: