当前位置:网站首页>传统微服务框架如何无缝过渡到服务网格 ASM
传统微服务框架如何无缝过渡到服务网格 ASM
2022-06-30 00:15:00 【InfoQ】
背景

- SpringCloud
- Dubbo
- ServiceMesh (新生代)
传统微服务迁移到服务网格的一些已知问题和场景
常见的几个问题
- 服务容器化后,服务 deployment 滚动更新,服务实例的 IP 是经常变化的,对应服务实例IP 同步到注册中心会有延迟,这个过程会导致部分业务请求出现 503。
- Istio 社区版本对非 HTTP 、gRPC 的其他 rpc 协议支持有限,无法提供统一形态的路由管理,以及相关治理能力。
- 因 Istio 本身设计的服务路由模型依赖服务间请求为 ServiceName 或 ClusterIp ,SpringCloud 服务没有办法直接 Mesh 化,Dubbo 服务因基于 interface 的服务调用设计,interace 在 Dubbo 协议请求的上下文有传递,虽然不受该模式的限制,但 Istio 社区版本对 Dubbo 路由的支持却没有对应的 RDS 支持,无法直接采用社区版本的 VirtualService 配置 Dubbo 路由。
场景 1:容器集群内外服务如何互通
- 部分业务容器化,迁移到 Kubernetes 集群
- 仍旧有一些遗留服务需要在 ECS 云主机在部署

场景 2:多语言业务互通

管理 SpringCloud 服务

方案 1:采用 EnvoyFilter + Lua 方式
方案 2:通过 Reverse DNS Filter 反向查找得出 ServiceName

管理 Dubbo 服务

支持 Dubbo + Nacos 服务迁移到 ASM

- 托管 Dubbo 服务
- 管理 Dubbo 服务流量
- Dubbo 服务的虚拟服务参数说明
- 集成自建 Prometheus 实现 Dubbo服务可观测性
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: demoservice0
spec:
hosts:
- providers:com.alibaba.edas.DemoService0
dubbo:
- routes:
- match:
- method:
nameMatch:
exact: "sayHello"
argc: 1
args:
- index: 1
strValue:
patterns:
- exact: "jack"
type: java.lang.String
route:
- destination:
subset: v1
weight: 100
- match:
- method:
nameMatch:
exact: "sayHello"
argc: 1
args:
- index: 1
strValue:
patterns:
- exact: "lily"
type: java.lang.String
headers:
app:
patterns:
- exact: "consumer1"
route:
- destination:
subset: v2
weight: 100
services:
- prefix: providers:com.alibaba.edas.DemoService0
支持 Dubbo + ZooKeeper

helm install -f values.yaml mcp-bridge .

apiVersion: istio.aliyun.cloud.com/v1
kind: McpBridge
metadata:
name: default
namespace: istio-system
spec:
registries:
- domain: mse-7e74ff00-zk.mse.aliyuncs.com ### zookeeper 地址
name: zookeeper
port: 2181
type: zookeeper
[email protected]:~/test/mcpbridge/dubbo-zk-demo# tree .
.
├── dubbo-services.yaml ## dubbo + zk注册中心测试服务例子
├── zk-mcpbridge.yaml ## mcpbridge zk 配置,需要对应修改zk地址
└── zk-registry-service-alias.yaml ## zk地址的服务别名,需要对应修改zk地址
kubectl create ns dubbo
kubectl label ns dubbo istio-injection=enabled
kubectl apply -f .
[email protected]:~/test/mcpbridge# kubectl get pods -n dubbo
NAME READY STATUS RESTARTS AGE
dubbo-consumer-zk-5cd8f6c6bf-bscd2 2/2 Running 0 83m
dubbo-provider-zk-v1-54cd888957-k7bg4 2/2 Running 0 83m
dubbo-provider-zk-v2-cf58ccc79-sg94l 2/2 Running 0 83m



- 创建一个网关规则(istio 下的 gateway CRD), 声明一个逻辑网关,以及这个逻辑网关(test-gateway) 绑定的具体域名和声明端口以及协议类型
- 配置网关路由,将 /sayHello 请求转发给 dubbo-consumer-zk.dubbo.svc.cluster.local 目标服务
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: test-gateway
spec:
selector:
istio: ingressgateway
servers:
- port:
number: 80
name: http
protocol: HTTP
hosts:
- "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
name: consumerhttp
spec:
hosts:
- "*"
gateways:
- test-gateway
http:
- match:
- uri:
prefix: /sayHello
route:
- destination:
host: dubbo-consumer-zk.dubbo.svc.cluster.local ##对应consumer服务的k8s service name
port:
number: 17080
#export INGRESS_GATEWAY_IP=YOUR_GATEWAY_IP
#curl http://$INGRESS_GATEWAY_IP/sayHello/world
V2 Gray1: hello world - 172.22.32.143:20880
#curl http://$INGRESS_GATEWAY_IP/sayHello/world
V1 Gray1: hello world - 172.22.32.39:20880
总结

边栏推荐
- SSH key disclosure (module B competition topic) -- Application Service Vulnerability scanning and utilization
- [advanced C language] file operation (II)
- Cacti maximum monitoring number test
- DOM 知识点总结
- Golang6 reflection
- Solr基础操作9
- Solr基础操作6
- Solr basic operations 12
- 项目一:部署 LAMP ecshop电商平台
- The role of VMware virtual machine
猜你喜欢

QT learning 02 GUI program example analysis

Code analysis platform sonarqube actual combat

About mongodb error: connecting to: mongodb://127.0.0.1:27017/?compressors=disabled &gssapiServiceName=mongodb
![Copy linked list with random pointer [space for time --hash record]](/img/d9/d81e0e4f81174c61275e4affe0777a.png)
Copy linked list with random pointer [space for time --hash record]

QT learning 01 GUI program principle analysis

Project 1: deploy lamp ECSHOP e-commerce platform

Embedded development: Hardware in the loop testing
![[advanced C language] string and memory function (I)](/img/fa/5531253940d99f2646cb6964992e7c.png)
[advanced C language] string and memory function (I)

Events in JS

Leetcode (680) -- verifying palindrome string II
随机推荐
Code analysis platform sonarqube actual combat
[advanced C language] string and memory function (II)
云呐|固定资产系统管理的优势,固定资产管理系统有何特点
There is no web-based development for the reward platform. Which is suitable for native development or mixed development?
Vulnhub target -moriartycorp
Solr basic operations 12
SSH key disclosure (module B competition topic) -- Application Service Vulnerability scanning and utilization
Solr基础操作13
Label Troubleshooting: unable to open the marked image
Analysis of common vlog parameters
Golang6 reflection
Cloud native enthusiast weekly: cool collection of grafana monitoring panels
About mongodb error: connecting to: mongodb://127.0.0.1:27017/?compressors=disabled &gssapiServiceName=mongodb
gyctf_2020_document
[advanced C language] address book implementation
Solr basic operations 7
MySQL:SQL概述及数据库系统介绍 | 黑马程序员
旋转彩色三叶草
What is flush software? Is it safe to open an account online?
Unity splashimage scaling problem