Tanzu Platform 10.0

Create an application environment using Spaces

Last Updated March 03, 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:

NameDescription
ProfileThe grouping of Capabilities that defines the APIs and resources that your application requires
Availability TargetsThe logical grouping of clusters that the Space will be scheduled to
ReplicasThe number of clusters within an Availability Target to replicate application resources to
Update strategyThe strategy that specifies how updates to the Space will be rolled out to individual clusters and namespaces
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.

    Screenshot of the create space dialog box with the step by step option highlighted.

  5. Enter a name for your Space. For example, my-first-space.

  6. In the Space Profiles drop down, select the apps.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.

    Screenshot of the Spaces page with My first Space showing.

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
       availabilityTargets:
       - name: all-regions.tanzu.vmware.com
         replicas: 1
       updateStrategy:
         type: Recreate
    
    FieldsDescription
    availability-targetThe names of the Availability Targets to include in the Space. You can provide multiple entries for availability-target, one for each Availability Target.
    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.
    update-strategyThe strategy that specifies how updates to the Space are rolled out to individual clusters and namespaces.
    • Recreate: means 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 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.
  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 has created in your Project by running:

    tanzu space get my-first-space
    

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

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.

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