一、资源规划
使用物理机作为master节点,打通与各节点网络策略后,各产品组将组内服务器按统一文档安装好基础组价后加入到K8s集群中;根据产品名创建namespace,并将node节点打上label标签并与指定namespace进行绑定,最终实现一款产品只在该产品组的服务器上进行部署。
K8s集群划分
关键操作:
##查看node标签
kubectl get node node01 --show-labels
##打标签
kubectl label node node01 type=product1
##添加namespace的node-selector参数与指定label绑定
kubectl edit ns namespacexx
···
apiVersion: v1
kind: Namespace
metadata:
name: namespacexx
annotations: # 增加
scheduler.alpha.kubernetes.io/node-selector: type=product1 # 增加
spec: {}
status: {}
二、ingress及istio使用
ingresscontroller和istio为公共组件,分别分配不同的nodeport端口供所有服务使用,为便于不同产品使用,各产品需使用域名访问。
针对部署时,使用ingress时只需要在基础资源文件外在各自namespace下部署ingress服务并绑定业务service;
使用istio部署时需要创建gateway和对应的virtual sservice
作者:赵心域
来源:移动云官网开发者社区