Best Practices for Spring Cloud Applications in Kubernetes: Deployment (Deployment with Tools)
By Guyi, Alibaba Cloud Senior Technical Expert, focusing on EDAS development and user experience optimization
In the previous article, we explained how to deploy an application by using the integrated development environment (IDE) plug-in. Currently, Enterprise Distributed Application Service (EDAS) also supports additional tools to make it applicable to other scenarios. This article describes the deployment tools in EDAS.
Deployment with the IDE Plug-In
An IDE provides the most commonly used tools for developers in coding. The deployment capability of the IDE plug-in is also made for developers to implement application deployment. The IDE plug-in features high speed and ease of use. It applies to application deployment with WAR or JAR files and custom images in Elastic Compute Service (ECS) clusters or Kubernetes clusters. For more information about how to use the IDE plug-in, see Use Alibaba Cloud Toolkit to deploy applications to EDAS.
If any developer can make arbitrary changes to online applications, they will not be secure. To address this issue, we designed EDAS namespaces to isolate services and configurations in different environments. The environments can be common environments, such as development, testing, and production. To prevent users from accidentally changing the online environment by using the IDE plug-in, we have added the Allow Remote Debugging switch for namespaces. The switch is off by default. To perform corresponding operations by using the IDE plug-in, you have to turn it on, as shown in the following figure.
Deployment with the Maven Plug-In
The Maven plug-in applies to scenarios that lie between development and operation and maintenance (O&M.) It is designed based on the currently popular DevOps concept, which can release deployment procedures as configuration. You can put the configuration information for deployment and the code-based projects together for version tracking. You can also distinguish the configuration of applications based on their profiles in Spring. After you complete the configuration, you only need to run the
mvn toolkit:deploy command to make the deployment. For more information, see Use toolkit-maven-plugin to automatically deploy applications in EDAS.
Deployment with CI/CD
Continuous integration and continuous delivery (CI/CD) exist in every standard DevOps procedure. As the most widely used CI/CD tool available in the market, Jenkins is well-known for its ease of use and rich plug-in capabilities. The EDAS team has also developed the corresponding “edas-jenkins-plugin” plug-in that applies to deployment in all mainstream EDAS scenarios, especially in Kubernetes, where the image building, pushing, and deployment capabilities are integrated.
Currently, many users are using Apsara DevOps, which has integrated powerful pipeline capabilities. EDAS has a built-in task template for pipelines named Deploy applications to EDAS.
Orchestration with Terraform
Terraform is a tool for building, changing, and versioning the infrastructure securely and effectively. It is a tool for infrastructure automatic orchestration. It provides code for the infrastructures (such as VMs, storage accounts, and network interfaces) defined in the configuration files that describe the cloud resource topology. The command-line interface (CLI) of Terraform has provided a simple mechanism for deploying configuration files to Alibaba Cloud and versioning these files.
EDAS has also integrated the currently popular Infrastructure as Code (IaC) concept and embraces the Terraform ecosystem. It has provided an official plug-in for users to orchestrate applications to corresponding underlying IaaS and other PaaS resources in an IaC manner.
Deployment with CLI
Senior O&M staff may prefer using CLI. In addition to their usage habits, another reason is that CLI is well-scripted and can obtain more capabilities when it is integrated with other script languages.
The CLI in EDAS is built based on the Alibaba Cloud CLI using the POP API as the command and using the API parameters as the command-line parameters. In other words, using the CLI is essentially converted to POP API calls. For more information, see Use CLI to deploy EDAS applications in the official documentation of EDAS.
Summary and What to Do Next
The deployment tools in EDAS are mostly built for developers, O&M staff, and DevOps scenarios. Generally, to trigger a deployment, you only need to submit a task. However, we are more concerned with the task result and its impact on your business. Each time you trigger a task, you make a change to the online environment, which may bring about failures and corresponding interruptions in business. According to Alibaba Group’s experience, a large percentage of the online failures were caused by such changes. Therefore, at the end of 2018, we put forward three principles for online changes, which are the capabilities for canary release, rollback, and monitoring. We gradually apply such capabilities in EDAS. The following articles will focus on online changes. Next, we will look at Capability for canary release.