阿里云全链路流量配置

这篇具有很好参考价值的文章主要介绍了阿里云全链路流量配置。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

一、创建istio gateway

  1. 创建ssl证书的secret
  2. 创建*.dev.domain.cn域名的gateway,yaml文件如下
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: gw-dev-msl-cn
namespace: ns-istio-system-sit
spec:
selector:
istio: ingressgateway
servers:
- hosts:
- '*.dev.domain.cn'
port:
name: https
number: 8443
protocol: HTTPS
tls:
credentialName: dev-msl-cn
minProtocolVersion: TLSV1_2
mode: SIMPLE

3、创建*.internal.domain.com域名的gateway,yaml文件如下

apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
name: gw-internal-manulife-sinochem-com
namespace: ns-istio-system-sit
spec:
selector:
istio: ingressgateway
servers:
- hosts:
- '*.internal.domain.com'
port:
name: https
number: 8443
protocol: HTTPS
tls:
credentialName: internal-manulife-sinochem-com
minProtocolVersion: TLSV1_2
mode: SIMPLE
  1. 创建完成后,当前集群仅应有如下两个gateway CRD资源
    阿里云 mse 网关地址,istio,微服务,架构,阿里云,云计算
    二、创建istio gateway的路由
    1、为微服务vs-osi-nb-std-comp创建路由
    此微服务的service名为osi-nb-std-comp
    此微服务的域名为openapi-osi-core.dev.msl.cn
    此微服务的端口为8090
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: vs-osi-nb-std-comp
namespace: ns-nb-application
spec:
gateways:
- ns-istio-system-sit/gw-dev-msl-cn
hosts:
- "*.dev.domain.cn"
http:
- match:
- uri:
prefix: /osi-nb-std-comp
route:
- destination:
host: osi-nb-std-comp
port:
number: 8090

2、创建完成后,查看ingress gateway对应service的负载均衡IP地址,为10.137.9.50
阿里云 mse 网关地址,istio,微服务,架构,阿里云,云计算
3、在一台可访问Istio ingress gateway的Linux客户机上配置/etc/hosts,内容如下:

10.137.9.50 openapi-osi-core.dev.msl.cn

4、在客户机上测试host解析,并访问此微服务的健康检查URL以测试是否正常,返回200即为正常

$ curl https://openapi-osi-core.dev.msl.cn/osi-nb-std-comp/actuator/health -k -v
* About to connect() to openapi-osi-core.dev.msl.cn port 443 (#0)
* Trying 10.137.9.50...
* Connected to openapi-osi-core.dev.msl.cn (10.137.9.50) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=*.dev.msl.cn,OU=IT,O=MSL,L=Shanghai,ST=Shanghai,C=CN
* start date: Sep 21 00:46:51 2020 GMT
* expire date: Sep 20 00:46:51 2025 GMT
* common name: *.dev.msl.cn
* issuer: CN=MSL-CA,DC=msl,DC=cn
> GET /osi-nb-std-comp/actuator/health HTTP/1.1
> User-Agent: curl/7.29.0
> Host: openapi-osi-core.dev.msl.cn
> Accept: */*
>
< HTTP/1.1 200 OK
< set-cookie: SessionId=S-2bd9ed568e594d3584bf9b9656a39c4b; Path=/; Max-Age=2592000; Expires=Tue, 22 Nov 2022 16:35:31 GMT;
HttpOnly
< server: istio-envoy
< content-type: application/vnd.spring-boot.actuator.v3+json
< date: Sun, 23 Oct 2022 16:35:31 GMT
< x-envoy-upstream-service-time: 18
< transfer-encoding: chunked
<
* Connection #0 to host openapi-osi-core.dev.msl.cn left intact

5、以下为挂在internal.domain.com域名下的webapi服务配置示例,后端微服务为osi-nb-std-app

apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: vs-osi-nb-std-app
namespace: ns-nb-application
spec:
gateways:
- ns-istio-system-sit/gw-internal-manulife-sinochem-com
hosts:
- "*.internal.domain.com"
http:
- match:
- uri:
prefix: /osi-nb-std-app
route:
- destination:
host: osi-nb-std-app
port:
number: 8080

三、配置Istio Gateway的健康检查
这个健康检查是为MSE网关实例检测istio gateway是否正确而配置

  1. 使用istio ingress gateway的健康检查url,用于MSE的健康检查,为这个服务创建virtualservice,yaml文件如下,分别为domain.cn和domain.com两个网关创建健康检查VirtualService
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: vs-istio-ingressgateway-healthcheck
namespace: ns-istio-system-sit
spec:
gateways:
- gw-dev-msl-cn
- gw-internal-manulife-sinochem-com
hosts:
- '*'
http:
- match:
- uri:
prefix: /healthz/ready
route:
- destination:
host: istio-ingressgateway
port:
number: 15021

2.创建完成后,查看ingress gateway对应service的负载均衡IP地址,为10.137.9.50

$ kubectl get svc -n ns-istio-system-sit
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)
AGE
istio-ingressgateway LoadBalancer 172.31.0.4 10.137.9.50
15021:32499/TCP,80:31065/TCP,443:30188/TCP,9091:32621/TCP 75d
istiod ClusterIP 172.31.0.199 <none> 15010/TCP,15012/TCP,443/TCP,15014/TCP
76d

3、在一台可访问 Istio ingress gateway的Linux客户机上配置/etc/hosts,内容如下:

10.137.9.50 istio-dit-sh01.dev.domain.cn
10.137.9.50 istio-dit-sh01.internal.domain.com

4、在客户机上测试host解析,并访问健康检查URL以测试是否正常,返回200即为正常文章来源地址https://www.toymoban.com/news/detail-723975.html

$ ping istio-dit-sh01.dev.msl.cn
PING istio-dit-sh01.dev.msl.cn (10.137.9.50) 56(84) bytes of data.
64 bytes from istio-dit-sh01.dev.msl.cn (10.137.9.50): icmp_seq=1 ttl=101 time=1.21 ms
$ ping istio-dit-sh01.internal.domain.com
PING istio-dit-sh01.internal.domain.com (10.137.9.50) 56(84) bytes of data.
64 bytes from istio-dit-sh01.dev.msl.cn (10.137.9.50): icmp_seq=1 ttl=101 time=1.15 ms
## For istio-dit-sh01.dev.domain.cn
$ curl https://istio-dit-sh01.dev.domain.cn/healthz/ready -k -v
* About to connect() to istio-dit-sh01.dev.domain.cn port 443 (#0)
* Trying 10.137.9.50...
* Connected to istio-dit-sh01.dev.domain.cn (10.137.9.50) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=*.dev.msl.cn,OU=IT,O=MSL,L=Shanghai,ST=Shanghai,C=CN
* start date: Sep 21 00:46:51 2020 GMT
* expire date: Sep 20 00:46:51 2025 GMT
* common name: *.dev.msl.cn
* issuer: CN=MSL-CA,DC=msl,DC=cn
> GET /healthz/ready HTTP/1.1
> User-Agent: curl/7.29.0
> Host: istio-dit-sh01.dev.msl.cn
> Accept: */*
>
< HTTP/1.1 200 OK
< date: Sun, 23 Oct 2022 16:07:50 GMT
< content-length: 0
< x-envoy-upstream-service-time: 0
< server: istio-envoy
<
* Connection #0 to host istio-dit-sh01.dev.domain.cn left intact
## For istio-dit-sh01.internal.domain.com
$ curl https://istio-dit-sh01.internal.domain.com/healthz/ready -k -v
* About to connect() to istio-dit-sh01.internal.domain.com port 443 (#0)
* Trying 10.137.9.50...
* Connected to istio-dit-sh01.internal.domain.com (10.137.9.50) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
* subject: CN=*.internal.manulife-sinochem.com,O=有限公司,L=Shanghai,ST=Shanghai,C=CN
* start date: Aug 01 07:36:06 2022 GMT
* expire date: Sep 02 07:36:05 2023 GMT
* common name: *.internal.manulife-sinochem.com
* issuer: CN=GlobalSign RSA OV SSL CA 2018,O=GlobalSign nv-sa,C=BE
> GET /healthz/ready HTTP/1.1
> User-Agent: curl/7.29.0
> Host: istio-dit-sh01.internal.domain.com
> Accept: */*
>
< HTTP/1.1 200 OK
< date: Sun, 23 Oct 2022 17:35:23 GMT
< content-length: 0
< x-envoy-upstream-service-time: 0
< server: istio-envoy
<
* Connection #0 to host istio-dit-sh01.internal.domain.com left intact

到了这里,关于阿里云全链路流量配置的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 通过 MSE 实现基于Apache APISIX的全链路灰度

    微服务体系架构中,服务之间的依赖关系错综复杂,有时某个功能发版依赖多个服务同时升级上线。我们希望可以对这些服务的新版本同时进行小流量灰度验证,这就是微服务架构中特有的全链路灰度场景,通过构建从网关到整个后端服务的环境隔离来对多个不同版本的服务

    2024年01月17日
    浏览(23)
  • Istio 流量管理 serviceEntry 出口流量管理

    无论是vs还是dr这些都是入口的流量。对于pod来说也会有出去的流量的。 除了对进来的流量做有效的控制之外,其实也可以控制出去的流量。istio-egress是出口网关,pod出去的时候要经过egress-gateway到达外界的某个终端。 hosts: - www.baidu.com  这个是pod要访问的服务器。pod里面设置

    2024年02月12日
    浏览(33)
  • 云原生最佳实践系列2:基于 MSE 云原生网关同城多活

    分布在同城多个机房内的应用同时对外提供服务。同城机房物理距离较小,一般小于 50 公里。同城多活架构的难点有三个: 当某机房出现故障,能不能做到机房级的快速切换? 如何实现非对等部署下的全局的流量负载均衡? 对流量的精细化管控? 常见的同城多活实现方式

    2024年04月25日
    浏览(30)
  • Istio实战(九)-Envoy 流量劫持

    Envoy 是一款面向 Service Mesh 的高性能网络代理服务。它与应用程序并行运行,通过以平台无关的方式提供通用功能来抽象网络。当基础架构中的所有服务流量都通过 Envoy 网格时,通过一致的可观测性,很容易地查看问题区域,调整整体性能。 Envoy也是istio的核心组件之一,以

    2024年02月08日
    浏览(34)
  • 配置特定 IP 地址走指定网关

    公司有两个日常上网用的路由器,分别接不同的两条网线,虽然都是电信的,但是一条偶尔会抽风,我的 VPS 会连不上,也就是挂在上面的 SS 无法使用。恰好这根线是公司接台式机的,也就是说平时上班偶尔会无法科学上网。 这对我来说几乎是无法忍的,面对不能科学上网的

    2024年02月02日
    浏览(33)
  • 深入理解 Istio 流量管理的超时时间设置

    部署 httpbin 服务: 部署 sleep 服务: httpbin 服务作为接收请求的服务端, sleep 服务作为发送请求的客户端。 在 sleep 服务中向 httpbin 服务发出请求: 返回结果如下: 可以看到,请求大约在 5 秒返回 200 (OK)。 创建虚拟服务,访问 httpbin 服务时,请求超时设置为 3 秒: 再次访

    2024年02月08日
    浏览(40)
  • 如何理解 Istio Ingress, 它与 API Gateway 有什么区别?东西流量?南北流量?

    这三者都和流量治理密切相关,那么流量治理在过去和现在有什么区别呢?都是如何做的呢? 在学习istio的时候对流量管理加深了理解。什么是东西流量?什么是南北流量? 假如让你说出k8s中的服务暴露的方式? 你可以说几种? 我面试也遇到过这个问题。 东西流量 mesh(No

    2024年02月11日
    浏览(40)
  • Istio网关Gateway 启用TLS

    Istio网关Gateway是一个负责处理南北向流量的组件,它通常会暴露服务网格内部的服务,以便外部的请求能够访问到服务网格中的服务。Istio网关Gateway支持多种协议,包括HTTP、HTTPS和GRPC等。 在Istio网关Gateway中, 每个服务器都包含一个或多个端口,每个端口都定义了一种协议和

    2024年02月15日
    浏览(28)
  • Istio——为微服务构建一个通用的流量控制平面

    作者:禅与计算机程序设计艺术 随着云计算、容器化和微服务架构的普及,越来越多的公司和组织开始采用基于微服务架构的分布式应用开发模式。然而,在真正将这些微服务部署到生产环境后,如何实现对应用的流量管理以及安全防护就成为一个棘手的问题。微服务架构虽

    2024年02月07日
    浏览(43)
  • K8S之istio流量控制管理(十七)

    一,istio介绍 1、istio架构   结合上图我们来理解Istio的各组件的功能及相互之间的协作方式。 1. 自动注入:在创建应用程序时自动注入 Sidecar代理Envoy程序。在 Kubernetes中创建 Pod时,Kube-apiserver调用控制面组件的 Sidecar-Injector服务,自动修改应用程序的描述信息并注入Sidecar。在

    2024年02月09日
    浏览(39)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包