All Products
Search
Document Center

Enterprise Distributed Application Service:Use an image to deploy a Java microservices application in a Kubernetes cluster

最終更新日:Jan 24, 2024

Enterprise Distributed Application Service (EDAS) fully integrates with Container Service for Kubernetes (ACK) based on cloud-native Kubernetes. EDAS allows you to manage the full lifecycle of Kubernetes containerized applications. An ACK cluster is embedded with the capabilities of Alibaba Cloud in virtual machines, storage, networking, and security, and provides an excellent runtime environment for Kubernetes containerized applications. This topic describes how to use an image to deploy a Java microservices application in a Kubernetes cluster.

Background information

To deploy applications in a Container Service for Kubernetes (ACK) cluster, you must create a cluster in the ACK console and import the cluster to the Enterprise Distributed Application Service (EDAS) console. Then, you can use deployment packages or images to deploy applications in the cluster.

Procedure for deploying an application in an ACK cluster

Prerequisites

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 a 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 an ACK Serverless 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.

  1. Log on to the EDAS console. In the left-side navigation pane, choose Resource Management > Container Service Kubernetes Clusters.

  2. In the top navigation bar, select the region in which your ACK cluster resides, and click Synchronize Container Service Kubernetes Cluster.

  3. Find the ACK cluster that is synchronized to EDAS and click Import in the Actions column.

  4. In the Precheck for Import dialog box, click Continue.

  5. 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 Java application in the Kubernetes cluster

  1. Log on to the EDAS console. In the left-side navigation pane, choose Application Management > Applications. In the top navigation bar, select a region. In the upper part of the page, select a microservice namespace. In the upper-left corner of the Applications page, click Create Application.

  2. In the Basic Information step, configure the parameters in the Cluster Type and Application Runtime Environment sections and click Next.

    Parameter

    Description

    Cluster Type

    The type of the cluster in which you want to deploy the application. Select Kubernetes Clusters.

    Note

    Kubernetes clusters support ASM.

    Application Source Type

    The source of the application. Select Default.

    Application Runtime Environment

    Hosted Applications

    The programming language based on which the application is developed. This topic provides an example on how to deploy a Java application. In this example, select Java. For more information about how to deploy a PHP application or a multilingual application, see Build PHP applications from source code and deploy them in ACK clusters.

    Select Application

    The runtime environment of the application. The runtime environment varies based on the type of the programming language and deployment package of your application. In this example, select Custom. A value of Custom indicates that a custom image is used to deploy the Java application. In this case, a runtime environment is automatically used for the application because the runtime environment is built into the image.

    Note

    OpenJDK 17 is compatible with Dubbo 2.7.14 and later or Dubbo 3.0.6 and later. For more information about the compatibility test data of OpenJDK 17, see Compatibility test data of OpenJDK 17.

    Table 2. Compatibility test data of OpenJDK 17

    Dubbo version

    Spring Boot version

    Nacos client version

    API call

    ARMS monitoring

    Service list

    2.7.14

    2.7.9

    1.4.4

    Supported

    Supported

    Supported

    2.7.14

    2.7.9

    2.1.2

    Supported

    Supported

    Supported

    2.7.14

    2.7.9

    2.2.0

    Supported

    Supported

    Supported

    2.7.22

    2.7.9

    1.4.4

    Supported

    Supported

    Supported

    2.7.22

    2.7.9

    2.1.2

    Supported

    Supported

    Supported

    2.7.22

    2.7.9

    2.2.0

    Supported

    Supported

    Supported

    3.0.6

    2.7.9

    1.4.4

    Supported

    Supported

    Supported

    3.0.6

    2.7.9

    2.1.2

    Supported

    Supported

    Supported

    3.0.6

    2.7.9

    2.2.0

    Supported

    Supported

    Supported

    3.1.7

    2.7.9

    1.4.4

    Supported

    Supported

    Supported

    3.1.7

    2.7.9

    2.1.2

    Supported

    Supported

    Supported

    3.1.7

    2.7.9

    2.2.0

    Supported

    Supported

    Supported

  3. In the Configurations step, configure the environment information, basic information, deployment method, and resource parameters for the application and click Next.

    Parameter

    Description

    Microservice Namespace

    The microservice namespace in which you want to deploy the application. Select the microservice namespace that you created. If you do not have or select a microservice namespace, this parameter 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

    The cluster in which you want to deploy the application. Select a Kubernetes cluster from the Cluster drop-down list.

    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.

    Note

    You can select a cluster that does not belong to the same microservice namespace as the application.

    K8s Namespace

    The Kubernetes namespace of the application. Internal system objects are allocated to different Kubernetes namespaces to form logically isolated projects, teams, or user groups. This way, different groups can be separately managed and share the resources of the entire cluster. Valid values:

    • default: the default Kubernetes namespace. If you do not specify a Kubernetes namespace for an object, the default Kubernetes namespace is used.

    • kube-system: the Kubernetes namespace for the objects that are created by the system.

    • kube-public: the Kubernetes namespace that is automatically created by the system. This Kubernetes namespace can be read by all users, including unauthenticated users.

    In this example, select default.

    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

    The name of the application. The name must start with a letter and can contain digits, letters, and hyphens (-). The name can be up to 36 characters in length.

    Application Description

    The description of the application. The description can be up to 128 characters in length.

    Image Type

    • The type of the image that is used to deploy the application. Valid values: Configure Image

      • If you set the Alibaba Cloud Container Registry parameter to Current Account, perform the following operations:

        Configure the Region, Container Registry, Image Repository Namespace, and Image Repository Name parameters and select an image version.

      • If you set the Alibaba Cloud Container Registry parameter to Other Alibaba Cloud Accounts, perform one of the following operations:

    • Demo Image

      If you select this option, you must use a demo image provided by EDAS and select an image version.

      Note

      Demo images are not provided for Apsara Stack.

    Note

    Before you use the images in a repository of Container Registry Enterprise Edition to deploy applications as a RAM user, the RAM user must obtain the required permissions from the relevant Alibaba Cloud account. For more information, see Configure policies for RAM users to access Container Registry.

    Total Pods

    The number of pods on which you want to deploy the application. The maximum number of pods is subject to the cluster performance.

    Single-pod Resource Quota

    The CPU, memory, and ephemeral storage that you want to reserve for a pod. If you want to specify a limit, enter a numeric value. The default value 0 specifies that no limit is imposed. The maximum quotas of CPU, memory, and ephemeral storage are subject to the cluster performance.

  4. (Optional) In the Advanced Settings step, configure the advanced settings.

  5. After you configure the advanced settings, click Create Application. In the Creation Completed step, click Create Application.

  6. In the Confirm Application Change Precheck dialog box, click Start Precheck.

    1. After the data in the dialog box is refreshed, confirm the precheck items and results and click Continue.

    2. (Optional) If you modify the preceding precheck items, click Check Again.

    The application requires several minutes to be deployed. During the process, you can view the change records to track the deployment progress of the application on the Change List page. After you deploy the application, go to the Application Overview page to view the running status of pods. If the pods are in the running state, the application is deployed. You can click the running status of pods to view the Deployments, pods, and advanced configurations of the application instances.

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 when you use ACK clusters and ACK Serverless clusters in EDAS, join the DingTalk group (group ID: 23197114) to contact technical support.