Deploy Spring Cloud and Dubbo applications in a Kubernetes cluster using kubectl and Helm

更新时间:
复制 MD 格式

EDAS provides demos for Spring Cloud, Dubbo, and HSF microservice applications to help you understand the deployment flow. This topic describes how to deploy a microservice application demo in a Kubernetes cluster using native methods.

Prerequisites

Background information

Deploy the application

The EDAS microservice application demo includes native deployment configurations for the server-side (provider) and client-side (consumer) applications. It also includes a service and an Ingress to ensure that the applications are accessible.

  1. On your local terminal, run the following command to download the Helm Chart package for the demo application.

    wget https://edas-hz.oss-cn-hangzhou.aliyuncs.com/helm/edas-apps-demo-chart-1.0.0.tgz
    Note

    The link to download the Chart package is a public URL. Make sure that you have configured Source Network Address Translation (SNAT) for your cluster. For more information, see Use the SNAT feature of an Internet NAT gateway to access the Internet.

  2. On your local terminal, run the following command to create the application using Helm.

    helm install edas-apps-demo edas-apps-demo-chart-1.0.0.tgz
  3. Verify that the application is created.

    Check from the command line

    Run the following command:

    kubectl get cloudapps

    Expected output:

    image.png

    Check from the console

    Log on to the EDAS console. In the navigation pane on the left, click Application Management > Application List to view the created application.

    Note

    The Deployment YAML configuration in the Helm Chart package contains the edas.alibabacloud.com/app label. After the deployment is created, it is automatically managed by EDAS, and a corresponding EDAS application is generated. For more information, see Create an EDAS application using the native Kubernetes method.

  4. After you confirm that the application is running, you can run the following command on your local terminal.

    kubectl get ingress

    Note the ADDRESS value from the output for later use.

    image

  5. On your local terminal, run the following command to call the consumer-echo API of the consumer application.

    curl -H "Host: www.edas-consumer.com" http://<IP_ADDRESS>/consumer-echo/Hello

    Replace <IP_ADDRESS> with the ADDRESS value that you obtained in Step 4. This is the IP address of the Nginx Ingress load balancer in the cluster.

    Note

    If you enabled the public network access option when you created the Kubernetes cluster, you can directly access the application using this IP address. If the IP address is a private IP address, you can access the application only from within the corresponding Virtual Private Cloud (VPC).

  6. If output similar to the following is returned, the application was deployed successfully.

    1696991186943 Consumer received.
    	1696991187105 Provider received.
    		Provider processed after sleep 1 second! Echo String: "Hello"
    	1696991188105 Provider Return
    1696991188138 Consumer Return

Delete the application

After you verify the deployment, run the following command to uninstall the Helm Chart and delete the test application.

helm uninstall edas-apps-demo

image

References

You can also use the console to create a microservice application. For more information, see Quickly deploy Spring Cloud and Dubbo applications in a Kubernetes cluster using the console.