【问题标题】:Istio + Kubernetes: Gateway more than one TLS CertificateIstio + Kubernetes:网关多于一个 TLS 证书
【发布时间】:2020-04-21 12:32:36
【问题描述】:

我有一个包含多个租户(在不同命名空间中)的 Kubernetes 集群。我想为每个租户部署一个独立的 Istio Gateway 对象,我似乎可以做到。但是,设置 TLS 需要一个包含 TLS 密钥/证书的 K8s 密钥。文档指出“秘密必须在 istio-system 命名空间中命名为 istio-ingressgateway-certs”。这似乎表明每个集群只能有一个 TLS 机密。也许我没有正确阅读这个。有没有办法在自己的命名空间中配置独立的 Istio 网关,并使用自己的 TLS 机密?我该怎么做呢?

这是我引用的文档。
https://istio.io/docs/tasks/traffic-management/ingress/secure-ingress-mount/

非常感谢任何想法。

【问题讨论】:

标签: ssl kubernetes istio gateway


【解决方案1】:

正如istio documentation 提供的那样,这是可能的。

在本节中,您将为多个主机 httpbin.example.com 和 bookinfo.com 配置一个入口网关。

因此,在本例中,您需要为 bookinfohttbin 创建私钥,并更新 istio-ingressgateway。

我创建了它们,它们都存在。

bookinfo 证书和网关

kubectl exec -it -n istio-system $(kubectl -n istio-system get pods -l istio=ingressgateway -o jsonpath='{.items[0].metadata.name}') -- ls -al /etc/istio/ingressgateway-bookinfo-certs

lrwxrwxrwx 1 root root   14 Jan  3 10:12 tls.crt -> ..data/tls.crt
lrwxrwxrwx 1 root root   14 Jan  3 10:12 tls.key -> ..data/tls.key

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: bookinfo-gateway
spec:
  selector:
    istio: ingressgateway # use istio default ingress gateway
  servers:
  - port:
      number: 443
      name: https-bookinfo
      protocol: HTTPS
    tls:
      mode: SIMPLE
      serverCertificate: /etc/istio/ingressgateway-bookinfo-certs/tls.crt
      privateKey: /etc/istio/ingressgateway-bookinfo-certs/tls.key
    hosts:
    - "bookinfo.com"

httpbin 证书和网关

kubectl exec -it -n istio-system $(kubectl -n istio-system get pods -l istio=ingressgateway -o jsonpath='{.items[0].metadata.name}') -- ls -al /etc/istio/ingressgateway-certs


lrwxrwxrwx 1 root root   14 Jan  3 10:07 tls.crt -> ..data/tls.crt
lrwxrwxrwx 1 root root   14 Jan  3 10:07 tls.key -> ..data/tls.key


apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: httpbin-gateway
spec:
  selector:
    istio: ingressgateway # use istio default ingress gateway
  servers:
  - port:
      number: 443
      name: https
      protocol: HTTPS
    tls:
      mode: SIMPLE
      serverCertificate: /etc/istio/ingressgateway-certs/tls.crt
      privateKey: /etc/istio/ingressgateway-certs/tls.key
    hosts:
    - "httpbin.example.com"

尚未完全复制以检查它们是否都有效,但如果这对您不起作用,我将尝试制作并更新问题。

这个link 可能会有所帮助。

【讨论】:

  • 感谢您分享这个出色的示例和链接。
猜你喜欢
  • 2019-03-14
  • 1970-01-01
  • 1970-01-01
  • 2021-01-27
  • 2021-01-20
  • 2017-08-15
  • 2021-07-22
  • 2021-05-01
  • 2018-12-12
相关资源
最近更新 更多