使用网关 + VirtualService + http01 + SDS

Using Gateway + VirtualService + http01 + SDS

document 中有一个关于 使用 Cert-Manager 保护 Kubernetes Ingress 的示例,它没有使用 Gateway + VirtualService。

我已尝试使其与 acme http01 一起使用,但无法颁发证书,因为在日志质询中出现 404 错误。似乎它无法访问域检查挑战。我提到的规范有什么最佳实践吗?

[更新 1]

我想使用 istio gateway with SDS option for TLS and secure that by using cert-manager with http-01.

根据文档,我找到了一些像 Securing Kubernetes Ingress with Cert-Manager or Deploy a Custom Ingress Gateway Using Cert-Manager 这样的例子。然而,这些示例使用的是 Kuberenetes Ingress 资源本身(不是 istio 网关),或者像第二个示例一样使用 dns-01

我需要一个包含 istio gateway with SDS option for TLS and secure that by using cert-manager with http-01 的说明。 Istio 网关让我能够使用 VirtualService.

谢谢!

我找到了答案,但不确定为什么会这样。我已按照 documentation 进行了一些更改。

首先,我使用 kubectl -n istio-system edit gateway 命令编辑了 istio-autogenerated-k8s-ingress。 我删除了整个 HTTPS 部分,并将 HTTP 部分留在那里。

然后我创建了另一个 Gateway 类似的东西:

cat <<EOF | kubectl apply -f -
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: bookinfo-gateway
spec:
  selector:
    istio: ingressgateway
  servers:
  - hosts:
    - 'example.com'
    port:
      name: http
      number: 80
      protocol: HTTP2
    tls:
      httpsRedirect: true
  - hosts:
    - 'example.com'
    port:
      name: https-default
      number: 443
      protocol: HTTPS
    tls:
      credentialName: ingress-cert-staging
      mode: SIMPLE
      privateKey: sds
      serverCertificate: sds
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: bookinfo
spec:
  hosts:
  - "example.com"
  gateways:
  - bookinfo-gateway
  http:
  - match:
    - uri:
        exact: /productpage
    - uri:
        exact: /login
    - uri:
        exact: /logout
    - uri:
        prefix: /api/v1/products
    route:
    - destination:
        host: productpage
        port:
          number: 9080

EOF


有了这个 cert-manager 颁发了我的证书(我猜是 istio-autogenerated-k8s-ingress 网关!!不知道!!)我可以像上面的例子一样创建多个网关和虚拟服务。所以一切都很好!这只是我的想法,盲目地做是不对的。如果你有更好的答案并且你知道为什么会像我解释的那样发生,请告诉我。

谢谢!