How-To: Initialize Radius Environments

Learn how to create Radius Environments

Radius Environments are prepared landing zones for applications that contain configuration and Recipes. To learn more visit the environments overview page.

Radius Environments can be setup with the rad CLI via two paths: interactive or manual.

Pre-requisites

Create a development environment

  1. Initialize a new Radius Environment with rad init:

    rad init
    

    Select Yes to setup the application in the current directory. This will create app.bicep and bicepconfig.json files

    Initializing Radius...
    
    🕔 Install Radius v0.41
       - Kubernetes cluster: kind
       - Kubernetes namespace: radius-system
    ⏳ Create new environment default
       - Kubernetes namespace: default
       - Recipe pack: local-dev
    ⏳ Scaffold application
    ⏳ Update local configuration
    
  2. Verify the initialization by running:

    kubectl get deployments -n radius-system
    

    You should see:

    NAME                      READY   UP-TO-DATE   AVAILABLE   AGE
    ucp                       1/1     1            1           53s
    appcore-rp                1/1     1            1           53s
    bicep-de                  1/1     1            1           53s
    contour-contour           1/1     1            1           46s
    

    You can also use rad env list to view your environment:

    rad env list
    
  3. Use rad recipe list to see the list of available Recipes:

    rad recipe list
    
    NAME      TYPE                              TEMPLATE KIND  TEMPLATE
    default   Applications.Datastores/mongoDatabases  bicep          ghcr.io/radius-project/recipes/local-dev/mongodatabases:latest
    default   Applications.Datastores/redisCaches     bicep          ghcr.io/radius-project/recipes/local-dev/rediscaches:latest
    

    You can follow the Recipes documentation to learn more about the Recipes and how to use them in your application.

Create an environment interactively

  1. Initialize a new environment with rad init --full:

    rad init --full
    
  2. Follow the prompts, specifying:

    • Namespace - The Kubernetes namespace where your application containers and networking resources will be deployed (different than the Radius control-plane namespace, radius-system)
    • Azure provider (optional) - Allows you to deploy and manage Azure resources
    • AWS provider (optional) - Allows you to deploy and manage AWS resources
    • Environment name - The name of the environment to create

    You should see the following output:

    Initializing Radius...
    
    ✅ Install Radius v0.41
       - Kubernetes cluster: k3d-k3s-default
       - Kubernetes namespace: radius-system
    ✅ Create new environment default
       - Kubernetes namespace: default
       - Recipe pack: dev
    ✅ Scaffold application samples
    ✅ Update local configuration
    
    Initialization complete! Have a RAD time 😎
    
  3. Verify the Radius services were installed by running:

    kubectl get deployments -n radius-system
    

    You should see:

    NAME              READY   UP-TO-DATE   AVAILABLE   AGE
    ucp               1/1     1            1           2m56s
    appcore-rp        1/1     1            1           2m56s
    bicep-de          1/1     1            1           2m56s
    contour-contour   1/1     1            1           2m33s
    
  4. Verify an environment was created with rad env show:

    rad env show -o json
    

    You should see your new environment:

    {
      "id": "/planes/radius/local/resourcegroups/default/providers/Applications.Core/environments/default",
      "location": "global",
      "name": "default",
      "properties": {
        "compute": {
          "kind": "kubernetes",
          "namespace": "default"
        },
        "provisioningState": "Succeeded",
        "recipes": {}
        }
      },
      "systemData": {},
      "tags": {},
      "type": "Applications.Core/environments"
    }
    

Create an environment manually (advanced)

Radius can also be installed and an environment created with manual rad CLI commands. This is useful for pipelines or scripts that need to install and manage Radius.

  1. Install Radius onto a Kubernetes cluster:

    Run rad install kubernetes to install Radius into your default Kubernetes context and cluster:

    rad install kubernetes
    

    You should see the following message:

    Installing Radius version 2134e8e to namespace: radius-system...
    
  2. Create a new Radius resource group:

    Radius resource groups are used to organize Radius resources such as applications, environments, portable resources, and routes. Run rad group create to create a new resource group:

     rad group create myGroup
    

    You should see the following message:

     creating resource group "myGroup" in workspace ""...
    
     resource group "myGroup" created
    
  3. Create your Radius Environment:

    Run rad env create to create a new environment in your resource group. Specify the --namespace flag to select the Kubernetes namespace to deploy resources into:

    rad env create myEnvironment --group myGroup --namespace my-namespace
    

    You should see your Radius Environment being created and linked to your resource group:

    Creating Environment...
    Successfully created environment "myEnvironment" in resource group "myGroup"
    
  4. Verify the initialization by running:

    kubectl get deployments -n radius-system
    

    You should see:

    NAME              READY   UP-TO-DATE   AVAILABLE   AGE
    ucp               1/1     1            1           2m56s
    appcore-rp        1/1     1            1           2m56s
    bicep-de          1/1     1            1           2m56s
    contour-contour   1/1     1            1           2m33s
    

    You can also use rad env list to see if the created environment gets listed:

    rad env list --group myGroup
    

    You should see:

    NAME
    myEnvironment
    

Next steps

Follow the cloud provider guides to configure cloud providers for your environment to deploy and manage cloud resources.