基于K8s的微服务架构搭建完整方案
- 内容介绍
- 文章标签
- 相关推荐
问题描述:
基于K8s的微服务架构搭建完整方案
本次环境构建所有服务器操作系统均为 Ubuntu 22.04 LTS 最小安装版本
1 Nginx + KeepAlived 负载均衡和高可用环境
1.1 服务器列表
| 主机名称 | IP地址 | 配置 | 角色 | VIP |
|---|---|---|---|---|
| nginx-01 | 192.168.2.143 | 2c/8g/200g | master | 192.168.2.170 |
| nginx-02 | 192.168.2.144 | 2c/8g/200g | backup | 192.168.2.170 |
1.2 安装Nginx
sudo apt-get install nginx -y
验证:
sudo nginx -t
# 输出
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
1.3 修改默认配置
将默认的80端口改为81端口,80端口留给负载均衡
sudo vim /etc/nginx/sites-enabled/default
serve
问题描述:
基于K8s的微服务架构搭建完整方案
本次环境构建所有服务器操作系统均为 Ubuntu 22.04 LTS 最小安装版本
1 Nginx + KeepAlived 负载均衡和高可用环境
1.1 服务器列表
| 主机名称 | IP地址 | 配置 | 角色 | VIP |
|---|---|---|---|---|
| nginx-01 | 192.168.2.143 | 2c/8g/200g | master | 192.168.2.170 |
| nginx-02 | 192.168.2.144 | 2c/8g/200g | backup | 192.168.2.170 |
1.2 安装Nginx
sudo apt-get install nginx -y
验证:
sudo nginx -t
# 输出
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
1.3 修改默认配置
将默认的80端口改为81端口,80端口留给负载均衡
sudo vim /etc/nginx/sites-enabled/default
serve

