To the Stars With DevSpace
Develop and deploy cloud-native software faster
Kubernetes adoption is still gaining pace, despite many big companies running at least parts of their operational businesses on the container orchestrator by now; Still, many smaller organizations, developer teams, and individuals are entering the eco-system every day. As new users, they face new challenges when starting to develop, test, and deploy cloud-native software - this is where DevSpace can help.
What is DevSpace?
DevSpace is an open-source developer tool for developing, testing, and deploying cloud-native software with many features to empower developers throughout the process, some of which are
Lightweight, client-only CLI - no installation on your cluster(s) needed
Automates everything - from building images to deploying your applications, DevSpace can take care of and automate everything.
Feature-rich UI - while developing and testing, DevSpace supports with its local web UI
Dependency management - DevSpace allows you to reference projects in different repositories for your workloads to depend on
Especially its client-only architecture makes DevSpace stand out. Unless other developer tools. You don't need to deploy/install tooling to your cluster(s) first; instead, you can go right away and use any cluster you want - Docker/Rancher Desktop, internal developer clusters, or a cluster in the cloud. DevSpace will use your current KUBECONFIG context to interact with your cluster.
On your client's side, DevSpace generates a devspace.yaml configuration file in your project when you generate a DevSpace, which will be used by the CLI for subsequent commands. Inside this configuration file, you will find settings that define build and deploy behavior, dependencies, and much more.
Why and When to Use DevSpace?
DevSpace outlines five reasons why developers love the tool on their website:
Streamlined workflows - Image builds and deployments can be automated, and configuration for DevSpaces is kept centralized in a single devspace.yaml. A whole range of tools are supported for these steps, e.g., you can choose between kubectl, helm, and kustomize for deploying your application(s). DevSpace also allows you to define dependencies between projects stored in different repositories.
Faster iterations - DevSpace can and will update your containers in real time as you code and move parts around in your local IDE. It maintains an advanced build-cache compared to 'normal' Docker, hot-reloading and two-way-syncing the files in your local environment to and from your deployments inside your cluster.
Feature-rich UI - Log streaming, port forwarding, and interactive terminal sessions are just a few of the web UI's capabilities. It can be spun up locally on demand and is the perfect way to interact with your dev environment in a non-kubectl way, right from your browser.
Localhost experience - DevSpace runs in any terminal, connects to any local or remote cluster, and integrates seamlessly with IDEs such as VSCode, Atom, or Eclipse.
Cross-env consistency - By providing a declarative way of configuration, the possibility to define different configuration profiles and patches, and allowing users to define variables and custom commands, DevSpace helps to bring dev, staging, and production environments closer together and keep them consistent while still allowing for flexibility when needed.
Those five reasons sounded compelling, and I went ahead and installed DevSpace. You can do so, too!
Installing and Using DevSpace
As mentioned, DevSpace is a client-side CLI tool, so installing it is as easy as getting the CLI with either npm, yarn, or brew. More in-depth installation instructions can be found in DevSpace's documentation.
Once you got DevSpace installed, navigate to your project's root directory and issue the command devspace init. This will launch an interactive setup dialogue in your terminal, guiding you through the setup of this project's DevSpace. DevSpace will also try to detect things like used programming language for you automatically. Below is a recording of me setting up a DevSpace for DevSpace's Python example project.
In the GIF, you can see that DevSpace even correctly detected the Dockerfile used to build the example project. In addition to the devspace.yaml configuration file, the setup process also created a devspace_start.sh which is used to display information to the users of the dev containers spun up by DevSpace. Once we're all set up, we can ensure we're using the right cluster and namespace and start developing!
~ devspace use context rancher-desktop
done Successfully set kube-context to 'rancher-desktop'
~ devspace use namespace devspace-test
info The default namespace of your current kube-context 'rancher-desktop' has been updated to 'devspace-test'
To revert this operation, run: devspace use namespace default
done Successfully set default namespace to 'devspace-test'
~ devspace dev
Issuing devspace dev will print quite some output to your terminal; Ports will get forwarded, containers will get spun up or built, and local files and directories will get mapped. Once everything has been initialized, DevSpace will print the output of devspace_start.sh to your terminal, and the user can get started.
The whole tutorial by DevSpace can be found in their documentation, which I heavily suggest you check out! They also maintain a blog and Slack community for people to get started with using DevSpace for their projects.
Summing it up...
DevSpace is a lightweight, client-side developer tool for developing on and deploying to Kubernetes in various established ways, such as Helm or Kustomize.
It helps maintain short feedback cycles for developers, supports in setting up projects, and ties development, staging, and production closer together by its way of configuration.
Using the official documentation, reading the DevSpace blog, or joining their Slack community and asking questions, you can get to grips with DevSpace very fast, and I am sure you will enjoy the experience!