证书管理器 - 我的证书的持续时间和更新过程

cert manager - Duration and renewal process of my certificates

我正在使用 cert-manager 和 kong-ingress-controller 在 kubernetes 中启用 https。

当我只使用 ClusterIssuer 和我们使用入口资源时它默认生成的证书时,我很想知道更新过程是怎样的。

我没有使用 kind: Certificate 资源,这意味着我没有定义要签名的 X.509 自定义证书,也没有通过引用我的 ClusterIssuer 来获取验证的证书。

目前我已经创建了一个 ClusterIssuer 和一个入口资源,它会自动创建一个名为 letsencrypt-prod 的证书,它将用于在 [=] 之间执行 http01 验证19=] 和 letsencrypt CA

最后,我得到了这个输出:

I0321 10:49:48.505664       1 controller.go:162] certificates controller: syncing item 'default/letsencrypt-prod'
I0321 10:49:48.506008       1 conditions.go:143] Found status change for Certificate "letsencrypt-prod" condition "Ready": "False" -> "True"; setting lastTransitionTime to 2019-03-21 10:49:48.506003434 +0000 UTC m=+168443.026129945
I0321 10:49:48.506571       1 sync.go:263] Certificate default/letsencrypt-prod scheduled for renewal in 1438h59m58.49343646s
I0321 13:57:46.226424       1 controller.go:168] certificates controller: Finished processing work item "default/letsencrypt-prod"
I0321 15:12:53.199067       1 controller.go:178] ingress-shim controller: syncing item 'default/kong-ingress-service'
I0321 15:12:53.199171       1 sync.go:183] Certificate "letsencrypt-prod" for ingress "kong-ingress-service" is up to date

这意味着我的证书将在 1438h-59m-58.49343646s 内更新。这意味着大约 3 个月

也就是说,真的会自动刷新吗?

here所示:

The default duration for all certificates is 90 days and the default renewal windows is 30 days. This means that certificates are considered valid for 3 months and renewal will be attempted within 1 month of expiration.

证书管理器文档说:

Although the duration and renewal periods are specified on the Certificate resources, the corresponding Issuer or ClusterIssuer must support this.

我的集群发行者是:

apiVersion: certmanager.k8s.io/v1alpha1
kind: ClusterIssuer 
metadata:
  name: letsencrypt-prod
spec:
 acme:
    server: https://acme-v02.api.letsencrypt.org/directory
    email: my-email@example.com
    privateKeySecretRef:
      name: letsencrypt-prod
    http01: {}

如果我不创建证书资源,如何管理 durationrenewBefore 参数。 ?

据此我可以在我的ClusterIssuer中添加durationrenewBefore参数吗?也许是这样?

apiVersion: certmanager.k8s.io/v1alpha1
kind: ClusterIssuer 
metadata:
  name: letsencrypt-prod
spec:
 acme:
    server: https://acme-v02.api.letsencrypt.org/directory
    email: my-email@example.com
    privateKeySecretRef:
      name: letsencrypt-prod
    http01: {}
 # ...
 duration: 24h
 renewBefore: 12h 

issuers\clusterissuers 不支持,仅证书支持。您可以创建一个 admission controllers 来改变证书,或者您可以有一个 cronjob 在创建后更新证书资源