This topic describes the definition of Function Compute services and how to create, update, and delete services in the Function Compute console.

What is a service?

A service is a resource management unit in Function Compute. Before you create a function, you must create a service. All functions of the same service share the same settings such as service authorization and log configuration.

From a business scenario, an application can be split into multiple services. From the resource utilization perspective, a single service can consist of multiple functions. For example, a data processing service is divided into two parts: data preparation and data processing. During data preparation, you can select a low-specification instance due to undemanding requirements for function resources. During data processing, however, you need to select a high-specification instance due to demanding requirements for function resources.

Create a Service

  1. Log on to the Function Compute console.
  2. In the left-side navigation pane, click Services and Functions.
  3. In the top navigation bar, select the region where your Kubernetes cluster is deployed.
  4. On the Services page, click Create Service.
    create_service_new
  5. In the Create Service panel, enter the service name and description, set the log and Tracing Analysis functions as needed, and then click OK.
    create_service_pane
    Table 1. Parameters
    Parameter Required Description
    Logging Yes Specifies whether to enable Alibaba Cloud Log Service. Valid values:
    • Enable: When enabled, the Function Compute automatically creates the corresponding projects (log projects) and Logstores (log warehouses) for you in Log Service, and automatically delivers function logs to the corresponding Logstores.

      In this case, the Function Compute grants principle of least privilege-based AliyunFCDefaultRole to your service to access Log Service. For more information about service-linked roles, see Grant Function Compute permissions to access other Alibaba Cloud services.

    • Disable: If you disable logging, you cannot use Log Service to store or query function execution logs.
    Note Make sure that you have activated Log Service. Otherwise, the log feature cannot be enabled.
    Tracing Analysis function Yes Specifies whether to enable the Alibaba Cloud Tracing Analysis feature. Valid values:
    • Enable: After you enable this feature, you can use Jaeger to upload link information. This allows you to track the execution of functions. This helps you quickly analyze and diagnose performance bottlenecks in the Serverless architecture. For more information, see Overview.
    • Disabled: The Tracing Analysis feature is not enabled.
    Notice Make sure that you have activated the Tracing Analysis service. Otherwise, the Tracing Analysis function cannot be enabled.
    After the service is created, you can view the created service and its configuration on the Services page of the Services and Functions page.

Update a Service

  1. Log on to the Function Compute console.
  2. In the left-side navigation pane, click Services and Functions.
  3. In the top navigation bar, select the region where your Kubernetes cluster is deployed.
  4. On the Services page, find the target service. In the Actions column, click Configure.
  5. On the Edit Service page, set the configuration items as needed, and then click Save.
    • Optional:Basic Information

      Configure the basic information of the service. Currently, you can only modify the service description.

      Parameter setting Description
      Description The description of the service to help you identify the purpose of the service.
    • Optional:Other configurations
      Property Description References
      role configuration Configure the role used by the function in the service so that the function can obtain the permissions of the role. Grant Function Compute permissions to access other Alibaba Cloud services
      Logging Configure the log feature of the service. After the log feature is enabled, you can view the execution logs of the function. This allows you to perform code debugging, fault analysis, and data analysis.
      Tracing Analysis configuration After you enable the Tracing Analysis feature, you can use Jaeger to upload link information. This enables you to track the execution of functions and helps you quickly analyze and diagnose performance bottlenecks under the Serverless architecture. Configure Tracing Analysis
      Network Settings Configure the network used by the function in the service. For example, configure whether the function can access the Internet and whether it can access resources in the VPC.
      NAS file system configuration Configure the NAS file system used by the functions in the service. After the configuration, your function can access files stored on one of the NAS file systems just like accessing the local file system. Configure a NAS file system

Delete a service

Notice Before you delete a service, make sure that there are no functions, reserved function instances, versions, or aliases in your service. Otherwise, the deletion fails.
  1. Log on to the Function Compute console.
  2. In the left-side navigation pane, click Services and Functions.
  3. In the top navigation bar, select the region where your Kubernetes cluster is deployed.
  4. On the Services page, find the service that you want to delete and click the name of the service.
  5. In the upper-right corner of the Service Details page, click Delete.
  6. In the message that appears, click OK.
    You cannot view the deleted service information on the Services page.

References

In addition to the Function Compute console, you can also use the Serverless Devs tool to manage services. For more information, see Service-related commands.