1.前言
部署高可靠性ingress controller,使用多副本部署的方式解决单点故障问题,同时,采用一个Ingress服务独占一个Ingress节点的方式,由多个独占Ingress实例组成统一接入层来承载集群入口流量,同时可依据后端业务流量水平扩缩容Ingress节点,避免业务应用与Ingress服务发生资源抢占。架构如下
部署步骤:
- 创建ingress专用节点池
- 部署ingress controler
- 配置ingress controler到指定节点池
2. 创建ingress专用节点池
集群-节点管理-节点池-创建节点池
实例规格按需要选择,这里要注意的是配置污点和节点标签
参考标签:
# 标签自定义,这里仅作参考
auto-scaling-pools-id: c6-ingress
初始节点设置2个(仅参考)
配置完成后查看节点状态
kubectl get node
NAME STATUS ROLES AGE VERSION
cn-shenzhen.192.168.1.123 Ready <none> 2d20h v1.22.10-aliyun.1
cn-shenzhen.192.168.1.124 Ready <none> 2d20h v1.22.10-aliyun.1
# 查看污点是否生效
kubectl describe node cn-shenzhen.192.168.1.123 |grep Taints
Taints: auto-scaling-pools-id=c6e-ingress:NoSchedule
3. 部署ingress controler
集群-运维管理-组件管理-Nginx Ingress Controller-安装
4. 配置ingress controler到指定节点池
集群-运维管理-组件管理-Nginx Ingress Controller-配置
增加NodeSelector额外节点选择标签
Key: auto-scaling-pools-id
Value: c6e-ingress
增加Tolerations容忍度
Effect: NoSchedule
Key: auto-scaling-pools-id
Operator: Equal
Value: c6e-ingress
配置如下
点击确定后等待操作执行完成即可
# 查看ingress配置
$ kubectl get deployment nginx-ingress-controller -n kube-system -o yaml
# 增加nodeSector和toplerations,配置如下
nodeSelector:
auto-scaling-pools-id: c6e-ingress
kubernetes.io/os: linux
... ...
tolerations:
- effect: NoSchedule
key: auto-scaling-pools-id
operator: Equal
value: c6e-ingress
至此,高可靠ingress controller部署配置完毕
5. 总结
阿里云WEB控制台配置ingress时存在BUG,通过ACK控制台-运维管理-组件管理-Nginx Ingress Controller-配置,增加Nginx Ingress Controller和Tolerations容忍度存在bug,vaule值存在如"true"或"yest"时,将无法完成配置更新,如标签为:
node-role.kubernetes.io/ingress="true"
ingress-pod="yes"
这种配置均无法完成配置更新,报错如下
但手动修改配置可正常修改完成调度
#pacth.yaml
spec:
template:
spec:
nodeSelector:
node-role.kubernetes.io/ingress: "true"
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/ingres
operator: Equal
value: "true"
# 手动修改ingress配置
kubectl patch deployment nginx-ingress-controller -n kube-system --patch-file patch-ingress.yaml
deployment.apps/nginx-ingress-controller patched
通过以上操作也可完成和组件管理配置一样的功能,但是不建议手动操作,因为组件升级时会把配置覆盖或其它配置冲突。因此,在配置标签和污点时,不要使用带 "yes" 或 "true" 值的标签