基于上篇文章继续,如果你使用的是阿里云等云平台,通过配置nginx+keepAlived行不通,因为阿里云服务器不支持你虚拟出ip提供给外部访问,需要使用阿里云的负载均衡产品

对应的产品有三个系列

1、应用场景
ALB: 主要是对应应用层的7层负载, 如果你的系统是单纯的WEB应用,选这个就可以
NLB: 主要面向网络四层的负载均衡,如果是物联网类的应用,用NLB, 如果你的业务需要都需要,那可以结合ALB和NLB一起使用
CLB: 传统的支持应用7层和网络四层的负载均衡,不支持K8S自动伸缩能力,如果你的业务不大,且同时需要支持WEB和网络四层,用这个就可以
2、实践
1)新建负载均衡示例
健康检查这里很关键,要保证健康检查状态正常,否则无法调用后台的nginx服务器
2)监听配置,点击实例连接

如果web是https的,主要下面监听端口要写成443

健康检查


配置后端服务器的时候,要建一个服务器组,将nginx服务器加到里面即可,后端接口直接配置80即可,后端的nginx也配置成80端口监听即可,有任何问题,可以留言在评论区!