In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
The main content of this article is to explain "what is the method of SpringCloud application on Kubernetes". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what is the method of SpringCloud application on Kubernetes"?
From the perspective of the deployment change level of the application, it can be divided into the following three layers:
Therefore, it corresponds to the following rollback scenario:
Rolling back the configuration in the application is suitable for problems caused by application configuration changes. If the application can load the configuration dynamically, the business recovery can be achieved by rolling back the configuration, otherwise the application needs to be restarted.
Roll back the version of the application code, which applies to problems caused by code modifications. At this point, you need to roll back the version of the code (image) and restart the application.
Roll back the workload and operation configuration of the application (infrastructure layer).
Intra-application configuration rollback
The configuration in the application is usually related to the needs of the application system or the configuration of business logic, such as the connection information of the configuration database, the configuration of business rules, and so on. Changes in configuration are also easy to cause problems in the online system, which is generally achieved through configmap or properties configuration files. In this case, it is difficult to achieve dynamic push and rollback capabilities, because rollback needs to save different versions of the configuration.
Through distributed configuration management (ACM) (EDAS default support), it is easy to achieve centralized configuration management, rollback and grayscale, distributed push, audit and other functions. You can roll back with one click on the console of ACM or EDAS, as shown in the following figure:
Application code rollback
Deployment is the workload of a commonly deployed application. The rollback code actually corresponds to the image of the rollback version of the code, which is actually the rollback of Deployment. Kubernetes can support Deployment rollback in the following ways.
Deployment rollback
Under a standard Kubernetes system, if a new version of pod does not work properly, you need to roll back the deployment to the historical version. Kubernetes provides native support. The principle is that by default, Kubernetes keeps the history record in the system and rolls back using the rollout command directly, as follows:
Roll back to the previous version
Kubectl rollout undo deployment.v1.apps/ {deployment.name}
Rollback to the specified version: you can view the historical version through kubectl rollout history
Kubectl rollout history deployment.v1.apps/ {deployment.name}
You can roll back to the specified version with the following command
Kubectl rollout undo deployment.v1.apps/ {deployment.name}-- apply rollback in to-revision= {version} EDAS
In EDAS, we combine the native capabilities to create a richer white screen experience. We describe the two scenarios during and after the release respectively.
Rollback during release
Rollback during release means that a problem is found during the release of the application, and the application needs to be rolled back to the previous version. The operation at this point is to interrupt the release process and roll back the server that has been upgraded or is in the process of upgrading to the previous version.
EDAS can directly interrupt the release process and roll back with one click each time it changes. As shown in the following figure:
In addition, EDAS release system provides single batch, batch, canary grayscale and other release forms. When releasing in batches and canary grayscale, EDAS also provides different batches of monitoring information, such as system indicators, application indicators, application anomaly detection and other capabilities, providing the ability to quickly find problems. If there is a problem, it can be rolled back immediately. As shown in the following figure:
Our recommended approach is to maximize the use of batches and canaries during the release process to minimize unavailability caused by the release.
Rollback after publishing
Post-release rollback refers to a deployment process that has been completed, including deployment success or failure. At this point, rollback can be achieved by deploying a version of the history. EDAS stores up to ten deployed versions by default, as shown in the following figure:
Through the above features, you can basically cover the scenarios where the application needs to be rolled back during the launch process. Reduce the impact on the use of system functions due to problems released by the system.
Apply automatic rollback
From the above introduction, you can see that the rollback operation is carried out manually. In fact, in some scenarios, you can find problems quickly according to some monitoring metrics, such as CPU,load, memory and other dimensions, and then you can automatically roll back and restore the system more quickly. In Kubernetes's architecture, Flagger is a good tool for automatic rollback.
Application workload and operation and maintenance configuration rollback
The above describes how to configure the application and how to roll back the application code. Among the common changes, there are also changes in workload and OPS configuration, such as changing the type of workload, changing JVM parameters, log configuration, auto scaling and so on. JVM parameters can usually be rolled back with Deployment, but it is difficult to roll back infrastructure and OPS-related capabilities such as Kubernetes service, logs, auto scaling rules and so on. Need to configure the application code, workload, operation and maintenance configuration to achieve the ability to roll back.
Here we recommend the OAM (Open Application Model) specification proposed by Alibaba and Microsoft, which defines a unified delivery model for applications.
In OAM, an application contains the following core concepts:
Component: refers to the components in the application, which can be the services that the application depends on, such as MySQL database, or the application itself, such as the service provider of Spring cloud. You can write a component through the definition specification of Component
Trait: refers to the operation and maintenance characteristics of an application. It describes the operation and maintenance characteristics of an application deployed in a specific environment, such as elastic scaling rules and Ingress configuration. These operation and maintenance characteristics will be applied to specific components.
Applicationconfiguration: is the definition of assembling Components and traits into a real running application. This configuration file is a declarative API in the OAM specification, through which you can instantiate the corresponding, actual running application.
An example of an application of OAM is as follows:
ApiVersion: core.oam.dev/v1alpha2kind: ApplicationConfigurationmetadata: name: springcloud-provider-deployment annotations: version: v1.0.0 description: "Description of this deployment" spec: components:-componentName: springcloud-provider-component parameterValues:-name: PARAMETER_NAME value: SUPPLIED_VALUE-name: ANOTHER_PARAMETER value: "AnotherValue" traits:-name: manualscaler.core.oam.dev Version: v1 spec: replicaCount: 3 scopes:-scopeRef: apiVersion: core.oam.dev/v1alpha2 kind: NetworkScope name: example-vpc-network
Through the ApplicationConfiguration configuration of OAM, you can describe the real applications running online, and combined with systems that can version the configuration, such as Git,ACM, etc., using the corresponding version of ApplicationConfiguration, you can realize one-click rollback of the application. In EDAS, Kubernetes applications are managed by OAM specification. Combined with OAM declarative API, a variety of application rollback scenarios will be implemented in EDAS to protect online business.
At this point, I believe you have a deeper understanding of "what is the method of SpringCloud application on Kubernetes". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.