簡體   English   中英

Istio + Kubernetes:網關多個 TLS 證書

[英]Istio + Kubernetes: Gateway more than one TLS Certificate

我有一個 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/

任何想法都非常感謝。

正如istio 文檔中提供的那樣,這是可能的。

在本節中,您將為多個主機(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"

尚未進行完整復制以檢查它們是否都有效,但如果這對您不起作用,我將嘗試制作並更新問題。

鏈接可能會有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM