- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
使用Gloo TCP代理转发端口27017以在Kubernetes集群中进行MongoDB访问。
以下网关规范适用于将所有端口27017流量转发到指定的上游。
spec:
bindAddress: '::'
bindPort: 27017
tcpGateway:
tcpHosts:
- destination:
single:
upstream:
name: default-mongodb-27017
namespace: gloo-system
name: one
useProxyProto: false
我想根据主机名转发27017流量(例如,
d.db.example.com
指向Mongo的dev实例,
p.db.example.com
指向prod实例)。
最佳答案
正如我在评论中提到的那样,据我所知,在网关中这样做并不是不可能的,至少我在网关documentation中找不到关于此的任何内容,但是您可以配置virtual services使其起作用。
如文档there所述
The VirtualService is the root Routing object for the Gloo Gateway. A virtual service describes the set of routes to match for a set of domains.
It defines: - a set of domains - the root set of routes for those domains - an optional SSL configuration for server TLS Termination - VirtualHostOptions that will apply configuration to all routes that live on the VirtualService.
Domains must be unique across all virtual services within a gateway (i.e. no overlap between sets).
Virtual Services define a set of route rules, an optional SNI configuration for a given domain or set of domains.
Gloo will select the appropriate virtual service (set of routes) based on the domain specified in a request’s Host header (in HTTP 1.1) or :authority header (HTTP 2.0).
Virtual Services support wildcard domains (starting with *).
Gloo will create a default virtual service for the user if the user does not provide one. The default virtual service matches the * domain, which will serve routes for any request that does not include a Host/:authority header, or a request that requests a domain that does not match another virtual service.
The each domain specified for a virtualservice must be unique across the set of all virtual services provided to Gloo.
d.db.example.com
和
p.db.example.com
Option 2: Separating ownership across domains
The first alternative we might consider is to model each service with different domains, so that the routes are managed on different objects. For example, if our primary domain was example.com, we could have a virtual service for each subdomain: echo.example.com and foxtrot.example.com.
apiVersion: gateway.solo.io/v1
kind: VirtualService
metadata:
name: echo
namespace: echo
spec:
virtualHost:
domains:
- 'echo.example.com'
routes:
- matchers:
- prefix: /echo
---
apiVersion: gateway.solo.io/v1
kind: VirtualService
metadata:
name: foxtrot
namespace: foxtrot
spec:
virtualHost:
domains:
- 'foxtrot.example.com'
...
我希望这有帮助。
关于kubernetes - Gloo TCP代理(按主机名),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62777217/
使用Gloo TCP代理转发端口27017以在Kubernetes集群中进行MongoDB访问。 以下网关规范适用于将所有端口27017流量转发到指定的上游。 spec: bindAddress:
Gloo 文档位于 https://gloo.solo.io/advanced_configuration/tls_setup/完成为 Gloo 虚拟服务设置 SSL 的过程。但是,它仅使用自签名证书
我是一名优秀的程序员,十分优秀!