Tanzu Platform SaaS

Create an application environment using Spaces

Last Updated February 19, 2025

This topic tells you how to create an environment on Tanzu Platform for an example Kubernetes application. The application environment is also called a Space. The Space you create will be instantiated on the infrastructure you configured in Setting up the infrastructure to create an application environment.

A Space is an an application-focused abstraction. For more information about Spaces, see What is a Space.

After you create the Space, you can deploy an example application called Where for Dinner? to the Space.

Before you begin

Before you create a Space, fulfill the following prerequisites.

Overview of steps to create a Space

The following provides an overview of the steps for creating a Space:

  1. Create a Space in your Project.
  2. Bind your Space to a domain

Create a Space in your Project

To create a Space, you specify the Profiles, Availability Targets, Replicas, and Update strategy to match characteristics required for applications deployed to the Space. You can create a Space using the Tanzu Platform UI or the Tanzu CLI.

Ensure that the name of the Space is unique in the Project and does not match to the name of any cluster group in the Project. Creating a Space and cluster group with the same name in a Project causes only cluster group roles to be available when setting up access control policies for Spaces. You will not be able to set up access control polices with role bindings for Spaces.

The following information is used when creating a Space:

FieldsDescription
ProfileThe grouping of Capabilities that defines the APIs and resources that your application requires.
Availability TargetsThe names of the Availability Targets to include in the Space. Multiple Availability Targets can be provided, resulting in traffic being routed to both Availability Targets by default.
ReplicasThe number of replicas to replicate application resources to. You can use this to provide extra resiliency to your application. If there are 2 or more clusters, the replicas are evenly distributed to give fault-tolerant distribution of the replicas.
CPU Limit (Advanced)The amount of CPU required by the Space per replica, in miliCPU or CPU.
Memory Limit (Advanced)The amount of RAM required by the Space per replica, in Gigabytes or Megabytes.
Update Strategy (Advanced)The strategy that specifies how updates to the Space are rolled out to individual clusters and namespaces.
  • Recreate means that the old configuration is removed and the new configuration is applied to all the clusters at once. With the recreate strategy, updates cause a brief downtime period.
  • RollingUpdate means that the updated configuration is applied to the Space replicas in a rolling fashion. In this strategy, the old configuration of the Space on a replica is replaced with the new configuration, and this process is repeated for each replica until all the replicas have the new configuration. During the rolling updates of Spaces containing a ContainerApps workload, the Space content health is factored in to ensure zero downtime for the user.
UI-based steps
To create a Space in the Tanzu Platform UI:
  1. In the Tanzu Platform UI, set the Project context to your Project.
  2. On the left navigation pane, go to Spaces > Overview.
  3. Click Create Space.
  4. In the dialog box, click Step by Step.
  5. Enter a name for your Space. For example, my-first-space.
  6. In the Space Profiles drop down, select apps.tanzu.vmware.com, spring-cloud-gateway.tanzu.vmware.com, and bitnami.tanzu.vmware.com.
  7. For Availability Targets, click + Add Availability Target.
  8. Select the all-regions.tanzu.vmware.com availability target. For more information about how to create your own availability target, see How to manage availability targets.
  9. For Replicas, enter 1. This number must not exceed the number of clusters you added to the availability target.
  10. Click Create Space.

    If successful, the UI returns you to the Spaces page and your Space will be listed on the page.

Tanzu CLI-based steps
To create a Space using the Tanzu CLI:
  1. Set the Project scope, if not done earlier, by running:

    tanzu project use
    
  2. Create a space.yaml manifest file for the Space with the following content:

     apiVersion: spaces.tanzu.vmware.com/v1alpha1
     kind: Space
     metadata:
       name: my-first-space
     spec:
       template:
         spec:
           profiles:
           - name: apps.tanzu.vmware.com
           - name: bitnami.services.tanzu.vmware.com
           - name: spring-cloud-gateway.tanzu.vmware.com
       availabilityTargets:
       - name: all-regions.tanzu.vmware.com
         replicas: 1
       updateStrategy:
         type: Recreate
    
  3. Apply the manifest to create the Space in your Project.

    tanzu deploy --only space.yaml
    
  4. Enter Y at the command prompt.

  5. Verify that the Space is in your Project by running:

    tanzu space get my-first-space
    

    If successful, the status is ready: True in the Overview section.

  6. Get more insights on the Space replica by running:

    tanzu space replica list my-first-space
    

    Example output:

    Listing space replicas from organization TAP staging, project mfine
    Summary: 1/1 Ready
    NAME                             READY  AVAILABILITY TARGET            CLUSTER    MESSAGE    AGE
    my-first-space-657fc9fd4d-p7kzd  True   all-regions.tanzu.vmware.com   cluster-1  Ready      20d
    
    🔎 For more details use 'tanzu space replica get NAME'
    
  7. Get details of the Space replicas by running:

    tanzu space replica get my-first-space-657fc9fd4d-p7kzd
    

    Example output:

    📡 Overview
      name:       my-first-space-657fc9fd4d-p7kzd
      space:      my-first-space
      ready:      True
      message:    Ready
      revision:   1
      age:        20d
    
    🔎 Conditions
      ✅ AvailabilityTargetSatisfied:     cluster/s satisfies AvailabilityTarget rules
      ✅ RequiredCapabilitiesSatisfied:   cluster/s satisfies Capabilities
      ✅ Scheduled:                       found a matching cluster
      ✅ TraitsInstalled:                 Traits Installed
      ✅ Ready:                           Ready
    
    🌎 Placement
      availability target:   all-regions.tanzu.vmware.com
      cluster group:         run
      cluster:               cluster-1
      workload namespace:    my-first-space-657fc9fd4d-p7kzd
      internal namespace:    my-first-space-657fc9fd4d-p7kzd-internal
    

Bind your Space to a domain

The Where for Dinner? sample application defines an ingress to allow users to access the web application using a URL. Binding a Space to a domain allows a GSLB for the specified domain to be created for the application.

UI-based steps
To bind your space to a domain in the Tanzu Platform UI:
  1. In the Tanzu Platform UI, set the Project context to your Project.
  2. On the left navigation pane, go to Spaces > Overview.
  3. Locate my-first-space and then click View Details.
  4. Click the Ingress tab.
  5. Click Create Domain Binding.
  6. Enter a Name for the domain binding. For example, where-for-dinner-binding.
  7. From the Domain drop-down menu, select the domain created in Create a Domain.
  8. For Subdomain, move the toggle to deactivate Auto-assign and enter where-for-dinner.
  9. For Port, move the toggle to deactivate Auto-assign and enter 80.
  10. Click Create.
Tanzu CLI-based steps
To bind your space to a domain using the Tanzu CLI:
  1. Set the Project scope, if not done earlier, by running:

    tanzu project use                 #set Project context
    
  2. Set the Space by running:

    tanzu space use my-first-space    #set space context
    
  3. Bind your Space to your domain by running:

    tanzu domain-binding create wfd-dev where-for-dinner.dev.corp.com
    

Your Space is now bound to the domain dev.corp.com with the subdomain where-for-dinner.

What you can do now

ActionsSteps to follow
See the Space in Tanzu PlatformIn the Tanzu Platform UI, in the left navigation pane, expand Spaces and click Overview
Developers can deploy applications to the SpaceFor information about how to deploy an application to a Space, see Deploying an application to a Space