首页 > 解决方案 > 在 Istio Ingress 上使用letsencrypt 证书

问题描述

我正在运行 Istio 1.5,显然默认情况下启用了 SDS,并尝试在我的 EKS 集群(v1.15)中启用南北流量的 TLS,并且我已经完成了以下操作:

谁能指导我如何解决这个问题?

标签: kuberneteskubernetes-ingressistioamazon-ekscert-manager

解决方案


有关于集成 cert-menager 和 istio的相关文档。

证书管理器

配置

请查阅cert-manager 安装文档以开始使用。使用 Istio 无需进行特殊更改。

用法

Istio Gateway cert-manager 可用于将 secret 写入 Kubernetes,然后可由 Gateway 引用。要开始,请按照cert-manager 文档配置证书资源。证书应该在与 istio-ingressgateway 部署相同的命名空间中创建。例如,证书可能如下所示:

apiVersion: cert-manager.io/v1alpha2
kind: Certificate
metadata:
  name: ingress-cert
  namespace: istio-system
spec:
  secretName: ingress-cert
  commonName: my.example.com
  dnsNames:
  - my.example.com
  ...

一旦我们创建了证书,我们应该会看到在 istio-system 命名空间中创建的秘密。然后可以在 credentialName 下的网关的 tls 配置中引用它:

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: gateway
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 443
      name: https
      protocol: HTTPS
    tls:
      mode: SIMPLE
      credentialName: ingress-cert # This should match the Certifcate secretName
    hosts:
    - my.example.com # This should match a DNS name in the Certificate

Kubernetes 入口

cert-manager 通过在 Ingress 对象上配置注释来提供与 Kubernetes Ingress 的直接集成。如果使用此方法,则 Ingress 必须与 istio-ingressgateway 部署位于同一命名空间中,因为只能在同一命名空间中读取机密。

或者,可以按照Istio Gateway中的描述创建证书,然后在 Ingress 对象中引用:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress
  annotations:
    kubernetes.io/ingress.class: istio
spec:
  rules:
  - host: my.example.com
    http: ...
  tls:
  - hosts:
    - my.example.com # This should match a DNS name in the Certificate
    secretName: ingress-cert # This should match the Certifcate secretName

此外,@chrisnyc 使用 cert-menager 进行了完整复制,并在 istio 上进行了讨论,正如@YYashwanth 在评论中提到的那样,这解决了他的问题。因此,如果您有类似的问题,请查看上面的复制。


推荐阅读