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 create a Space, fulfill the following prerequisites.
Followed the Set up the infrastructure to create an application environment to create:
(Optional) If you use Tanzu CLI then you also need to:
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.
The following provides an overview of the steps for creating a Space:
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.
my-custom-networking
and click Next.In the Traits screen, select the following Traits:
multicloud-cert-manager.tanzu.vmware.com
multicloud-ingress.tanzu.vmware.com
Expand the configuration for multicloud-ingress.tanzu.vmware.com
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 |
On the Additional Required Capabilities screen, the Capabilities required by Traits selected above are selected by default, so click Next.
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.
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: ""
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 |
Run the following command to create the Profile
tanzu deploy --only my-custom-networking.yaml
After you have created the Profile, you can view the health of the Profile on the Tanzu Platform hub.
Click Profiles.
On the Profiles page, you will see the my-custom-networking
Profile.
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.
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. |
Click Step by Step.
Enter a name for your Space. For example, my-first-space
.
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.
For Availability Targets, click + Add Availability Target.
all-regions.tanzu.vmware.com
availability target. For more information on how to create your own availability target, see How to manage availability targets.Click Create Space.
You will return to the Space page and your Space is listed on the page.
Set the project scope (if not done earlier).
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: 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. |
Apply the manifest to create the Space in your project.
tanzu deploy --only space.yaml
Enter Y
at the prompt.
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.
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. |