All Products
Search
Document Center

Enterprise Distributed Application Service:Use Alibaba Cloud Toolkit to release an application to all instances in a Kubernetes cluster at a time

Last Updated:Sep 21, 2023

After you develop, debug, and test your application in your on-premises environment, you can install Alibaba Cloud Toolkit in IntelliJ IDEA to deploy your application to Enterprise Distributed Application Service (EDAS). This topic describes how to install Alibaba Cloud Toolkit in IntelliJ IDEA and deploy an application to a Container Service for Kubernetes (ACK) cluster.

Prerequisites

Step 1: Install Alibaba Cloud Toolkit

  1. Start IntelliJ IDEA.

  2. Install the latest version of Alibaba Cloud Toolkit in IntelliJ IDEA.

    If you have installed an earlier version of Alibaba Cloud Toolkit, upgrade Alibaba Cloud Toolkit to the latest version.

    • macOS: In the left-side navigation pane of the Preferences page, click Plugins. On the right side of the page, enter Alibaba Cloud Toolkit in the search box and click the search icon. Then, click Install.Install-Intellij-Idea-MAC-20190722.png

    • Windows: In the left-side navigation pane of the Settings page, click Plugins. On the right side of the page, enter Alibaba Cloud Toolkit in the search box and click the search icon. Then, click Install.edas-cloudtoolkit-installconfig-Windows-20190722.png

  3. After Alibaba Cloud Toolkit is installed in IntelliJ IDEA, restart IntelliJ IDEA. The Alibaba Cloud Toolkit icon act图标 appears in the toolbar.

Step 2: Configure an Alibaba Cloud Toolkit account

After Alibaba Cloud Toolkit is installed, use your AccessKey ID and AccessKey secret to configure an Alibaba Cloud Toolkit account.

  1. Start IntelliJ IDEA.

  2. In the top navigation bar of IntelliJ IDEA, choose Tools > Alibaba Cloud > Preferences.

  3. In the left-side navigation pane, choose Alibaba Cloud Toolkit > Accounts.

  4. On the Accounts page, set the Access Key ID and Access Key Secret parameters and click OK.

    • If you use the AccessKey ID and the AccessKey secret of a Resource Access Management (RAM) user, make sure that the RAM user is authorized to deploy applications.

    • If your EDAS service is deployed on Apsara Stack Enterprise, you must configure an endpoint to use Alibaba Cloud Toolkit.Config-Idea-Cloud-Toolkit-Account.png

      • If you already have an Alibaba Cloud account, click Get existing AK/SK on the Accounts page. The logon page of Alibaba Cloud appears. After you log on to the system with your Alibaba Cloud account, you are navigated to the AccessKey Management page. On this page, obtain the AccessKey ID and the AccessKey secret of the account.

      • If you do not have an Alibaba Cloud account, click Sign up on the Accounts page. On the page that appears, create an Alibaba Cloud account. Then, obtain the AccessKey ID and the AccessKey secret of the account by using the preceding method.

Step 3: Deploy your application to an ACK cluster

  1. In the top navigation bar of IntelliJ IDEA, choose Tools > Alibaba Cloud > Deploy to EDAS > EDAS for Kubernetes Application.

    Alternatively, in the top navigation bar of IntelliJ IDEA, choose Run > Edit Configurations. In the left-side navigation pane of the Run/Debug configurations dialog box, choose Templates > EDAS on Alibaba Cloud > EDAS for Kubernetes Application.

  2. In the Deploy to EDAS dialog box, configure the application deployment parameters.

    edas-cloudtoolkit-installK8sApp-Windows-20190722.png
    1. On the Settings tab, set the Region, Namespace, and Application parameters based on your business requirements.

      Important

      If the application is not in the application list, you can troubleshoot the issue. For more information, see the FAQ section of this topic.

      • Region: the region in which the application is to be deployed.

      • Namespace: the microservice namespace in which the application is to be deployed.

      • Application: the name of the application.

    2. Select the method that is used to deploy the application in the EDAS console.

      • Maven Build: If you select this option to build the application, the system adds a Maven job to build the deployment package.

        Note

        For more information about how to deploy a multi-module project, see the Deploy a multi-module project section of this topic.

      • Upload File: If you select this option to build the application, upload your WAR package or JAR package and deploy the application.

      • Build Image: If you select this option to build the application, select a working directory for the Context Directory parameter and select a file path for the Dockerfile parameter. Then, enter an image version in the Version field.edas-cloudtoolkit-installK8sApp-BuildImage-20190722

      • Select Image: If you select this option to build the application, select an image from the Select Image drop-down list to deploy the application.

    3. Click the Advanced tab. On this tab, set the advanced deployment parameters in the Application Environment, Startup Command, Environments, Persistence, Storage, and Application Management sections.

      For more information, see DeployK8sApplication.edas-cloudtoolkit-installK8sApp-advanced-20190722.png

      • Application Environment: Specify a runtime environment for the application. You must set the PackageVersion parameter each time you deploy the application.edas-cloudtoolkit-installK8sApp-advanced-Application Environment.png

      • Startup Command: Specify the startup command information. For more information, see DeployK8sApplication.

      • Environments: Specify the deployment environment variables for the application. For more information, see DeployK8sApplication.

      • Persistence: Configure persistent storage.edas-cloudtoolkit-installK8sApp-advanced-persistence.png

      • Storage: Configure on-premises storage. For more information, see DeployK8sApplication.

      • Application Management: Specify the parameters for application lifecycle management.

        • Poststart: a container hook. The hook is immediately triggered after a container is created. The hook notifies Kubernetes that the container is created. The hook does not pass parameters to the corresponding hook handler. If the corresponding hook handler fails to be executed, the container is stopped, and the restart policy of the container is used to determine whether to restart the container. For more information, see Container Lifecycle Hooks.

        • PreStop: a container hook. The hook is triggered before a container is deleted. The corresponding hook handler must be executed before the request to delete the container is sent to the Docker daemon. The Docker daemon sends a SIGTERN signal to itself to delete the container, regardless of the execution result of the corresponding hook handler. For more information, see Container Lifecycle Hooks.

        • Liveness: a probe that monitors your container status. The probe checks whether your applications are healthy. If an application is unhealthy, its corresponding container is deleted and re-created. For more information, see Pod Lifecycle.

        • Readiness: a probe that monitors your container status. The probe checks whether your applications have been started and are running as expected. If the application cannot run as expected, the container status is updated. For more information, see Pod Lifecycle.

  3. Click Apply and then click Run.

    The deployment log records are displayed on the Console tab of IntelliJ IDEA. You can use the log records to check the deployment result.

Deploy a multi-module project

Most Maven projects are multi-module projects. A multi-module project is a project in which the modules of the project can be separately developed and some of the modules may use the features of other modules.

For example, your project is a Maven multi-module project, and you want to deploy a submodule of the project. Make sure that the last Maven job in the Before launch section on the EDAS Deployment Configurations page is the build job for the submodule. For more information about how to manage Maven build jobs, see the Manage Maven build jobs section of this topic.

The following example shows the submodules of the CarShop project:

carshop
├── itemcenter-api       
├── itemcenter    
├── detail      

In this example, itemcenter and detail are submodules and depend on the itemcenter-api module. In this case, to deploy the itemcenter submodule, you need to only add the following two Maven jobs in the Before launch section on the EDAS Deployment Configurations page:

  • Add a Maven job to run the mvn clean install command in the parent project CarShop.

  • Add a Maven job to run the mvn clean package command in the itemcenter submodule.

Manage Maven build jobs

You can deploy Maven build jobs in Alibaba Cloud Toolkit installed in IntelliJ IDEA. In the Deploy to EDAS dialog box, you can create, delete, modify, or move Maven build jobs in the Before launch section.

edas-cloudtoolkit-idea-manage-APP.png

In the Select Maven Goal dialog box, click the folder icon next to the Working directory field and select all the available modules for the current project. Then, enter the build command in the Command line field.

add-maven-in-Intellij-Idea.png

FAQ

  • Why am I unable to find my application in the application list?

    In most cases, this issue occurs if your application is deployed by using a RAM user that is not synchronized to EDAS or is not authorized to deploy the application. As a result, the application is not displayed in the Application drop-down list. To resolve the issue, you can grant the required permissions to the RAM user in the RAM console or the EDAS console and synchronize the RAM user to EDAS.

    • Grant permissions to the RAM user in the RAM console

      You can use this authorization method to grant the RAM user the permissions to access all the EDAS resources.

      1. In the left-side navigation pane of the RAM console, choose Identities > Users.

      2. On the Users page, find the RAM user and click Add Permissions in the Actions column.

      3. In the Select Policy section of the Add Permissions panel, search for the AliyunEDASFullAccess policy and click the policy to add it to the Selected section. Then, click OK.

      4. In the Add Permissions panel, check the summary of the authorization information and click Complete.

      5. Log on to the EDAS console with your Alibaba Cloud account. In the left-side navigation pane, choose System Management > RAM User. In the upper-right corner of the RAM User page, click Synchronize RAM User.

    • Grant permissions to the RAM user in the EDAS console

      You can use this authorization method to grant the RAM user the fine-grained permissions to access EDAS resources.

      1. Log on to the EDAS console with your Alibaba Cloud account.

      2. In the left-side navigation pane, choose System Management > Roles. In the upper-right corner of the Roles page, click Create Role.

      3. In the Create Role dialog box, enter a role name in the Role field. In the Optional Permissions section, choose Applications > Basic Information > Deploy Application. Then, click Add to add the role for application deployment to the Selected Permissions section and click OK.

      4. In the left-side navigation pane, choose System Management > RAM User. In the upper-right corner of the RAM User page, click Synchronize RAM User.

      5. Find the RAM user to which you want to grant permissions, and click Manage Roles in the Original Authorization for EDAS column. In the Manage Roles dialog box, search for the role to be added in the Unselected section. Then, select the role and add it to the Selected section, and click OK.

      6. Find the RAM user to which you want to grant permissions and click Applications Authorized in the Original Authorization for EDAS column. In the Applications Authorized dialog box, search for the application that you want to deploy in the Unselected section. Then, select the application and add it to the Selected section, and click OK.

  • How do I configure an endpoint?

    Note

    If your EDAS service is deployed on Apsara Stack Enterprise, you must configure an endpoint in Alibaba Cloud Toolkit. To obtain an endpoint, contact EDAS technical support.

    1. In the left-side navigation pane of the Preference (Filtered) dialog box, choose Appearance & Behavior > Endpoint.

    2. On the Endpoint page, configure an endpoint and click Apply and Close.