LinuxCommandLibrary

devspace

Automate Kubernetes development workflows

TLDR

Initialize a new DevSpace project in the current directory

$ devspace init
copy

Start development mode with port forwarding, file synchronization, and terminal access
$ devspace dev
copy

Start development mode in a specific namespace
$ devspace dev [[-n|--namespace]] [namespace]
copy

Deploy the project to Kubernetes
$ devspace deploy
copy

Deploy the project with a specific profile
$ devspace deploy [[-p|--profile]] [profile-name]
copy

Build all defined images
$ devspace build
copy

Follow logs from a pod
$ devspace logs [[-f|--follow]]
copy

Open the DevSpace UI in the browser
$ devspace ui
copy

SYNOPSIS

devspace [command] [flags]

PARAMETERS

devspace init
    Initializes a new DevSpace project and creates a devspace.yaml configuration file.

devspace dev
    Starts the development mode: builds images, deploys the application, and sets up file synchronization, port-forwarding, and log streaming for rapid development.

devspace deploy
    Builds images and deploys the application to Kubernetes. Can be used for staging or production deployments.

devspace build
    Builds images defined in devspace.yaml without deploying the application.

devspace purge
    Deletes the deployed application, built images, and associated resources from the Kubernetes cluster.

devspace enter container
    Connects to a running container via a shell (similar to kubectl exec).

devspace logs container
    Streams logs from a running container (similar to kubectl logs).

devspace run command
    Executes a custom script or command defined in devspace.yaml within the development container or locally.

devspace update
    Updates the DevSpace CLI to the latest version.

--kube-context context
    Specify the Kubernetes context to use for operations.

--namespace namespace
    Specify the Kubernetes namespace to use for operations.

--help
    Shows help message for a command or the CLI itself.

--version
    Prints the DevSpace CLI version.

DESCRIPTION

DevSpace is an open-source command-line interface (CLI) tool designed to simplify the development and deployment of applications on Kubernetes. It bridges the gap between local development environments and remote Kubernetes clusters, allowing developers to build, deploy, and debug their applications directly within the cluster without needing to manually manage Dockerfiles, Helm charts, or kubectl commands.

Key features include:
Fast Iteration Cycles: It supports "hot-reloading" or "file synchronization," where local code changes are instantly reflected in the running container within Kubernetes, significantly speeding up development.
Image Building: Automates Docker image building and pushing to registries.
Dependency Management: Can deploy dependencies like databases or message queues directly into the cluster.
Port-Forwarding & Proxying: Automatically sets up port-forwarding for services and containers.
One-Command Deployment: Simplifies complex multi-service deployments into a single devspace deploy command.
Integrated Debugging: Connects local debuggers to containers running in Kubernetes.
DevSpace.yaml: Uses a powerful, declarative configuration file (devspace.yaml) to define the entire development workflow, including image builds, deployments, port-forwards, and sync-paths.

DevSpace aims to make cloud-native development as seamless and efficient as traditional local development.

CAVEATS

DevSpace requires a running Kubernetes cluster and kubectl to be installed and configured. It often relies on Docker or another container runtime for local image building. The devspace.yaml file is central to its operation; misconfigurations can lead to unexpected behavior. Proper network connectivity between the DevSpace CLI host and the Kubernetes API server is crucial for its functionalities.

CONFIGURATION FILE: DEVSPACE.YAML

This YAML file is the core of any DevSpace project. It defines how images are built, how applications are deployed (e.g., using Helm charts, manifests), which ports to forward, which files to synchronize, and custom commands or development tools. It enables a highly customizable and declarative development workflow.

HOT RELOADING / FILE SYNCHRONIZATION

A key feature of devspace dev mode. Instead of rebuilding and redeploying entire images for every code change, DevSpace intelligently synchronizes local file changes directly into the running container. This dramatically reduces the feedback loop, making development on Kubernetes feel similar to local development with a hot-reloading server.

HISTORY

DevSpace was created by Loft.sh, a company focused on developer tooling for Kubernetes. It was first open-sourced around 2018-2019, aiming to solve common pain points developers faced when building applications for Kubernetes, such as slow iteration cycles, complex setup, and fragmented workflows. Its development has focused on simplifying the devspace.yaml configuration, improving hot-reloading capabilities, and integrating seamlessly with various Kubernetes environments. It has gained popularity for its ability to provide a "Docker Compose"-like experience for Kubernetes development.

SEE ALSO

kubectl(1), docker(1), helm(1), minikube(1), kind(1)

Copied to clipboard