1

我使用cert-managerLet's Encrypt 为我在 Kubernetes 上的应用程序生成 TLS 证书。

它正在运行,我可以在我的应用程序容器内看到“ca.crt”、“tls.crt”和“tsl.key”(在 中/etc/letsencrypt/)。

但是“ca.crt”是空的,应用程序会抱怨它(Error: Unable to load CA certificates. Check cafile "/etc/letsencrypt/ca.crt")。另外两个文件看起来像普通证书。

这意味着什么?

4

3 回答 3

2

使用 cert-manager 您必须使用nginx-ingress将作为暴露点的控制器。

ingress nginx 控制器将创建一个负载均衡器,您可以在那里设置您的应用程序 tls 证书。

cert-manager 的 pod 中没有关于证书的内容。

所以使用 cert-manager 设置 nginx 入口,这将有助于管理 tls 证书。该证书将存储在 Kubernetes 机密中。

请按照本指南了解更多详情:

https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nginx-ingress-with-cert-manager-on-digitalocean-kubernetes

于 2019-07-04T20:26:28.393 回答
1

根据文档,cafile 用于其他用途(受信任的根证书),在大多数系统上使用 capath /etc/ssl/certs 可能更正确。

如果您有 Windows 操作系统,则可以遵循本指南: tls。文章是关于如何让 Mosquitto 和客户端使用 TLS 协议。

建立与 Mosquitto 代理的安全 TLS 连接需要密钥和证书文件。使用正确的设置创建所有这些文件并不是最简单的事情,但可以通过一种安全的方式与 MQTT 代理进行通信。

如果您想使用通过 Let's Encrypt 服务生成的 TLS 证书。您需要注意,当前版本的 mosquitto 在运行时永远不会更新侦听器设置,因此当您重新生成服务器证书时,您需要完全重新启动代理。

如果您使用 DigitalOcean Kubernetes,请尝试遵循以下说明:ca-ninx,您可以使用 Cert-Manager 和 ingress nginx 控制器,它们将像 certbot 一样工作。

另一种解决方案是在您的机器上本地创建证书,然后将其上传到 kubernetes secret 并在入口使用 secret。

于 2019-07-05T06:01:38.107 回答
1

我注意到了这一点:

$ kubectl describe certificate iot-mysmartliving -n mqtt
...
Status:
  Conditions:
    ...
    Message:  Certificate issuance in progress. Temporary certificate issued.

以及文档中的相关行:

https://docs.cert-manager.io/en/latest/tasks/issuing-certificates/index.html?highlight=gce#temporary-certificates-whilst-issuing

他们解释说,生成两个现有证书是为了实现某种兼容性,但在颁发者完成工作之前它们是无效的。

这表明发行人没有正确设置。


编辑:是的。DNS挑战失败了,帮助的调试线是

kubectl describe challenge --all-namespaces=true

更普遍,

kubectl describe clusterissuer,certificate,order,challenge --all-namespaces=true
于 2019-07-05T09:56:31.967 回答