34
Application Orchestration Service Best Practices Issue 01 Date 2020-05-28 HUAWEI TECHNOLOGIES CO., LTD.

Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Application Orchestration Service

Best Practices

Issue 01

Date 2020-05-28

HUAWEI TECHNOLOGIES CO., LTD.

Page 2: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Copyright © Huawei Technologies Co., Ltd. 2020. All rights reserved.

No part of this document may be reproduced or transmitted in any form or by any means without priorwritten consent of Huawei Technologies Co., Ltd. Trademarks and Permissions

and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd.All other trademarks and trade names mentioned in this document are the property of their respectiveholders. NoticeThe purchased products, services and features are stipulated by the contract made between Huawei andthe customer. All or part of the products, services and features described in this document may not bewithin the purchase scope or the usage scope. Unless otherwise specified in the contract, all statements,information, and recommendations in this document are provided "AS IS" without warranties, guaranteesor representations of any kind, either express or implied.

The information in this document is subject to change without notice. Every effort has been made in thepreparation of this document to ensure accuracy of the contents, but all statements, information, andrecommendations in this document do not constitute a warranty of any kind, express or implied.

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. i

Page 3: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Contents

1 Using AOS and Container Technologies to Quickly Deploy the Magento E-commerce Platform.................................................................................................................... 1

2 Using the AOS Designer to Quickly Deploy ECSs.......................................................... 14

3 Using the AOS Designer to Quickly Deploy a Container Cluster...............................23

Application Orchestration ServiceBest Practices Contents

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. ii

Page 4: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

1 Using AOS and Container Technologiesto Quickly Deploy the Magento E-commerce

Platform

By using the Magento E-commerce Application template, you can quickly deploya containerized application of the Magento e-commerce platform. The Magentoe-commerce website consists of a frontend component and a MySQL database.This section walks you through the steps of quickly deploying the platform bycreating a stack from a modified public template Magento E-commerceApplication. The modified template allows you to specify different request andlimit usage of CPU and memory for containers every time you create stacks fromthis template.

In this section, you will complete the following operations:

1. Understanding Basic Concepts: Before deployment, you are advised tounderstand the basic concepts of the elements that are involved.

2. Modifying a Public Template: Modify the public template Magento E-commerce Application. Specifically, add the CPU and memory request andlimit parameters for the Magento frontend application.

3. Creating a Magento E-Commerce Application Stack: Use the modifiedtemplate to create a containerized application. Then, deploy the createdapplication on a cluster.

4. Deleting Resources: You are advised to delete unnecessary stack resources toavoid unwanted charges.

PrerequisitesYou have a HUAWEI CLOUD account. Before deploying a container, ensure that atleast one cluster and one node with 2 vCPUs and 4 GB of memory are available.

The node is in the Available state and bound to an elastic IP address. To query thenode status, log in to the CCE console and choose Resource Management >Nodes. Then, obtain an elastic IP address.

Application Orchestration ServiceBest Practices

1 Using AOS and Container Technologies to QuicklyDeploy the Magento E-commerce Platform

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 1

Page 5: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

For details about how to create a container cluster and node, see Using the AOS Designerto Quickly Deploy a Container Cluster.

Figure 1-1 Checking whether a node is available

Understanding Basic ConceptsBefore modifying a template, understand the basic composition of the MagentoE-commerce Application template.

# Application template informationtosca_definitions_version: huaweicloud_tosca_version_1_0# Definitions of input parametersinputs: app-name: default: magento description: application name label: magento magento-EIP: description: external access address of the Magento service label: magento magento-EPORT: default: 32080 description: external listening port of the Magento service label: magento type: integer ...# Definition of the mapping tablemappings: region_map: # Defines the mapping between images and specifications of different regions. cn-east-3: magento-image: '192.168.12.22:20202/aos-samples/magento:1.9.1.0' mysql-image: '192.168.12.22:20202/aos-samples/mysql:latest' ...# Storage position of designer icons and other informationmetadata: Designer: 08c3c168-5b00-4a70-b9f2-b74f3e276d9d: size: width: 60 height: 60 position: x: 240 y: 190 z: 1 ...# Definition of the application topologynode_templates: magento: #Element name metadata: Designer: id: e66e332a-3466-4638-9896-f7d2e93a1ae3

Application Orchestration ServiceBest Practices

1 Using AOS and Container Technologies to QuicklyDeploy the Magento E-commerce Platform

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 2

Page 6: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

properties: #Element properties k8sManifest: apiVersion: apps/v1 kind: Deployment metadata: labels: app: get_input: app-name name: get_input: app-name ... requirements: #Element dependencies - dependency: node: mysql-service - dependency: node: mysql-conf - dependency: node: magento-config type: HuaweiCloud.CCE.Deployment #Element type ...# Definitions of output parametersoutputs: ingress-admin_password: description: Password of super user. value: magentorocks1 magento-addr: description: Access URL for magento service. value: concat: - 'http://' - get_input: magento-EIP - ':' - get_input: magento-EPORT magento-admin_username: description: Super user name. value: admin

Description of template properties:

● inputsThis section is optional and is used to define the variables of a stack createdbased on a template. A maximum of 60 input parameters can be defined in atemplate. Each input parameter must have a unique name so that the valuecan be obtained by using the built-in get_input function. If an inputparameter is defined repeatedly, the latest definition will overwrite theprevious ones.Function scope: node_templates and outputs sections. That is, inputparameters can be transferred in the properties of node_templates andvalues of outputs.Format of the inputs section: <Input parameter name>: type: <Type> default: <Default value> constraints: <Constraints> description: <Description> label: <Label> invisible: <Whether command outputs are visible>

● mappingsThis section is optional and is used to define a mapping table. When creatinga stack based on a template, you can use the get_in_map function to extractthe content corresponding to a specific input variable. A maximum of 10mappings can be defined in a template.

Application Orchestration ServiceBest Practices

1 Using AOS and Container Technologies to QuicklyDeploy the Magento E-commerce Platform

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 3

Page 7: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Format of the mappings section: <Mapping name>: <Mapping object name>: <Mapping object property name>: <Mapping object property value> <Mapping object property name>: <Mapping object property value> ... ... ...

● node_templatesThis section is mandatory and is used to define the set of element objectsorchestrated in the template. All objects are elements. An element can be anapplication or a cloud service resource.Format of the node_templates section:<Element name>: type: <Element type> properties: <Element properties> requirements: <Element dependency> condition: <Condition name>

– Element name: Each element name must be unique and contains 1 to 48characters. Only lowercase letters, digits, and hyphens (-) are allowed.

– type: used to specify the type of an orchestration object. The type mustbe included in the element type list.

– properties: Attribute information is expanded based on element types.Each element type has its corresponding properties. The variable of aproperty can be obtained from the inputs section or from the runtimeinformation displayed after you run the get_attribute command. If anelement does not require a special property, you do not need to defineproperties.

– requirements: Optional. If there is no relationship between elements, youdo not need to define this parameter. The dependency between elementsis based on the defined element type. Related dependencies can bedefined for specific types.

– condition: Optional. This field determines whether to create elements inthe node_templates. For details, see the description of conditions.

● outputsThis section is optional and is used to define the output parameters duringthe runtime of the stack generated using a template. Each output parametermust have a unique name.Format of the outputs section:<Output parameter name>: description: <Description> value: <Value>

● tosca_definitions_versionThis section is mandatory and is used to specify the version of a template.

For more information about templates, see Templates (Cloud-based AutomationScripts).

Modifying a Public TemplateTo save container running resources and prevent container overload, you canapply for and limit the CPU and memory used by a container. This section

Application Orchestration ServiceBest Practices

1 Using AOS and Container Technologies to QuicklyDeploy the Magento E-commerce Platform

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 4

Page 8: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

describes how to add the CPU and memory request and limit parameters for theMagento frontend application and MySQL database application by modifying apublic template.

● Request: indicates the minimum amount of resources required for running acontainer.

● Limit: indicates the maximum amount of resources for running a container.You can set the limit to prevent system faults caused by application overload.

Step 1 Log in to the AOS console. Then, in the navigation tree, choose Template Market> Public Templates.

Step 2 In the Industry Templates area, click Magento E-commerce Application to viewdetails.

Figure 1-2 Selecting a public template

The template details contain brief information and diagram of the template. AMagento application group contains a Magento frontend application and aMySQL database application. In addition, the Magento application depends on theMySQL application because the former needs to save data to the later.

Step 3 Click Copy Template to copy the template to My Templates.

Figure 1-3 Copying the template

Application Orchestration ServiceBest Practices

1 Using AOS and Container Technologies to QuicklyDeploy the Magento E-commerce Platform

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 5

Page 9: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Step 4 Change the template name to my-business-app and click OK. The my-business-app template details page is displayed.

Figure 1-4 Changing the template name

Step 5 Click View in Designer in the Operation column and orchestrate templateinformation based on service requirements. The following describes how to addthe CPU and memory request and limit parameters for the Magento frontendapplication.

Figure 1-5 Viewing the template in the designer

Step 6 Click the magento Deployment element in the canvas. On the Components tabpage, add the parameters as shown in the following figure.

Application Orchestration ServiceBest Practices

1 Using AOS and Container Technologies to QuicklyDeploy the Magento E-commerce Platform

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 6

Page 10: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Figure 1-6 Properties of the Magento element

name: magento-container resources: requests: cpu: get_input: requestMagentoCPU memory: get_input: requestMagentoMemory limits: cpu: get_input: limitMagentoCPU memory: get_input: limitMagentoMemory ports: - containerPort: 80 protocol: TCP

Description of the properties:

● resources: indicates container resource specifications.

● requests: indicates the quotas of resources allocated to a container.

● limits: indicates the maximum amount of resources available for a container.

● cpu: indicates the number of CPU cores used by a container.

● memory: indicates the memory amount required by a container.

● get_input: used to obtain the values of input parameters defined in theinputs section of the template

Step 7 Click Generate/Refresh Inputs. If the message "Generate/Refresh inputssuccessfully" is displayed on the Operation Log in the lower left corner of thepage, the inputs parameters are successfully generated.

Application Orchestration ServiceBest Practices

1 Using AOS and Container Technologies to QuicklyDeploy the Magento E-commerce Platform

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 7

Page 11: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Step 8 Click the blank part of the canvas and add the description and tag of the inputparameter on the Inputs tab page.

Figure 1-7 Inputs of the Magento element

inputs: app-name: default: magento description: application name label: magento mysql-service-name: default: magento-mysql description: name of the MySQL service label: mysql requestMagentoCPU: description: CPU request of the Magento service label: magento requestMagentoMemory: description: memory request of the Magento service label: magento limitMagentoCPU: description: CPU limit of the Magento service label: magento limitMagentoMemory: description: memory limit of the Magento service label: magento magento-EIP: description: external access address of the Magento service label: magento

Description of the properties:

● inputs: defines the variables of a stack created based on a template.● requestMagentoCPU: defines the CPU request in the input parameters of the

Magento application.

Application Orchestration ServiceBest Practices

1 Using AOS and Container Technologies to QuicklyDeploy the Magento E-commerce Platform

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 8

Page 12: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

● requestMagentoMemory: defines the memory request in the inputparameters of the Magento application.

● limitMagentoCPU: defines the CPU limit in the input parameters of theMagento application.

● limitMagentoMemory: defines the memory limit in the input parameters ofthe Magento application.

● description: indicates the parameter description information.● label: indicates the label of a parameter. The label defined here can be

displayed by category during stack creation.

Step 9 Click to check whether the template is correct. If the message Templatevalidated successfully is displayed, the template is correct.

Step 10 Click to save the template.

----End

Creating a Magento E-Commerce Application StackThe modified template allows you to set resource limits when creating a stack.You can apply for and limit the CPU and memory of the Magento frontendapplication and MySQL database application respectively.

● CPU quotas:

Table 1-1 Description of CPU quotas

Parameter Description

CPUrequest

Minimum number of CPU cores required by a container.Resources are scheduled for the container based on this value.However, the requested value does not limit the maximumnumber of CPU cores available for the container.

CPU limit Maximum number of CPU cores available for a container.

You are advised to configure the CPU quotas as follows: Actual number ofCPU cores available for a node ≥ Sum of CPU limits for all containers of thecurrent instance ≥ Sum of CPU requests for all containers of the currentinstance. For details about the actual number of CPU cores available for anode, log in to the CCE console, choose Resource Management > Nodes,and obtain Allocatable CPUs (Cores) of the corresponding node.

● Memory quotas:

Application Orchestration ServiceBest Practices

1 Using AOS and Container Technologies to QuicklyDeploy the Magento E-commerce Platform

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 9

Page 13: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Table 1-2 Description of memory quotas

Parameter Description

Memoryrequest

Minimum amount of memory required by a container.Resources are scheduled for the container based on thisvalue.

Memorylimit

Maximum amount of memory available for a container.When the memory usage exceeds the configured memorylimit, the instance may be restarted, which affects the normaluse of applications.

You are advised to configure the memory quotas as follows: Actual amount ofmemory available for a node ≥ Sum of memory limits for all containers of thecurrent instance ≥ Sum of memory requests for all containers of the currentinstance. For details about the actual amount of memory available for a node,log in to the CCE console, choose Resource Management > Nodes, andobtain Allocatable Memory (GiB) of the corresponding node.

Step 1 In the navigation pane, choose My Templates. You can view the my-business-apptemplate in the template list.

Click Create Stack next to the my-business-app template to create a stack.

Step 2 Set the stack information.● Stack Name: Enter a stack name, for example, my-magento.● Description: You can leave it blank.● Cluster: Select a created cluster.● Namespace: Retain the default value.● On the magento tab page, set inputs parameters for the Magento

application, as shown in Figure 1-8. The parameters in the red box in thefollowing figure are added in the Modifying a Public Template part.

Figure 1-8 Input parameters of the Magento application

Application Orchestration ServiceBest Practices

1 Using AOS and Container Technologies to QuicklyDeploy the Magento E-commerce Platform

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 10

Page 14: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Table 1-3 Setting input parameters of the Magento application

Parameter Description Value

limitMagentoCPU

CPU limit of theMagentoapplication. Thisparameter isadded to theinput parametersby modifying thepublic template.

Set this parameter based on actualconditions. The default unit is G anddoes not need to be added after thevalue. For example, 1.

limitMagentoMemory

Memory limit ofthe Magentoapplication. Thisparameter isadded to theinput parametersby modifying thepublic template.

Set this parameter based on actualconditions. The default unit is M andneeds to be added after the value.For example, 2048M.

magento-EIP Elastic IP addressof a node.

Obtain the elastic IP address fromPrerequisites, for example, 10.0.0.0.

magento-EPORT Port number of anode.

Enter an integer ranging from 30000to 32767. Ensure that the value isunique in the cluster. You can retainthe default value 32080.

requestMagentoCPU

CPU request ofthe Magentoapplication. Thisparameter isadded to theinput parametersby modifying thepublic template.

Set this parameter based on actualconditions. The default unit is G anddoes not need to be added after thevalue. For example, 0.5.

requestMagentoMemory

Memory requestof the Magentoapplication. Thisparameter isadded to theinput parametersby modifying thepublic template.

Set this parameter based on actualconditions. The default unit is M andneeds to be added after the value.For example, 1024M.

Step 3 Click Next and check the stack information. If the stack information is correct,click Create Stack.

It takes 5 minutes to create the stack.

Step 4 After the stack is created, click Stack Details. You can view that the stack status isNormal and six cloud services exist in Elements.

Application Orchestration ServiceBest Practices

1 Using AOS and Container Technologies to QuicklyDeploy the Magento E-commerce Platform

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 11

Page 15: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Figure 1-9 Stack created successfully

Step 5 On the Outputs tab page, view output parameters.

Figure 1-10 Output parameters

Step 6 In the address box of the browser, enter the value of magento-addr obtainedfrom the output parameters, for example, http://10.0.0.0:32080. Then you canaccess the Magento application.

Application Orchestration ServiceBest Practices

1 Using AOS and Container Technologies to QuicklyDeploy the Magento E-commerce Platform

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 12

Page 16: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Figure 1-11 Accessing the Magento application

----End

Deleting ResourcesYou are advised to delete unnecessary stack resources to avoid unwanted charges.

Step 1 Log in to the AOS console.

Step 2 In the navigation pane, click My Stacks.

Step 3 Select the created stack, and click Delete to delete the stack as prompted.

----End

Application Orchestration ServiceBest Practices

1 Using AOS and Container Technologies to QuicklyDeploy the Magento E-commerce Platform

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 13

Page 17: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

2 Using the AOS Designer to QuicklyDeploy ECSs

ECS is a cloud server that allows on-demand allocation and elastic computingcapability scaling. It helps you build a reliable, secure, flexible, and efficientapplication environment to ensure that your services can run stably andcontinuously, improving O&M efficiency. This section describes how to use theAOS designer to quickly create ECSs (including virtual private clouds and subnets).After the orchestration is completed, a template can be generated. Based on thistemplate, you can create multiple ECSs with a few clicks.

In this section, you will complete the following operations:

1. Understanding Basic Concepts: Before deployment, you are advised tounderstand the basic concepts of the elements that are involved.

2. Creating a Key Pair: Create a key pair for identity authentication duringremote login to the ECS. If a key pair is already available, skip this operation.

3. Adding and Connecting Elements: When you open the AOS designer for thefirst time, the template is blank. In this example, drag VPC.VPC, VPC.Subnet,and ECS.CloudServer to the canvas and establish relationships between them.

4. Setting Template Parameters: After establishing the relationships, use theintegrated editor to add parameters so that you can specify input values whencreating a stack.

5. Creating an ECS: After you use the template to create an ECS, a VPC andsubnet are automatically created.

6. Deleting Resources: You are advised to delete unnecessary stack resources toavoid unwanted charges.

Understanding Basic Concepts● The following table describes the basic concepts of AOS elements

involved during ECS creation.

Application Orchestration ServiceBest Practices 2 Using the AOS Designer to Quickly Deploy ECSs

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 14

Page 18: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Table 2-1 Basic concepts of elements

Element Service Description

VPC.VPC VPC A VPC enables you to build logically isolated,configurable, and manageable virtualnetworks. It enhances cloud resource securityand simplifies network deployment.

VPC.Subnet

Subnet A subnet is a part of a VPC. It is a segmentwithin the IP address range of the VPC and canhouse isolated resource groups.

ECS.CloudServer

ECS An ECS is a computing cloud server thatconsists of CPUs, memory, images, and ElasticVolume Service (EVS) disks and allows on-demand allocation and elastic scaling.

● The following figure shows the relationships among VPCs, subnets, and ECSs.

Figure 2-1 Relationships among VPCs, subnets, and ECSs

● Concepts of input and output parameters:After configuring the properties of each element, you need to set the inputand output parameters.– Input: During template compilation, some properties need to be

frequently modified. For example, if the specifications of an ECS arewritten in the template, it is inconvenient to modify the template eachtime a property value is modified. You can define the properties that needto be frequently modified through the get_input function. In this way,you can directly modify the properties on the UI when creating a stackwith no need to modify the template.

– Output: This section is used to define the output parameters during stackruntime. For example, when creating an ECS, you need to obtain itselastic IP address to log in to it. Such a parameter needs to be set as anoutput parameter.

Application Orchestration ServiceBest Practices 2 Using the AOS Designer to Quickly Deploy ECSs

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 15

Page 19: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Creating a Key PairBefore creating a resource using AOS, create a key pair for identity authenticationduring remote login to a node.

If a key pair is available, skip this operation.

Step 1 Log in to management console.

Step 2 Choose Service List > Computing > Elastic Cloud Server.

Step 3 In the navigation pane, choose Key Pair. On the page that is displayed, clickCreate Key Pair.

Step 4 Enter a key pair name and click OK.

Step 5 In the dialog box that is displayed, click OK.

View and save the key pair. For security purposes, a key pair can be downloadedonly once. Keep it secure to ensure successful login.

----End

Adding and Connecting Elements

Step 1 Log in to management console.

Step 2 Choose Service List > Application > Application Orchestration Service. The AOSconsole is displayed.

Step 3 In the navigation pane, click Designer. You can add and connect elementsaccording to Figure 2-2.

Application Orchestration ServiceBest Practices 2 Using the AOS Designer to Quickly Deploy ECSs

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 16

Page 20: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Figure 2-2 Adding and connecting elements

----End

Setting Template Parameters

Step 1 Click a VPC element in the canvas. The properties of this element are displayed.

● To facilitate parameter setting and modification, you are advised to set parameterswhose values need to be frequently changed as input parameters. get_input indicatesinput parameters. You can define the values behind get_input.

● When the parameter settings are incorrect, is displayed before the incorrectly setparameter in the property area. Modify the property configuration and do not leave thecurrent page. Otherwise, the parameter settings will be lost.

node_templates: myvpc: type: HuaweiCloud.VPC.VPC properties: name: get_input: vpc-name cidr: get_input: vpc-cidr

The following describes the properties:

● cidr: range of available subnets on a VPC. To facilitate modification, set thisproperty as an input parameter.

● name: name of a VPC, which can be customized. To facilitate modification,set this property as an input parameter.

Step 2 Click the mysubnet element in the canvas. The properties of this element aredisplayed.

Configure the subnet name and set the AZ as an input parameter. Set thefollowing parameters in bold and retain the default values for other parameters.

Application Orchestration ServiceBest Practices 2 Using the AOS Designer to Quickly Deploy ECSs

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 17

Page 21: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

node_templates: mysubnet: type: HuaweiCloud.VPC.Subnet properties: name: get_input: subnet-name cidr: get_input: subnet-cidr dhcpEnable: true gateway: get_input: subnet-gateway vpcId: get_reference: myvpc availabilityZone: get_input: az dnsList: - 114.114.114.115 - 114.114.114.114 requirements: - vpcId: node: myvpc

The following describes the properties:

● availabilityZone: region where a subnet is located. You can directly set thevalue for the property or set this property as an input parameter. To facilitatemodification, you are advised to set this property as an input parameter.

● cidr: subnet segment, which must be within the subnet address range of VPC.Set this property as an input parameter.

● dnsList: optional; set of addresses of DNS servers in the subnet. Use this fieldif you want to use more than two DNS servers.

● gateway: subnet gateway. Set this property as an input parameter.● name: name of a custom subnet. Set this property as an input parameter.● vpcId: Retain the default value. get_reference indicates that the VPC

information of the subnet is dynamically obtained.● dhcpEnable: determines whether to enable the DHCP function. If the value is

true, this function is enabled. Retain the default value. When the DHCPservice is enabled, the IP address of the ECS server is automaticallyobtained using the DHCP protocol after the ECS server using the VPC isstarted.

Step 3 Click the CloudServer element in the canvas. The properties of this element aredisplayed.

Set the following parameters in bold and retain the default values for otherparameters.

node_templates: myecs: type: HuaweiCloud.ECS.CloudServer properties: imageId: get_input: image instances: 1 flavor: get_input: flavor nics: - subnetId: get_reference: mysubnet rootVolume: volumeType: get_input: volumeType

Application Orchestration ServiceBest Practices 2 Using the AOS Designer to Quickly Deploy ECSs

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 18

Page 22: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

size: 40 availabilityZone: get_input: az name: get_input: vm-name vpcId: get_reference: myvpc publicIP: eip: bandwidth: shareType: PER size: 1 ipType: 5_bgp sshKeyName: get_input: sshKey-name requirements: - vpcId: node: myvpc - nics.subnetId: node: mysubnet

● availabilityZone: region where a subnet is located. You can directly set thevalue for the property or set this property as an input parameter. To facilitatemodification, you are advised to set this property as an input parameter.

● flavor: ECS specifications. You are advised to set this property as an inputparameter.

● imageId: type of the operating system (OS) for creating an ECS. You areadvised to set this property as an input parameter.

● name: name of an ECS, which can be customized. You are advised to set thisproperty as an input parameter.

● nics: NIC of a VM. A VM may have multiple NICs. Set this parametermanually. get_reference indicates that the value of this parameter can bedynamically obtained from the subnet information.

● publicIP: This property is mandatory if the cloud service needs to be bound toan elastic IP address and to access the Internet.

● vpcId: Retain the default value. get_reference indicates that the VPCinformation of the subnet is dynamically obtained.

● instances: number of ECSs to be created. Set the value to 1, indicating thatone ECS is created.

● rootVolume: disk specifications of the ECS. Retain the default value.● volumeType: system disk type. SATA: common I/O disk type; SAS: high I/O

disk type; SSD: ultra-high I/O disk type.● sshKeyName: key name. The key must be created in advance. The password

function will be enabled in future. Currently, this property is mandatory.

Step 4 Click the blank area in the canvas and set input parameters in the inputs section.The input parameters are obtained from the values of get_input in previous steps.inputs: subnet-name: description: subnet name default: my-ecs-subnet subnet-cidr:description: IP address range available in the subnet default: '192.168.1.0/24' subnet-gateway: description: gateway of the subnet label: '' default: 192.168.1.1

Application Orchestration ServiceBest Practices 2 Using the AOS Designer to Quickly Deploy ECSs

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 19

Page 23: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

az: description: name of the AZ where the subnet is located default: cn-south-1a image: description: ID of the image used by the ECS default: 7be2e72e-0679-4a1b-8faf-0c1865708b20 flavor: description: specifications of the ECS default: c2.large volumeType: description: system disk type default: SATA vm-name: description: the ECS name default: my-cloudserver sshKey-name: description: SSH key pair used for login vpc-name: description: VPC name default: my-ecs-vpc vpc-cidr: description: available subnets in the VPC default: '192.168.0.0/16'

Step 5 Click the blank area in the canvas and set output parameters in the outputssection. Output parameters refer to those to be obtained.

To create an ECS, the following parameters are required:

● Parameters in the outputs section, for example, ecs-eip and ecs-id, can be customized.● get_attribute indicates that the corresponding value can be automatically obtained

from an element. The parameter behind get_attribute, for example, myecs, must bethe same as the defined element name. The values behind myecs, for example,floatingIpId and refID, must match the output parameters of the current element andcannot be customized.

● ecs-eip: Use the get_attribute function to automatically obtain the elastic IPaddress of the ECS from the myecs element.

● ecs-id: Use the get_attribute function to automatically obtain the ECS IDfrom the myecs element.

outputs: ecs-eip: value: get_attribute: - myecs - floatingIpIds ecs-id: value: get_attribute: - myecs - refID

Step 6 Click on the top of the designer page, click the My Templates tab,set the following parameters, and click Save.

Before saving the template, you can click to verify it. If the template is correct,a message is displayed in Operation Log, indicating that the template is verifiedsuccessfully.● Name: name of a template, which can be customized but must be globally

unique. For example, set this parameter to myecs.

Application Orchestration ServiceBest Practices 2 Using the AOS Designer to Quickly Deploy ECSs

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 20

Page 24: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

● Version: 1.0. Retain the default value.

----End

Creating an ECS

Step 1 Click in the upper right corner of the designer page to enter the homepage ofthe AOS console.

Step 2 In the navigation pane, choose My Templates. You can view the saved templatemyecs in the template list.

Step 3 Click Create Stack next to the myecs template to create a stack.

Step 4 Set stack information.● Stack Name: Enter a stack name, for example, myecs. Ensure that the value

is unique.● Description: You can leave it blank.● Set input parameters, as shown in Table 2-2.

Table 2-2 Setting input parameters

Parameter Description

az AZ where the ECS is located.

flavor ECS specifications.

image Image used by the ECS.

sshKey-name Key pair. Select a created key pair.

subnet-cidr Subnet segment. Retain the default value.

subnet-gateway Subnet gateway. Retain the default value.

subnet-name Subnet name, which must be unique.

vm-name ECS name, which must be unique.

volumeType System disk type, for example, SATA.

vpc-cidr Range of available subnets in the VPC.Retain the default value.

vpc-name VPC name, which must be unique.

Step 5 Click Next and check the stack information. If the stack information is correct,click Create Stack.

The stack details page is displayed, showing that the stack is being created. TheVPC, subnet, and ECS are being created. The creation will take about 6 minutes.

Step 6 Check the stack status. When the status becomes Normal, you can view that threecloud services already exist in the stack element, indicating that the VPC, subnet,and ECS have been created successfully.

Application Orchestration ServiceBest Practices 2 Using the AOS Designer to Quickly Deploy ECSs

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 21

Page 25: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Figure 2-3 Stack successfully created

Step 7 View the created cloud services.

1. Log in to management console.2. Choose Service List > Computing > Elastic Cloud Server from the main

menu. You can view the created ECS.3. Choose Service List > Network > Virtual Private Cloud. You can view the

created VPC.4. Click the VPC name to enter the details page. You can view the created

subnet.

----End

Deleting ResourcesYou are advised to delete unnecessary stack resources to avoid unwanted charges.

Step 1 Log in to the AOS console.

Step 2 In the navigation pane, click My Stacks.

Step 3 In the stack list, select the myecs stack and click Delete to delete it.

Delete the stack as prompted.

----End

Application Orchestration ServiceBest Practices 2 Using the AOS Designer to Quickly Deploy ECSs

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 22

Page 26: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

3 Using the AOS Designer to QuicklyDeploy a Container Cluster

A cluster is a collection of computing resources, including a group of nodes.Containers run on nodes. This section describes how to use the AOS designer toquickly deploy a container cluster and add nodes to the cluster, helping youprepare resources for deploying containerized applications.

In this section, you will complete the following operations:

1. Understanding Basic Concepts: Before deploying a container cluster, you areadvised to understand the basic concepts of the elements that are involved.

2. Creating a Key Pair: Create a key pair for identity authentication duringremote login to the Elastic Cloud Server (ECS). If a key pair is available, skipthis operation.

3. Adding and Connecting Elements: When you open the AOS designer for thefirst time, the template is blank. In this example, drag VPC.VPC, VPC.Subnet,CCE.Cluster, and CCE.NodePool to the canvas and establish relationshipsbetween them.

4. Setting Template Parameters: After establishing the relationships, use theintegrated editor to add parameters so that you can specify input values whencreating a stack.

5. Creating a Container Cluster Stack: You can create a container cluster basedon an orchestrated template. Then you can create Virtual Private Clouds(VPCs), subnets, container clusters, and nodes.

6. Deleting Resources: You are advised to delete unnecessary stack resources toavoid unwanted charges.

Understanding Basic Concepts● Concepts of elements used for creating a container cluster:

– VPC.VPC: A VPC enables you to build logically isolated, configurable, andmanageable virtual networks, enhancing cloud resource security andsimplifying network deployment.

– VPC.Subnet: A subnet is a part of a VPC. It is a segment within the IPaddress range of the VPC and can house isolated resource groups. Thesubnet is located in the VPC.

Application Orchestration ServiceBest Practices

3 Using the AOS Designer to Quickly Deploy aContainer Cluster

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 23

Page 27: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

– CCE.Cluster: A container cluster is used to run Docker applications andconsists of one or more nodes. Containers run on nodes. You must havean available cluster before creating a containerized application.

– CCE.NodePool: A node is an ECS on which containerized applications run.A node agent (kubelet) runs on each node. The kubelet is used tomanage container instances running on nodes. In this example, oneNodePool element represents one node.

● The following figure shows the relationships between elements.

Figure 3-1 Relationships between elements

Figure 3-1 shows the relationships are as follows:– The container cluster runs on a subnet of the VPC.– A container cluster can contain one or more nodes. In this example, only

one node is included.● Concepts of input and output parameters:

After configuring the properties of each element, you need to set the inputand output parameters.– Input: During template compilation, some properties need to be

frequently modified. For example, if the specifications of an ECS arewritten in the template, it is inconvenient to modify the template eachtime a property value is modified. You can define the properties that needto be frequently modified through the get_input function. In this way,you can directly modify the properties on the UI when creating a stackwith no need to modify the template.

– Output: This section is used to define the output parameters during stackruntime. For example, when creating an ECS, you need to obtain itselastic IP address to log in to it. Such a parameter needs to be set as anoutput parameter.

Creating a Key PairBefore creating a resource using AOS, create a key pair for identity authenticationduring remote login to a node.

Application Orchestration ServiceBest Practices

3 Using the AOS Designer to Quickly Deploy aContainer Cluster

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 24

Page 28: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

If a key pair is available, skip this operation.

Step 1 Log in to management console.

Step 2 Choose Service List > Computing > Elastic Cloud Server.

Step 3 In the navigation pane, choose Key Pair. On the page that is displayed, clickCreate Key Pair.

Step 4 Enter a key pair name and click OK.

Step 5 In the dialog box that is displayed, click OK.

View and save the key pair. For security purposes, a key pair can be downloadedonly once. Keep it secure to ensure successful login.

----End

Adding and Connecting Elements

Step 1 Log in to the AOS console.

Step 2 In the navigation pane, click Designer. You can add and connect elementsaccording to Figure 3-2.

Figure 3-2 Adding and connecting elements

----End

Setting Template Parameters

Step 1 Click the myvpc element in the canvas. The properties of this element areautomatically displayed.

Application Orchestration ServiceBest Practices

3 Using the AOS Designer to Quickly Deploy aContainer Cluster

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 25

Page 29: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Configure the following content in bold:

● To facilitate parameter setting and modification, you are advised to set parameterswhose values need to be frequently changed as input parameters. get_input indicatesinput parameters. You can define the values behind get_input.

● When parameter settings are incorrect, is displayed before corresponding parametersin the property area. In this case, modify the properties and do not leave the currentpage. Otherwise, the parameter settings will be lost.

node_templates: myvpc: type: HuaweiCloud.VPC.VPC properties: cidr: get_input: vpc-cidr name: get_input: vpc-name

The following describes the properties:

● cidr: available subnets in a VPC. Set this property as an input parameter.● name: VPC name, which can be customized. Set this property as an input

parameter.

Step 2 Click the mysubnet element in the canvas. The properties of this element aredisplayed. Configure the following content in bold:node_templates: mysubnet: type: Cloud.VPC.Subnet properties: name: get_input: subnet-name dhcpEnable: true cidr: '192.168.1.0/24' gateway: 192.168.1.1 vpcId: get_reference: myvpc dnsList: - 114.114.114.115 - 114.114.114.114 requirements: - vpcId: node: myvpc

The following describes the properties:● dhcpEnable: whether to enable the DHCP function in the subnet. Retain the

default value.● cidr: subnet segment, which must be within the IP address range of the VPC.

Set this property as an input parameter.● dnsList: optional; set of addresses of DNS servers in the subnet. Use this field

if you want to use more than two DNS servers.● gateway: gateway of the subnet.● name: name of the subnet, which can be customized. You are advised to set

this property as an input parameter.● vpcId: Retain the default value. After the connection is complete,

"get_reference":"myvpc" is automatically generated, indicating that the VPCinformation about the subnet is dynamically obtained using myvpc.

Application Orchestration ServiceBest Practices

3 Using the AOS Designer to Quickly Deploy aContainer Cluster

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 26

Page 30: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Step 3 Click the mycluster element in the canvas. The properties of this element areautomatically displayed.

To make parameters such as flavor and availabilityZone configurable, get_inputis used. The input parameter names can be customized.node_templates: mycluster: type: HuaweiCloud.CCE.Cluster properties: subnetId: get_reference: mysubnet flavor: get_input: clusterFlavor vpcId: get_reference: myvpc name: get_input: clusterName availabilityZone: get_input: availabilityZone

The following describes the properties:

● availabilityZone: region where a subnet is located. You can directly set avalue or set this property as an input parameter. To facilitate modification,you are advised to set this property as an input parameter. The value behindget_input can be customized.

● flavor: cluster specifications. To facilitate modification, you are advised to setthis property as an input parameter. The value behind get_input can becustomized.

● name: name of a cluster, which can be customized.● subnetId: Retain the default value. The subnet ID will be obtained

dynamically.● vpcId: Retain the default value. The VPC Id will be obtained dynamically.

Step 4 Click the mynode element in the canvas. The properties of this element areautomatically displayed.

To make parameters such as flavor and sshKeyName configurable, get_input isused. The input parameter names can be customized.

node_templates: mynode: type: HuaweiCloud.CCE.NodePool properties: dataVolumes: - size: 100 volumeType: get_input: nodeVolumeType name: get_input: nodeName instances: 1 rootVolume: volumeType: get_input: dataVolumeType size: get_input: dataVolumeSize flavor: get_input: nodeFlavor clusterId: get_reference: mycluster publicIp: eip: bandwidth:

Application Orchestration ServiceBest Practices

3 Using the AOS Designer to Quickly Deploy aContainer Cluster

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 27

Page 31: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

shareType: get_input: shareType size: get_input: bandwidthSize num: 1 ipType: get_input: ipType sshKeyName: get_input: sshKey requirements: - clusterId: node: mycluster

The following describes the properties:

● clusterId: Retain the default value. The cluster ID will be obtaineddynamically.

● dataVolumes: data disk. You are advised to attach at least one data disk.● flavor: node specifications.● instances: number of nodes.● name: node name, which can be customized.● publicIp: If a node needs to be accessed over the Internet, set this parameter

and bind an elastic IP address.● rootVolume: disk type and size of a node. Retain the default value.● sshKeyName: name of the key for logging in to a node. The name can be

customized.

Step 5 Click the blank area in the canvas. The Input tab page is displayed. Set inputparameters on the Input tab page.

The input parameters set here correspond to the parameters set using get_inputin previous steps.

inputs: vpc-cidr: description: available subnets in the VPC label: '' default: '192.168.0.0/16' vpc-name: description: VPC name default: aos-vpc subnet-name: description: subnet name default: aos-subnet clusterFlavor: description: cluster specifications default: cce.s1.small clusterName: description: cluster name default: aos-cluster availabilityZone: description: AZ default: cn-south-2b nodeVolumeType: description: data disk type corresponding to the cloud server. The data disk type must match the disk type provided by the system. default: SATA nodeName: description: name of the created node default: aos-cce-node dataVolumeType: description: system disk type default: SATA

Application Orchestration ServiceBest Practices

3 Using the AOS Designer to Quickly Deploy aContainer Cluster

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 28

Page 32: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

dataVolumeSize: description: system disk size default: 40 nodeFlavor: description: container node specifications default: s3.large.2 shareType: description: sharing type of the elastic IP address default: PER bandwidthSize: description: bandwidth of the elastic IP address default: 1 ipType: description: type of the elastic IP address default: 5_bgp sshKey: description: key pair used for node login. Keep the key pair secure.

Step 6 Set the outputs section. This section is optional and is used to define the outputparameters during stack runtime. In this example, the elastic IP address and portnumber of the node generally need to be obtained by other components.Therefore, set the elastic IP address (publicip) as an output parameter.

To create a container cluster and add nodes, the following parameters need to beoutput:

● Parameters in the outputs section. For example, cluster_id and public_ip, which can becustomized

● Parameters behind get_attribute (which is used to automatically obtain a value froman element). For example, mycluster, which must be consistent with the definedelement name. The values behind mycluster and mynode, for example, clusterId andpublicIp, must match the output parameters of the current element and cannot becustomized.

outputs: cluster_id: description: ID of created cluster value: get_attribute: - mycluster - clusterId public_ip: description: EIP of created node value: get_attribute: - mynode - publicIp

The following describes the properties:

● cluster_id: cluster ID, which can be automatically obtained from the my-cluster element by using the get_attribute function.

● public_ip: the elastic IP address, which can be automatically obtained fromthe my-node element by using the get_attribute function.

Step 7 Click to check whether the template is correct. If the message "Templatevalidated successfully" is displayed on the Operation Log on the left, the templateis correct.

Application Orchestration ServiceBest Practices

3 Using the AOS Designer to Quickly Deploy aContainer Cluster

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 29

Page 33: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Step 8 Click , click the My Templates tab, enter the template and version,and then click Save.● Name: name of a template, which can be customized but must be globally

unique. For example, set this parameter to mycluster.● Version: 1.0. Retain the default value.

----End

Creating a Container Cluster Stack

Step 1 Click in the upper right corner of the designer page to enter the homepage ofthe AOS console.

Step 2 In the navigation pane, choose My Templates. You can view the myclustertemplate in the template list.

Step 3 Click Create Stack next to the mycluster template to create a stack.

Step 4 Set stack information.● Stack Name: Enter a stack name, for example, mycluster.● Description: You can keep it blank.● Set input parameters, as shown in Table 3-1. Retain the default values for

other parameters.

Table 3-1 Setting input parameters

Parameter Description Value

sshKey Key pair for logging into the node.

Select a created key pair.

Step 5 Click Next and check the stack information. If the stack information is correct,click Create Stack.

The stack details page is displayed, showing that the stack is being created. A VPC,subnet, cluster, and node will be created. The creation will take about 10 minutes.

Step 6 Check the stack status. When the status becomes Normal, you can view that fourcloud services on the Elements tag page. That is, a VPC, subnet, cluster, and nodehave been created successfully.

Step 7 Log in to the CCE console. You can view the created cluster and node.

1. In the navigation pane, choose Resource Management > Clusters. You canview the created cluster.

Application Orchestration ServiceBest Practices

3 Using the AOS Designer to Quickly Deploy aContainer Cluster

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 30

Page 34: Application Orchestration Service · Step 2 In the Industry Templates area, click Magento E-commerce Application to view details. Figure 1-2 Selecting a public template The template

Figure 3-3 Created container cluster

2. In the navigation pane, choose Resource Management > Nodes. You canview the created node.

Figure 3-4 Created node

----End

Deleting ResourcesYou are advised to delete unnecessary stack resources to avoid unwanted charges.

Step 1 Log in to the AOS console.

Step 2 In the navigation pane, click My Stacks.

Step 3 In the stack list, select the mycluster stack and click Delete to delete it.

Delete the stack as prompted.

----End

Application Orchestration ServiceBest Practices

3 Using the AOS Designer to Quickly Deploy aContainer Cluster

Issue 01 (2020-05-28) Copyright © Huawei Technologies Co., Ltd. 31