前面的文章中已经讲了怎么通过gitlab+rancher实现devops自动化部署,今天继续讲怎么在rancher里配置负载均衡,实现外部的访问
打开rancher中部署的服务

image.png
能够看到这个服务目前有3个pod副本,分别运行在三台不同的服务器中
然后点击负载均衡

image.png
点击添加规则

image.png
域名选择自定义域名,填上域名,目标后端选择服务,服务/工作负载里选择****-nodeport,容器端口选择80tcp01就是在负载里配置的端口映射
如果域名有证书的话,在下面的SSL/TLS证书处添加证书就可以,如果没有的话,为了防止http访问被默认跳转到https需要在标签/注释里面增加配置

image.png
nginx.ingress.kubernetes.io/ssl-redirect=false
去浏览器里访问以下刚才配置的域名吧
作者:嘿嘿逗
链接:https://www.jianshu.com/p/a103ac417b22
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。