Istio + Kubernetes:网关多个TLS证书

问题描述 投票:0回答:1

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

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

任何想法都值得赞赏。

ssl kubernetes istio gateway
1个回答
0
投票

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"

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

© www.soinside.com 2019 - 2024. All rights reserved.