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.
-
Followed the Set up the infrastructure to create an application environment to create a Project in your organization.
-
(Optional) If you use Tanzu CLI then you must:
- Install Tanzu CLI v1.5.3 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 in to Tanzu CLI by running:
tanzu login
For more information about using
tanzu login
, and creating and managing contexts by usingtanzu 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:
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:
Fields | Description |
---|---|
Profile | The grouping of Capabilities that defines the APIs and resources that your application requires. |
Availability Targets | The 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. |
Replicas | The 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.
|
- UI-based steps
- To create a Space in the Tanzu Platform UI:
- In the Tanzu Platform UI, set the Project context to your Project.
- On the left navigation pane, go to Spaces > Overview.
- Click Create Space.
- In the dialog box, click Step by Step.
- Enter a name for your Space. For example,
my-first-space
. - In the Space Profiles drop down, select
apps.tanzu.vmware.com
,spring-cloud-gateway.tanzu.vmware.com
, andbitnami.tanzu.vmware.com
. - For Availability Targets, click + Add Availability Target.
- 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. - For Replicas, enter 1. This number must not exceed the number of clusters you added to the availability target.
-
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:
-
Set the Project scope, if not done earlier, by running:
tanzu project use
-
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
-
Apply the manifest to create the Space in your Project.
tanzu deploy --only space.yaml
-
Enter
Y
at the command prompt. -
Verify that the Space is in your Project by running:
tanzu space get my-first-space
If successful, the status is
ready: True
in theOverview
section. -
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'
-
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:
- In the Tanzu Platform UI, set the Project context to your Project.
- On the left navigation pane, go to Spaces > Overview.
- Locate
my-first-space
and then click View Details. - Click the Ingress tab.
- Click Create Domain Binding.
- Enter a
Name
for the domain binding. For example,where-for-dinner-binding
. - From the
Domain
drop-down menu, select the domain created in Create a Domain. - For
Subdomain
, move the toggle to deactivate Auto-assign and enterwhere-for-dinner
. - For
Port
, move the toggle to deactivate Auto-assign and enter80
. - Click
Create
.
- Tanzu CLI-based steps
- To bind your space to a domain using the Tanzu CLI:
-
Set the Project scope, if not done earlier, by running:
tanzu project use #set Project context
-
Set the Space by running:
tanzu space use my-first-space #set space context
-
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
Actions | Steps to follow |
---|---|
See the Space in Tanzu Platform | In the Tanzu Platform UI, in the left navigation pane, expand Spaces and click Overview |
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 |
Content feedback and comments