【问题标题】:Using Gateway + VirtualService + http01 + SDS使用网关 + 虚拟服务 + http01 + SDS
【发布时间】:2019-10-20 02:27:42
【问题描述】:

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

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

[更新 1]

我想将istio gatewaySDS 选项一起用于TLS,并通过使用cert-manager with http-01 来保护它。

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

我需要一条指令,其中包括istio gatewaySDS 选项的TLS 并使用cert-manager with http-01 保护它。 Istio 网关让我能够使用VirtualService

谢谢!

【问题讨论】:

  • 尝试提供更多关于您的问题的信息,以便获得您的答案。

标签: kubernetes istio


【解决方案1】:

我找到了答案,但不确定为什么会这样。我已经关注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 Gateway !!不知道!!)我可以像上面的例子一样创建多个网关和虚拟服务。所以一切都很好!这只是我的想法,盲目做是不对的。如果您有更好的答案并且您知道为什么会像我解释的那样发生这种情况,请告诉我。

谢谢!

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-12
    • 2021-11-26
    • 1970-01-01
    • 1970-01-01
    • 2020-07-25
    • 2017-08-25
    • 1970-01-01
    • 2014-02-16
    相关资源
    最近更新 更多