kubernetes - 在 Istio Ingress 上使用letsencrypt 证书
问题描述
我正在运行 Istio 1.5,显然默认情况下启用了 SDS,并尝试在我的 EKS 集群(v1.15)中启用南北流量的 TLS,并且我已经完成了以下操作:
- 按照此处的步骤设置示例应用程序https://istio.io/latest/docs/setup/getting-started/
- 已安装证书管理器 0.15.1
- 创建了一个集群颁发者
- 将集群发行者配置为尝试通过将其与 AWS Route53 集成来解决 DNS 挑战
- 使用集群颁发者和letsencrypt生成证书
- 按照此处的步骤使用上面创建的证书配置网关和虚拟服务https://istio.io/latest/docs/tasks/traffic-management/ingress/secure-ingress/
- 我复制了letsencrypt的根证书以通过curl命令
- 试图卷曲到负载均衡器的 IP,我得到了这个错误
谁能指导我如何解决这个问题?
解决方案
有关于集成 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
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 在评论中提到的那样,这解决了他的问题。因此,如果您有类似的问题,请查看上面的复制。
推荐阅读
- go - 如何在go中使用openpgp生成的密钥对
- cmake - 如何解决“缺少 GUROBI_LIBRARY”的问题?
- winapi - 创建可滚动对话框
- python - 在带有不相关模型的 Django 注释中使用子查询和 OuterRef
- python - 为什么使用 pandas DataFrame 导入数据后数据显示 NaN
- java - 有什么理由不应该重复调用 getter 方法?
- android - Appium 服务器(Appium 桌面)无法访问 (.apk) 或 (.aab) 中的 Android 文件
- c# - C# SQL 关闭阅读器
- azure - 使用自动安全性的 Azure 资源管理器服务连接:为资源组分配了哪些权限?
- msbuild - 在 Rider 中,如何使用不在项目根文件夹中的 .sln 文件?