微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在没有服务发现的情况下为网格联合配置 istio?

如何解决如何在没有服务发现的情况下为网格联合配置 istio?

来自 istio documentation 的多信任部署模型

multi trust diagram

我想将多个网格连接在一起。我目前管理着 3 个不同的 AKS 集群

  • 操作 (aks-ops-euwest-1)
  • 分期 (aks-stg-euwest-1)
  • 生产 (aks-prod-euwest-1)

我有 Hashicorp Vault 在运营上运行,我希望能够访问例如。使用 istio mTLS(用于自动秘密轮换)在 Staging 和 Production 中运行的 Postgres。

每个集群都在不同的网络中运行 istio(多主)。每个集群都有不同的 ClusterName、MeshID、TrustDomain 和 NetworkID。不过,cacerts 机密是使用公共根 CA

配置的

diagram

istio documentation 开始,要启用跨集群通信,必须部署特殊的 eastwestgateway。 tlsMode 是 AUTO_PAsstHROUGH

这些是eastwestgateway的环境变量

# sni-dnat adds the clusters required for AUTO_PAsstHROUGH mode
- name: ISTIO_Meta_ROUTER_MODE
  value: "sni-dnat"
# traffic through this gateway should be routed inside the network
- name: ISTIO_Meta_REQUESTED_NETWORK_VIEW
  value: aks-ops-euwest-1

我不想通过在集群之间共享秘密来启用自动服务发现。为什么?因为我想要对将在网格之间公开的服务进行细粒度控制。我希望能够指定 AuthorizationPolicies 指向远程集群中的 serviceaccounts(因为不同的信任域)

例如:

# production cluster
kind: AuthorizationPolicy
spec:
  selector:
    matchLabels:
      app: postgres
  rules:
  - from:
      source:
        - principal: spiffe://operations-cluster/ns/vault/sa/vault

这是来自istio documentation

在一些高级场景中,跨集群的负载均衡可能不会 想要的。例如,在蓝/绿部署中,您可以部署 不同版本的系统到不同的集群。在这种情况下, 每个集群都作为一个独立的网格有效运行。这 行为可以通过以下几种方式实现:

  • 不要在集群之间交换远程机密。这提供了集群之间最强的隔离。
  • 使用 VirtualService 和 DestinationRule 禁止在服务的两个版本之间进行路由。

istio 文档没有说明的是,在没有共享机密的情况下,如何启用跨集群通信。在共享机密时,istiod 将创建额外的 Envoy 配置,允许 pod 通过东西方网关透明地通信。它没有指定的是如何在不共享机密时手动创建这些配置。

tlsMode 是 AUTO_PAsstHROUGH。查看 istio 仓库

    // Similar to the passthrough mode,except servers with this TLS
    // mode do not require an associated VirtualService to map from
    // the SNI value to service in the registry. The destination
    // details such as the service/subset/port are encoded in the
    // SNI value. The proxy will forward to the upstream (Envoy)
    // cluster (a group of endpoints) specified by the SNI
    // value. This server is typically used to provide connectivity
    // between services in disparate L3 networks that otherwise do
    // not have direct connectivity between their respective
    // endpoints. Use of this mode assumes that both the source and
    // the destination are using Istio mTLS to secure traffic.
    // In order for this mode to be enabled,the gateway deployment
    // must be configured with the `ISTIO_Meta_ROUTER_MODE=sni-dnat`
    // environment variable.

有趣的部分是The destination details such as the service/subset/port are encoded in the SNI value

似乎在集群之间共享秘密时,istio 会添加 envoy 配置,将这些服务/子集/端口有效地编码为 envoy 集群的 SNI 值。但是,当秘密不共享时,我们如何获得相同的结果?

我看过 this repository,但它已经过时并且没有使用 eastwestgateway

我也在 istio 论坛 herehere 上发布了问题,但很难从那里获得帮助。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。