DevSpace Documentation

website·Indexed 34 days ago

https://devspace.sh/docs

An open-source developer tool for Kubernetes designed to accelerate the development and deployment of cloud-native software. The documentation covers the Component Chart for defining application components, Kubernetes resource configurations (ingress, auto-scaling, persistent volumes, and affinity), and dev container modifications for optimizing development environments.

Tokens
216.2K
Snippets
1.3K
Records
1.7K
Agent score
58%

What's inside DevSpace

  1. Overview of DevSpace development mode configuration

    The dev configuration block defines the behavior of the devspace dev command, including port forwarding, auto-opening links, file synchronization, log streaming, auto-reloading, and interactive mode settings.
    dev:
      ports: []
      open: []
      sync: []
      logs: ...
      autoReload: ...
      interactive: ...
  2. Overview of DevSpace for Kubernetes development

    DevSpace is an open-source, client-only CLI tool designed for Kubernetes development. It allows developers to build, test, and debug applications directly inside Kubernetes without requiring a server-side component. It communicates with Kubernetes clusters using the user's existing kube-context, similar to kubectl.
  3. Overview of DevSpace for Kubernetes Development

    DevSpace is a lightweight, client-only CLI tool for developing and deploying cloud-native software on any Kubernetes cluster. It operates using the current kube-context (similar to kubectl or helm) and does not require any installation inside the cluster. It automates the build and deployment pipeline, including parallel image building (via Docker, kaniko, or custom commands), image tagging, and pushing to registries.
  4. Overview of DevSpace Local Image Registry

    DevSpace automatically detects when a local environment lacks push permissions for an image's registry. Depending on the cluster type, it handles images as follows:

    • KinD Clusters: Images are loaded using kind load docker-image.
    • Other Clusters: DevSpace deploys a local image registry to the cluster and transparently updates image URLs to use this registry.

    By default, the local registry uses a Deployment and emptyDir volume, meaning images are not persisted across restarts. Persistence can be enabled via a StatefulSet and persistent volumes in the configuration.

  5. Manage Kubernetes development workflows with DevSpace

    DevSpace is an open-source developer tool for Kubernetes that streamlines cloud-native software development. It provides a way to reduce context switching by merging logs from all containers directly into the IDE terminal and is compatible with any IDE that provides a terminal (e.g., VS Code, Eclipse, Atom).
  6. DevSpace architecture and core capabilities

    DevSpace is an open-source, client-only CLI tool for Kubernetes development. It runs as a single binary on the developer's local machine and communicates directly with Kubernetes clusters using the user's kube-context (similar to kubectl), requiring no server-side components.

    Key capabilities include:

    • Building, testing, and debugging applications directly inside Kubernetes.
    • Hot reloading to update running containers without rebuilding images or restarting.
    • Unifying deployment workflows across development, staging, and production environments.
    • Automating repetitive image building and deployment tasks.
  7. Understand how DevSpace modifies dev containers

    When modifications are defined for a dev container, DevSpace optimizes the environment by performing the following workflow:

    1. Locates the Kubernetes pod using defined selectors.
    2. Identifies the replica owner (e.g., Deployment or StatefulSet).
    3. Scales the original replica owner down to 0 replicas.
    4. Clones the replica owner to create a new object named [old-object-name]-devspace.
    5. Applies the specified modifications (e.g., image swaps, environment variables) to the new object.
    6. Waits for the new pod to be created from the modified Deployment/StatefulSet.
  8. Manage environment configurations using DevSpace profiles

    DevSpace profiles allow you to define environment-specific overrides in the profiles section of the devspace.yaml file. Profiles support three modification strategies, which are executed in the following order within a single profile: 1. replace (overrides entire sections), 2. merge (JSON Merge Patch RFC 7386), and 3. patches (JSON Patch RFC 6902).
    images:
      backend:
        image: john/devbackend
      backend-debugger:
        image: john/debugger
    deployments:
      backend:
        helm:
          values:
            containers:
            - image: john/devbackend
            - image: john/debugger
    profiles:
    - name: production
      patches:
      - op: replace
        path: images.backend.image
        value: john/prodbackend
      - op: remove
        path: deployments.backend.helm.values.containers[1]
      - op: add
        path: deployments.backend.helm.values.containers
        value:
          image: john/cache
  9. Use DevSpace plugin environment variables

    When executing a plugin binary, DevSpace provides several environment variables containing context about the current execution. These are particularly useful for hooks and custom commands.
    DEVSPACE_PLUGIN_EXECUTION_ID: Unique ID for the duration of a command
    DEVSPACE_PLUGIN_EVENT: The event that triggered the hook
    DEVSPACE_PLUGIN_OS_ARGS: JSON encoded arguments used to call the current command
    DEVSPACE_PLUGIN_CONFIG: YAML encoded loaded config (resolved profiles/vars)
    DEVSPACE_PLUGIN_COMMAND: Name of the executed command (e.g., 'dev')
    DEVSPACE_PLUGIN_COMMAND_LINE: Complete command name (e.g., 'devspace dev [FLAGS]')
    DEVSPACE_PLUGIN_COMMAND_FLAGS: JSON encoded flags passed to the command
    DEVSPACE_PLUGIN_COMMAND_ARGS: JSON encoded arguments passed to the command (excluding flags)
    DEVSPACE_PLUGIN_KUBE_NAMESPACE_FLAG: The target Kubernetes namespace
    DEVSPACE_PLUGIN_KUBE_CONTEXT_FLAG: The target Kubernetes context
    DEVSPACE_PLUGIN_ERROR: The error that occurred (supplied in 'error' or 'restart' events)
  10. Configure basic container properties

    Define the fundamental properties of a container in a component chart. The image field is mandatory. The name field is optional and defaults to container-[index].
    containers:
      - name: my-container
        image: dscr.io/username/my-backend-image
      - image: nginx:1.15