Fleet Management
Overview
Fleet Management is a feature that helps group Kubernetes clusters across multiple zones/regions , allowing flexible traffic management between clusters. When using Global Load Balancer (GLB) , there are two main traffic distribution mechanisms:
North-South Traffic Management with GLB
How it works : A single GLB will route traffic to clusters by geographic region (eg: HAN, HCM...), helping to optimize performance and reduce costs compared to using multiple individual Load Balancers.
Support for clusters with Network Type:
✅ Calico Overlay ✅ Cilium Overlay ✅ Cilium VPC Native
East-West Traffic Management with MCS
How it works : If a backend service in a cluster fails, traffic will failover to the backends of other clusters in the fleet , ensuring no downtime .
Only supports clusters with Network Type :
✅ Cilium VPC Native
Create fleet
Follow these instructions to create a Fleet and manage traffic distribution with GLB:
Step 1: Log in to VKS Portal at the link: https://vks.console.vngcloud.vn/overview
Step 2: Select Fleet Management
Step 3: Select Create a fleet
Step 4: Enter a memorable name for the fleet in the Fleet Name field . The Fleet name must be between 5 and 50 characters long, including the characters a-z, 0-9, '-'
Step 5: Select the Region containing your Cluster
Step 6: Select the cluster list you want to add to the fleet and select Register .
Step 7: In the list of added Clusters , you need to specify a cluster as host . The remaining Clusters will be members . For example, in the picture, I specify the cluster named demo-fleet-03 as host and the cluster named demo-cluster-04 as member.
Step 8: Select the type of Traffic flow you want, depending on the Network type of the cluster you have selected, the type of Traffic flow you can choose will be displayed accordingly.
Step 9: Select Create
Step 10: Deploy a service on the host cluster. First, you need to download the KubeConfig of the Host Cluster and connect to this host cluster. After downloading the KubeConfig file and updating it to a config file in the directory ~/.kube
, you can check the connection to the cluster with the command:
Next, let's implement a service, which:
With Traffic Flow: East West Traffic Management with Multi Cluster Service : you can create service type LoadBalancer, NodePort or ClusterIP.
With Traffic Flow: North South Traffic Management with GLB : you can create service type LoadBalance or NodePort .
For example below, I create a file nginx.yaml
containing nginx service type LoadBalancer at namespace default
:
Step 11: Create a file glb-nginx.yaml
containing the GLB service using the following sample YAML:
Step 12: Apply GLB configuration using command:
Replace glb-nginx.yaml
with your YAML file name.
At this time, the system will create a new vGLB on the vGLB system, you can check the created vGLB here .
Attention:
A vGLB can only be used for a single Fleet .
However, if you have a vGLB that is not used in any Fleet , you can reuse it by adding annotations to the YAML file when creating the vGLB.
Step 13: Check the status of GLB with the command:
You will see a list of created GLBs along with their status.
For example:
Step 14: Get the IP address or hostname of GLB to access the service using the command:
Step 15: Test Fleet's performance by sending a request to GLB:
Replace <GLB_Endpoint>
with the IP address or hostname obtained from the step above.
For example:
Or access directly as picture:
Check North-South Traffic with GLB
Suppose, you have initialized Fleet with 2 clusters on 2 regions HAN, HCM and selected Flow Traffic as GLB. The general steps to perform the test are as follows:
First, on Host Cluster, you need to deploy glb-nginx.yaml to create GLB via command:
Next, on each Cluster A, B, you create a deploy nginx service but you need to edit the service output to Hello Nginx HAN, Hello Nginx HCM to easily observe how traffic is distributed.
On Cluster A in Region HCM:
Create files
nginx-configmap.yaml
andnginx.yaml
following the pattern, deploy them on cluster A:
On Cluster B in Region HAN:
Create files
nginx-configmap.yaml
andnginx.yaml
following the pattern, deploy them on cluster A:
Finally, on ClusterA, B, do curl to GLB_Domain.
On Cluster A in Region HCM:
The curl result will be as follows:
On Cluster B in Region HAN:
Copy
The curl result will be as follows:
Check East-West Traffic with MCS
Test failover by shutting down the backend service in one cluster and observing how traffic is distributed to another cluster in Fleet:
For example, on a Cluster belonging to Region HAN, I perform scale deployment with the command:
At this time, all traffic will be transferred to the cluster in Region HCM, you can check by curling to GLB Endpoint:
The curl result will be as follows:
After completing the above steps, you have successfully set up Fleet Management on VKS with Global Load Balancer to effectively manage traffic between clusters.
Register and unregister a cluster to the fleet
After creating a Fleet, you can add existing Kubernetes clusters to the Fleet in two ways:
Method 1: In Fleet Management , select Edit Fleet then select a cluster from the available list and click "Register" to add to Fleet.
Method 2: Register the cluster directly to Fleet during the cluster creation process.
If you no longer need a cluster in Fleet, you can Unregister it by:
Step 1: Access the Fleet Management section .
Step 2: Select the cluster to remove.
Step 3: Click "Remove" or "Unregister" (only delete cluster from Fleet, not delete cluster from VKS system).
Changing host clusters within a fleet
Once you create a Fleet, you can edit its configuration:
Change Host Cluster in existing Fleet.
Add or remove cluster members as needed, but always ensure Fleet has at least one cluster host.
Delete a fleet
When you no longer need a Fleet, you can delete it by:
Step 1: Access Fleet Management .
Step 2: Select the Fleet to delete.
Step 3: Click "Delete" and confirm.
Attention:
Each Fleet needs to have at least one host cluster , the remaining clusters will act as member clusters . After the Fleet is created, you can add/remove member clusters or change host clusters .
A cluster cannot register to multiple Fleets at the same time . If you want to change Fleet, you need to Unregister from the old Fleet before adding to the new Fleet.
You cannot delete a cluster if it is a host cluster in a Fleet. If you want to delete a cluster that is a host , you need to transfer the host role to another cluster before deleting it. Without a host cluster, Fleet will not function properly.
If you want to use Private cluster for Fleet, you are required to set up NAT to communicate with GLB because we currently do not support Private Service Endpoint to GLB.
When a Fleet is deleted, the clusters within the Fleet still exist and can be used independently or added to another Fleet.
Last updated