Enterprise Distributed Application Service (EDAS) lets you build Python applications from source code, scripts, or compressed packages and deploy them to Container Service for Kubernetes (ACK) clusters. EDAS provides features such as application scaling, monitoring and alerting, load balancing, and throttling and degradation. This topic describes how to build a Python application from source code and deploy it to an ACK cluster.
Prerequisites
-
EDAS and ACK are activated for your Alibaba Cloud account. For more information, see the following topics:
-
ACK default roles are granted to your account. For more information, see ACK roles.
Step 1: Create an ACK cluster
Log on to the ACK console and create an ACK cluster. For more information, see Create a managed Kubernetes cluster.
If you want to create an ACK Serverless cluster, set the VPC parameter to Create VPC and set the Service Discovery parameter to PrivateZone. This allows the ACK Serverless cluster to use Alibaba Cloud Service Mesh (ASM) after the cluster is imported to EDAS. If you set the VPC parameter to Select Existing VPC, check whether the cluster contains virtual private cloud (VPC) and vSwitch resources after you create the cluster. For more information, see Create a cluster.
Step 2: Import an ACK cluster to the EDAS console
By default, the ack-ahas-sentinel-pilot, ack-arms-pilot, and ack-arms-prometheus components are installed when you import an ACK cluster to EDAS in the EDAS console. The ack-ahas-sentinel-pilot component is an application protection component for throttling and degradation. The ack-arms-pilot component is an Application Real-Time Monitoring Service (ARMS) component. The ack-arms-prometheus component is a Prometheus monitoring component.
-
Log on to the EDAS console. In the left-side navigation pane, choose .
-
In the top navigation bar, select the region in which your ACK cluster resides, and click Synchronize Container Service Kubernetes Cluster.
-
Find the ACK cluster that is synchronized to EDAS and click Import in the Actions column.
-
In the Precheck for Import dialog box, click Continue.
-
In the Import Kubernetes Cluster dialog box, select the microservice namespace to which you want to import the ACK cluster from the Microservice Namespace drop-down list, turn on or off Service Mesh based on your business requirements, and then click Import.
If the value in the Cluster Status column is Running and the value in the Import Status column is Imported for the ACK cluster, the cluster is imported to EDAS.
Step 3: Deploy a Python application in the ACK cluster
-
Log on to the EDAS consoleEDAS console.
-
In the left-side navigation pane, choose . In the top navigation bar, select a region. In the upper part of the Applications page, select a microservices namespace from the Microservices Namespace drop-down list. Then, click Create Application in the upper-left corner of the Applications page.
On the Basic Information page, set the cluster type and application runtime environment, and then click Next.
Configuration Item
Description
Cluster Type
Select Kubernetes Cluster.
Workload Type
The default value is Stateless (Deployment).
Application Source Type
Select Default.
Hosted Application Type
This topic describes how to deploy a Python application. Select Python. To deploy a Java or PHP application, see Deploy an application from a JAR or WAR package in a Kubernetes cluster or Build a PHP application from source code and deploy it to a Kubernetes cluster.
Select Application
This topic describes how to deploy a Python application. Select Python. After you select Python, you must also select a Python Version and an Nginx Version (optional).
If you select Custom, you must configure an image or use a demo image to deploy the application on the Application Configuration page.
On the Application Configuration tab, configure the environment context, basic information, and source code and image build information. Then, click Next.
Configuration Item
Description
Microservices Namespace
Select the microservices namespace that you created. If you have not created a microservices namespace or do not make a selection, the microservices namespace is set to Default.
If you have not created a microservice namespace or you want to create another microservice namespace, click Create Microservice Namespace to create a microservice namespace. For more information, see the "Create a namespace" section of the Manage microservice namespaces topic.
Cluster
From the drop-down list on the right, select the imported ACK cluster.
If the selected Kubernetes cluster is not imported to EDAS, select This cluster is used for the first time in EDAS. If you select this check box, the cluster is imported to EDAS when an application is created. This consumes a certain amount of time. Then, check whether Alibaba Cloud Service Mesh is activated.
NoteThe microservices namespace into which the cluster is imported can be different from the microservices namespace to which the application belongs.
Kubernetes Namespace
A Kubernetes namespace logically groups objects in a cluster into different projects, teams, or user groups. This allows different groups to share cluster resources and be managed separately.
default: The default namespace for objects that do not belong to other namespaces.
kube-system: The namespace for objects created by the system.
kube-public: This namespace is automatically created and is readable by all users, including unauthenticated users.
In this example, default is selected.
If you want to create a custom Kubernetes namespace, click Create Kubernetes Namespace. In the dialog box that appears, enter a name for the Kubernetes namespace in the K8s Namespace field. The name can contain digits, lowercase letters, and hyphens (-), and can be 1 to 63 characters in length. It must start and end with a letter or a digit.
Application Name
Enter an application name. The name must start with a letter and can contain digits, letters, and hyphens (-). The name can be up to 36 characters in length.
Deployment Package Source
The source of the application deployment package is one of the following:
Upload Compressed Package or Use Package URL (default): Upload a
.taror.zippackage to an Object Storage Service (OSS) bucket of EDAS, or use a demo package.Single Script: Upload a single Python script to an OSS bucket of EDAS.
Source Code Deployment (Git-supported): Use a demo project and select an authentication method.
Build Repository Type
The repository where the image is stored after it is built from a
.taror.zippackage. Valid values:EDAS Image Repository (default): During the build process, the build task runs in your cluster, but the result is pushed to the EDAS image repository.
ACR Personal Edition or ACR Enterprise Edition: During the build process, the build task runs in your cluster, but the result is pushed to the image repository that you select.
Image Target Architecture
Select the target platform architecture for the image. The supported architectures are linux/amd64 and linux/arm64. If you do not select an architecture, the image is built for linux/amd64 by default. For more information, see Configure image target architecture.
ACR Region
Select the region where your container image is located. This parameter is required only when you set Build Repository Type to ACR Enterprise Edition.
Container Registry
Select your Container Registry instance. This parameter is required only when you set Build Repository Type to ACR Enterprise Edition.
Image Repository Namespace
From the drop-down list, select the microservices namespace where your image repository is located. You can also click +Create Namespace on the side to create a new microservices namespace.
Version
You can use a timestamp as the version or specify a custom version number.
Time Zone
Select the UTC time zone that corresponds to your region.
Total Pods
Set the number of pods to deploy for the application.
Resource Quota per Pod
Set the CPU and memory for a single pod. To set a limit, enter a specific number. The default value 0 indicates no limit.
On the Application Startup Settings page, select an Application Startup Method, write a script, and specify the Python dependencies. You can also use AI to quickly generate the script and dependencies. Then, click Next.
NoteAfter you select an Nginx version, you can specify the Nginx configuration.
(Optional) On the Advanced Application Settings page, configure settings as needed and click Next.
On the Group Settings (Required) page, select a Resource Group and click Create Application.
On the Application Created page, confirm the information and click Confirm and Create Application.
Application creation may take several minutes. During this process, you can view the creation progress on the Change History page. After the application is created, go to the Application Overview page. The application is deployed when the pod instance is in the Running state. You can click the running status of the pod to view advanced configuration information about the application instance, such as Workload, Pods (Container Groups), and Startup Command.
What to do next
After you deploy the application, add an Internet-facing Server Load Balancer (SLB) instance to allow access to the application over the Internet. You can also add an internal-facing SLB instance so that all the nodes in the same VPC can access the application by using this internal-facing SLB instance. For more information, see Bind CLB instances or Reuse a CLB instance.
Contact us
If you have questions or suggestions about deploying multi-language microservice applications in EDAS, you can join the DingTalk group by searching for the ID 23307994 in DingTalk.
