Create an application environment using Spaces

The procedures in this topic create an example application environment using Spaces. The application environment is also called a Space. You create the Space with Traits and Profiles you installed in Setting up the infrastructure to create an application environment.

A Space is an an application-focused abstraction available in Tanzu Application Engine. 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.

  • Followed the Set up the infrastructure to create an application environment to create:

    • A project in your organization.
    • An AWS EKS cluster that is a member of the Tanzu provided:
    • Run cluster group to provide the out of the box capabilities needed to run example application
    • all-regions.tanzu.vmware.com Availability Target that automatically containers all clusters
    • AWS Route 53 credentials for GSLB
  • (Optional) If you use Tanzu CLI then you also need to:

    • Install Tanzu CLI v1.3.0 or later. Tanzu CLI is required for CLI procedures.
    • Install the Tanzu CLI platform-engineer plug-in group by running:

      tanzu plugin install --group vmware-tanzu/platform-engineer
      
    • Log on within Tanzu CLI by running:

      tanzu login
      

    For more information about using tanzu login, and creating and managing contexts by using tanzu context, see Create and Manage CLI Contexts.

Overview of steps to create a Space

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

  1. Create custom networking Profile.
  2. Create a Space in your project.

Create custom networking Profile

Each project that is created within Tanzu Platform for Kubernetes contains four default Profiles. We will use the spring-dev.tanzu.vmware.com Profile with the default configuration, but we will need to create a custom Profile that enables networking functionality because it will have environment specific ingress configuration. For this guide, we will only configure the Profile to have the configuration for AWS Route 53 to create a GSLB for the application.

UI-based steps
Do the following on the Tanzu Platform hub:
  1. On the Tanzu Platform hub, set the project context to your project.
  2. On the left navigation pane, expand Application Spaces.
  3. Click Profiles.
  4. Click Create Profile.
  5. Select Step by Step.
  6. For Profile Name, enter my-custom-networking and click Next.
  7. In the Traits screen, select the following Traits:

    • multicloud-cert-manager.tanzu.vmware.com
    • multicloud-ingress.tanzu.vmware.com
  8. Expand the configuration for multicloud-ingress.tanzu.vmware.com

  9. Override the following values and click Next.

    Field Values Description Example
    Gslb DNS ZoneId The AWS generated ID for the route 53 hosted zone you wish to have records created in. Z011649351E6CH9XAVJF1
    Gslb Authentication CredsRef The CredentialID of the credential that was created in Create GLSB Role a7193d23e422vza863012555ee8ad9ax
    Domain The domain name of the Route 53 domain to use tap-demo.net
    Name The name of the gateway resource that is created. Use the default value. default-gateway
  10. On the Additional Required Capabilities screen, the Capabilities required by Traits selected above are selected by default, so click Next.

  11. Review the information on the Summary screen and click Create Profile.
Tanzu CLI-based steps
Use Tanzu CLI commands to install packages in the cluster group.
  1. Use the Tanzu CLI to ensure that your project context is set correctly.

    tanzu project list      # to view available projects
    
    tanzu project use       # to set project context
    

    For detailed information on creating and managing contexts, see Create and Manage CLI Contexts.

  2. Create my-custom-networking.yaml file with the following contents:

    ---
    apiVersion: spaces.tanzu.vmware.com/v1alpha1
    kind: Profile
    metadata:
      name: my-custom-networking
    spec:
      description: "My custom networking setup"
      traits:
      - name: multicloud-cert-manager.tanzu.vmware.com
        alias: multicloud-cert-manager
      - name: multicloud-ingress.tanzu.vmware.com
        alias: multicloud-ingress.tanzu.vmware.com
        values:
          inline:
            multicloud-ingress.tanzu.vmware.com:
              name: default-gateway
              domain: <domain>
              gslb:
                authentication:
                  credentialRef: <Gslb Authentication CredsRef>
                dns:
                  zoneId: <Gslb HostedZoneId>
              listenerTemplates:
              - namePrefix: https-
                port: 443
                protocol: HTTPS
                tls:
                  secretRef: prod-certs
              - namePrefix: http-
                port: 80
                protocol: HTTP
                tls:
                  secretRef: ""
    
  3. Update the placeholders in the my-custom-networking.yaml file with the following:

    Field Values Description Example
    Gslb HostedZoneId The AWS generated ID for the route 53 domain you wish to have records created in. Z011649351E6CH9XAVJF1
    Gslb Authentication CredsRef The CredentialID of the credential that was created in Create GLSB Role a7193d23e422vza863012555ee8ad9ax
    Domain The domain name of the Route 53 domain to use tap-demo.net
  4. Run the following command to create the Profile

    tanzu deploy --only my-custom-networking.yaml
    

View the created Profile

After you have created the Profile, you can view the health of the Profile on the Tanzu Platform hub.

  1. On the Tanzu Platform hub, set the project context to your project.
  2. On the left navigation pane, expand Application Spaces .
  3. Click Profiles.

    On the Profiles page, you will see the my-custom-networking Profile.

  4. On the Profile page, click View Details.

    On the Details page, you will see the Capabilities and Traits for the Profile. The Profile should be in a Ready state, and all Traits should be in a Resolved state.

    Traits view

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 hub or the Tanzu CLI.

The following information will be used when creating a Space:

Name Description
Profile The grouping of Traits that defines the Capabilities your application requires.
Availability Targets The logical grouping of clusters that the Space will be scheduled to.
Replicas The number of clusters within an Availability Target to replicate application resources to.
Update strategy The strategy that specifies how updates to the Space will be rolled out to individual clusters and namespaces.
UI-based steps
Do the following in the Tanzu Platform hub:
  1. On the Tanzu Platform hub, set the project context to your project.
  2. On the left navigation pane, expand Application Spaces.
  3. Click Spaces.
  4. On the Spaces page, click Create Space.
  5. Click Step by Step.

    Create Space

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

  7. In the Space Profiles drop down, select the spring-dev.tanzu.vmware.com and my-custom-networking Profiles that you created in the Create a Profile step.

  8. For Availability Targets, click + Add Availability Target.

  9. Select the all-regions.tanzu.vmware.com availability target. For more information on how to create your own availability target, see How to manage availability targets.
  10. For Replicas, enter 1. This number should not exceed the number of clusters you have added to the availability target.
  11. Click Create Space.

    You will return to the Space page and your Space is listed on the page.

    My first Space

Tanzu CLI-based steps
Use the following Tanzu CLI commands to create a Space.
  1. Set the project scope (if not done earlier).

    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: spring-dev.tanzu.vmware.com
           - name: my-custom-networking
           resources:
             limits:
               cpu: 5000m
               memory: 10Gi
       availabilityTargets:
       - name: all-regions.tanzu.vmware.com
         replicas: 1
       updateStrategy:
         type: Recreate
    
    Flag Description
    availability-target The names of the availability targets to include in the Space. You can repeat the availability-target flag for each availability target.
    replicas The number of clusters to replicate application resources to. This can be used to provide extra resiliency to your application. It should not exceed the number of healthy clusters in your availability target, or the space will not be able to fully schedule and will not be healthy.
    update-strategy The strategy that specifies how updates to the Space will be 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 clusters cluster by cluster in a rolling fashion. In this strategy, the old configuration of the Space on a cluster is replaced with the new configuration, and this process is repeated for each cluster until all the clusters have the new configuration. For upgrading your Space in a rolling fashion, you should have an additional cluster available per AvailabilityTarget.
    resources The resource limits (CPU/Memory) that the Space should be scheduled with. The resource limits configured here are enforced as Space quotas on the target cluster.
  3. Apply the manifest to create the Space in your project.

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

  5. Verify that the Space has been created in your project.

    tanzu space get my-first-space
    

    Space status should be in ready: True in Overview section.

What you can do now

Actions Steps to follow
See the Space in Tanzu Platform On Tanzu Platform hub, in the left navigation pane, expand Application Spaces and select Spaces.
Developers can deploy applications to the Space For information about how to deploy an application to a Space, see Deploying an application to a Space.
check-circle-line exclamation-circle-line close-line
Scroll to top icon