在Istio Ingress上使用Letencrypt证书

时间:2020-07-19 22:52:25

标签: kubernetes kubernetes-ingress istio eks cert-manager

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

有人可以指导我如何解决此问题吗?

1 个答案:

答案 0 :(得分:1)

与{@ 3}集成有关cert-menager和istio。

cert-manager

配置

请咨询documentation以开始使用。无需特殊更改即可使用Istio。

用法

Istio网关 cert-manager可以用于向Kubernetes写入机密,然后网关可以引用它。首先,请按照cert-manager installation documentation配置证书资源。证书应在与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名称空间中创建的秘密。然后可以在tls配置中为credentialName下的网关引用该地址:

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

cert-manager documentation

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

或者,可以按照annotation on the Ingress object中所述创建证书,然后在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 Gateway,并让它在istio讨论上进行加密,正如@YYashwanth在评论中提到的那样,解决了他的问题。因此,如果您遇到类似的问题,请查看上述内容。