How do Service Applications Use Load Balance
In the process of service application, there may be high concurrency scenarios. Through the traffic balance and distribution feature of Baidu Load Balance (BLB), it can provide multiple WebServer concurrent services for the application, so as to achieve the effect of service level expansion.
At present, there are two ways to create service applications: one is to create service applications through kubectl; the other is to create service service applications through Kubernetes Dashboard. Therefore, there are two ways to create and use load balance:
Kubectl Uses Load Balance in Deploying Service Applications
Create Load Balance and Elastic IP
In the public cloud environment, you can create a service of LoadBalancer type by entering the command. At the same time, you can also link with the public cloud to create a load balance and a public IP. The specific operation instructions are as follows:
kubectl expose deployment my-nginx --port=80 --type=LoadBalancer
View Load Balance and Elastic IP
By viewing the command of the service, you can see the status of the service and the created public IP.
$ kubectl get services
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes 172.17.0.1 <none> 443/TCP 1h
my-nginx 172.17.44.5 180.76.139.247 80:30356/TCP 47s
Through the link 180.76.139.247, you can see the created service as shown in the figure:
Note: The symbol "$" represents the input instruction, and other lines represent the service information displayed after the input instruction, among which 180.76.139.247 is the service website published to the Internet.
Use Load Balance in Deploying service Applications through Kubernetes Dashboard
Create Load Balance and Elastic IP
Select External in the Service to complete EIP and BLB configuration, and then 80 80 will be filled in the pop-up port page, and then click DEPLOY to start service creation;
View Load Balance and Elastic IP
Click Services on the creation success page to enter the services page;
View Load Balance and Elastic IP in Baidu AI Cloud Console
After service creation, users can log in to Baidu AI Cloud platform, select "Product Services > Load Balance" and enter the BLB console to view the details of load balance. For specific operation steps, please see Baidu Load Balance Operation Guide
Select "Product Services > Elastic IP" to enter the instance list of the console, where you can view the public IP information of node (instance)