×
Community Blog Application Distribution Capability by ACK One: Efficient Multi-cluster Application Management

Application Distribution Capability by ACK One: Efficient Multi-cluster Application Management

The application distribution capability is launched by ACK One. This article primarily introduces the use cases for the new capability.

By Zeyu Zhao

Multi-cluster Application Resource Distribution Overview

In modern application delivery environments, enterprises increasingly rely on multi-cluster architectures to enhance the elasticity, fault tolerance, and scalability of application deployment. However, distributing and managing application resources across multiple clusters is complex and time-consuming, posing significant challenges for businesses. To solve this problem, ACK One officially launched the industry-leading multi-cluster application resource distribution capability. This feature allows you to quickly distribute application resources from a single cluster as the deployment source to multiple target clusters without relying on Git. This greatly simplifies the workload of O&M personnel while ensuring application consistency across multiple clusters. This new feature also supports the smooth migration of application deployment from a single cluster to multiple clusters, improving the disaster recovery capability and high availability of applications.

ACK One Multi-cluster Application Resource Distribution

ACK One allows you to efficiently distribute application resources across multiple clusters. You only need to create application resources and corresponding distribution policies in the fleet cluster to easily deploy applications to the specified target cluster. In addition, this feature supports continuous synchronization. Any modification of application resources in a fleet cluster is automatically synchronized to the associated cluster. This ensures consistency in the multi-cluster environment.

Multi-cluster application resource distribution relies on the newly introduced CRDs (Custom Resource Definitions): Propagation Policy (ClusterPropagationPolicy and PropagationPolicy) and Override Policy (ClusterOverridePolicy and OverridePolicy). The propagation policy specifies that the selected application resources are distributed to the selected cluster, while the override policy defines that the selected resources of a specific cluster require differentiated deployment.

Both policies use 5-tuples (apiVersion, kind, namespace, name, and labelSelector) to select application resources and 3-tuples (labelSelector, fieldSelector, and clusterIds) to select the target cluster.

The following figure shows the multi-cluster application resource distribution capability of ACK One:

1

The following example shows how to distribute the application resources of a fleet cluster to multiple specified associated clusters.

1.  The administrator or developer creates an application resource, which is a simple deployment resource.

apiVersion: apps/v1
kind: Deployment
metadata:
  namespace: demo
  name: nginx
spec:
  replicas: 3
selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx
        ports:
        - containerPort: 80

2.  The administrator or developer creates a propagation policy, selects the preceding nginx deployment application, and selects three distribution clusters.

apiVersion: one.alibabacloud.com/v1alpha1
kind: ClutserPropagationPolicy
metadata:
  name: example
spec:
  resourceSelectors:
  - apiVersion: apps/v1
    kind: Deployment
    namespace: demo
    name: nginx
  placement:
    clusterAffinity:
      clusterIds:
      - ${cluster1-id} # The ID of your cluster
      - ${cluster2-id} # The ID of your cluster
      - ${cluster2-id} # The ID of your cluster

3.  (Optional) If you require differentiated deployment across clusters, you can create override policies for fine-grained control. For example, the following sample adjusts the number of replicas for application resources in cluster1 to 1 and adds a registry to the image. The plaintext option allows modification of any field, primarily through JSON Patch 3-tuples (operator, path, and value). The imageOverrider option allows modification of the application resource's image. It has the following three parameters:

a. component: A complete image typically consists of registry, repo, and tag, and you can specify one of them.

b. operator: This indicates the action for modification, with options of add, remove, or replace.

c. value: This represents the value to be added or replaced if the operator is set to add or replace.

apiVersion: one.alibabacloud.com/v1alpha1
kind: OverridePolicy
metadata:
  name: example
  namespace: demo
spec:
  resourceSelectors:
    - apiVersion: apps/v1
      kind: Deployment
      name: nginx
  overrideRules:
    - targetCluster:
        clusterNames:
          - ${cluster1-id}
      overriders:
        imageOverrider:
          - component: Registry
            operator: add
            value: registry.cn-hangzhou.aliyuncs.com
        plaintext:
          - operator: replace
            path: /spec/replicas
            value: 1

4.  The ACK One multi-cluster application resource distribution component monitors the creation, modification, and deletion events of application resources, propagation policies, and override policies. Once it detects new configurations, it will continuously update the applications in the target clusters.

Through the preceding steps, the deployment application resources can be distributed to multiple associated clusters. In the fleet management of ACK One, application resources maintain their original namespaces during the distribution process. For example, if a deployment resource is located in the namespaceA of the fleet cluster, it will remain there after being distributed to the target clusters. ACK One Fleet supports labels to select cluster and application resources, and supports static weight scheduling for workloads with multiple replicas.

Single Cluster to Multiple Clusters: High-availability Application Deployment

When an application is deployed in a single cluster, it is usually deployed in a single region. If that region experiences issues such as network disconnection, data center power outages, or other catastrophic events, the entire application will be affected, resulting in service interruption. By migrating applications to a multi-cluster architecture, we can deploy applications to different regions or zones to improve disaster recovery and high availability of the system. Even if a region fails, clusters in other regions can continue to provide services. This ensures the continuous availability of applications and significantly improves the disaster recovery capability of the system.

The multi-cluster application resource distribution capability of ACK One enables users to smoothly migrate existing single-cluster applications to the multi-cluster architecture, seamlessly integrating with their current systems. This allows users to quickly deploy and manage applications uniformly across multiple clusters.

2

As shown in the preceding figure, if the customer's current application release system runs in single-cluster mode and the customer relies on this system to continuously deploy and update applications, then achieving high availability deployment only requires the following steps:

1.  First, create a fleet cluster and add the existing single cluster as an associated cluster.

2.  Create a propagation policy for the single cluster in the fleet cluster. This policy can select the required application resources by using resourceSelectors and specify the current single cluster. An example is provided below:

apiVersion: one.alibabacloud.com/v1alpha1
kind: ClutserPropagationPolicy
metadata:
  name: example
spec:
  resourceSelectors:
  - apiVersion: apps/v1
    kind: xxx
    namespace: xxx
    name: xxx
  // ...
  placement:
    clusterAffinity:
      clusterIds:
      - ${cluster-id} # The ID of your single cluster

3.  The release system publishes the existing application resources to the fleet cluster. Since the fleet cluster is a standard Kubernetes cluster, it can seamlessly integrate with the existing release system. All subsequent changes and releases will be completed in the fleet cluster, without affecting the operation of the current single cluster application.

4.  Modify the above propagation policy to include the target cluster. The fleet will then deploy these application resources to the newly added target cluster as well.

apiVersion: one.alibabacloud.com/v1alpha1
kind: ClutserPropagationPolicy
metadata:
  name: example
spec:
  resourceSelectors:
  - apiVersion: apps/v1
    kind: xxx
    namespace: xxx
    name: xxx
  // ...
  placement:
    clusterAffinity:
      clusterIds:
      - ${cluster-id} # The ID of your single cluster
      - ${cluster-new-id} # The ID of your target cluster

With these steps, the application running in a single cluster can be deployed with high availability across multiple clusters. The fleet cluster can seamlessly integrate with your existing release system and distribute application resources to multiple associated clusters according to the distribution rules, ensuring the continuity and high availability of the application services.

0 1 0
Share on

Alibaba Container Service

177 posts | 31 followers

You may also like

Comments

Alibaba Container Service

177 posts | 31 followers

Related Products