How-To: Use Radius workspaces

Learn how to handle multiple Radius platforms and environments with workspaces

Pre-requisites

How-to: Use workspaces to switch between environments

When you have multiple environments initialized for different purposes workspaces enable you to switch between different environments easily. You can create separate workspaces and switch between them as you are working through your deployment lifecycle.

  1. Install the Radius control plane on kubernetes cluster

    rad install kubernetes
    
  2. Create a resource group named mygroup using rad group create:

    rad group create mygroup
    
  3. Create an environment named myenvironment using rad env create:

    rad env create myenvironment
    
  4. Create a workspace named myworkspace using rad workspace create:

    rad workspace create kubernetes myworkspace --group mygroup --environment myenvironment
    

    Radius writes the workspace details to your local configuration file (~/.rad/config.yaml on Linux and macOS, %USERPROFILE%\.rad\config.yaml on Windows).

  5. Create another resource group named yourgroup using rad group create:

    rad group create yourgroup
    
  6. Create an environment named yourenvironment using rad env create:

    rad env create yourenvironment
    
  7. Create a workspace named yourworkspace using rad workspace create:

    rad workspace create kubernetes yourworkspace --group yourgroup --environment yourenvironment
    
  8. Verify your config.yaml file. It should show both myworkspace and yourworkspace workspaces, with your environments:

    workspaces:
    default: yourworkspace
    items:
      yourworkspace:
        connection:
          context: mycluster
          kind: kubernetes
        environment: /planes/radius/local/resourcegroups/yourgroup
        /providers/applications.core/environments/yourenvironment
        scope: /planes/radius/local/resourceGroups/yourgroup
      myworkspace:
        connection:
          context: mycluster
          kind: kubernetes
        environment: /planes/radius/local/resourcegroups/mygroup
        /providers/applications.core/environments/myenvironment
        scope: /planes/radius/local/resourceGroups/mygroup
    
  9. You can now deploy applications to both myworkspace and yourworkspace using rad deploy, specifying the -w flag.