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.1 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:
Name | Description |
---|---|
Profile | The grouping of Capabilities that defines the APIs and resources that 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
- 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 the
apps.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 availabilityTargets: - name: all-regions.tanzu.vmware.com replicas: 1 updateStrategy: type: Recreate
Fields Description availability-target
The names of the Availability Targets to include in the Space. You can provide multiple entries for availability-target
, one for each Availability Target.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. update-strategy
The 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.
-
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 has created in your Project by running:
tanzu space get my-first-space
If successful, the status will be
ready: True
inOverview
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:
-
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