By Gu Jing (Zibai)
Containerized application deployment can reduce enterprise costs, improve R&D efficiency, and free up O&M personnel. According to Gartner, the world's leading research and advisory company, 75% of enterprises will run containerized applications in production by 2022. Kubernetes is the first choice in this field. However, due to the complexity of its deployment and O&M, more customers choose to migrate their business from Elastic Compute Service (ECS) or self-built Kubernetes to Alibaba Cloud Managed Kubernetes (ACK). Thus, ensuring smooth business traffic migration becomes a major challenge.
Cloud Controller Manager (CCM) is a core component of ACK, which connects Kubernetes to other basic services, such as CLB, VPC, and DNS. When the service is set to Type = LoadBalancer
, CCM creates or configures a CLB instance for the service. When the Endpoint or cluster nodes corresponding to the service are changed, CCM updates the backend VServer groups of the CLB instance automatically. In addition, CCM provides a number of annotations to implement various load balancing capabilities.
Recently, CCM released a new feature. It adds support for mounting nodes in the cluster and ECS outside the cluster to the backend of the same CLB instance. This facilitates smooth migration during business containerization.
For a CLB cluster, traffic can be forwarded to the internal and external nodes of the cluster.
Set "service.beta.kubernetes.io/alicloud-loadbalancer-force-override-listeners" to "false" to turn off the information listening
CCM will create a corresponding VServer group automatically.
cat <<EOF |kubectl apply -f -
apiVersion: v1
kind: Service
metadata:
annotations:
service.beta.kubernetes.io/alibaba-cloud-loadbalancer-id: "lb-xxxx"
service.beta.kubernetes.io/alicloud-loadbalancer-force-override-listeners: "false"
labels:
app: nginx
name: my-nginx-svc
namespace: default
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx
type: LoadBalancer
EOF
When the configuration is set, the nodes in the cluster and the ECS instances outside the cluster are available on the VServer page of CLB. The ECS nodes outside the cluster will not be affected by the expansion or shrinking of the applications in the cluster.
Canary release is supported to forward traffic to nodes within and outside the cluster in proportion.
During the migration, traffic needs to be migrated from existing ECS instances to Kubernetes clusters step by step. CCM allows weight settings for Kubernetes clusters using "annotationservice.beta.kubernetes.io/alicloud-loadbalancer-weight" to implement traffic migration step by step.
apiVersion: v1
kind: Service
metadata:
annotations:
service.beta.kubernetes.io/alicloud-loadbalancer-id: "lb-xxxxx"
service.beta.kubernetes.io/alicloud-loadbalancer-vgroup-ids: "80:rsp-xxx"
# The internal weight of the cluster is 20%
service.beta.kubernetes.io/alicloud-loadbalancer-weight: "20"
name: nginx-svc
namespace: default
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx
sessionAffinity: None
type: LoadBalancer
When the configuration is set, the nodes in the cluster and the ECS instances outside the cluster are available on the VServer page of CLB. The weights of the nodes in the cluster are configured according to the annotations. The ECS nodes outside the cluster will not be affected by the expansion or shrinking of the applications in the cluster.
Forwarding traffic of one CLB instance among multiple Kubernetes clusters is supported.
Enterprises will take multiple measures to ensure the high availability of their applications, for example, creating multiple clusters for data backup and disaster recovery. In this scenario, business traffic can be connected to multiple Kubernetes clusters through one CLB, and different weights can be set for the Kubernetes clusters, as shown in the following figure:
apiVersion: v1
kind: Service
metadata:
annotations:
service.beta.kubernetes.io/alicloud-loadbalancer-id: "lb-xxxxx"
service.beta.kubernetes.io/alicloud-loadbalancer-vgroup-ids: "80:rsp-xxx"
service.beta.kubernetes.io/alicloud-loadbalancer-weight: "20"
name: service-A
namespace: default
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx
sessionAffinity: None
type: LoadBalancer
When the configuration is set, the nodes in Cluster A and Cluster B are available in the CLB VServer group. The weights of the nodes in the cluster are configured according to the annotations. The CLB backend VServer will update automatically on the expansion or shrinking of the applications in the cluster.
More enterprises deploy applications in a containerized manner to reduce costs and improve efficiency. During business migration, ensuring normal business traffic poses a great challenge. For e-commerce applications, the decline in business traffic often results in a decline in the transaction volume, bringing major losses. Gaming applications are also very sensitive to business traffic; the user experience will be affected significantly by any short-term traffic interruptions. The business traffic decline in traffic applications will affect traffic flow control and the efficiency of traffic failure troubleshooting. Therefore, preventing the loss of business traffic still remains the bottom line for a normal user operation.
CCM's released support for attaching internal and external ECS instances to the same CLB instance resolves the traffic interruption during migration. It also supports forwarding business traffic to nodes in multiple Kubernetes clusters to meet requirements, such as backup and disaster recovery, ensuring high availability.
RocketMQ-Spring: The Most Popular Messaging Implementation in the Spring Ecosystem
OpenYurt: The Practice of Extending Native Kubernetes to the Edge
506 posts | 48 followers
FollowAlipay Technology - May 14, 2020
Alibaba Cloud Native Community - November 15, 2023
Alibaba Container Service - April 28, 2020
Alibaba Cloud Native - April 10, 2023
Alibaba Cloud Native - February 15, 2023
Alibaba Developer - January 20, 2022
506 posts | 48 followers
FollowSecure and easy solutions for moving you workloads to the cloud
Learn MoreProvides a control plane to allow users to manage Kubernetes clusters that run based on different infrastructure resources
Learn MoreMigrating to fully managed cloud databases brings a host of benefits including scalability, reliability, and cost efficiency.
Learn MoreAlibaba Cloud offers Independent Software Vendors (ISVs) the optimal cloud migration solutions to ready your cloud business with the shortest path.
Learn MoreMore Posts by Alibaba Cloud Native Community