重大更新停止工作后的证书管理器

时间:2020-01-14 21:34:23

标签: kubernetes cert-manager

在将cert-manager从0.6.0重大更新到0.11.0后,该问题开始了。 更新已通过配置备份,cert-manager删除,helm更新,cert-manager安装和备份还原进行了处理。更新期间没有配置更改。

Pod和服务已启动,但更新后未颁发证书。

有用于证书管理器服务的日志:

 E0114 04:34:18.126497       1 sync.go:57] cert-manager/controller/ingress-shim "msg"="failed to determine issuer to be used for ingress resource" "error"="failed to determine issuer name to be used for ingress resource" "resource_kind"="Ingress" "resource_name"="ucb-sandbox-ingress" "resource_namespace"="cloud-engagement-sandbox" 
I0114 04:34:18.126791       1 controller.go:135] cert-manager/controller/ingress-shim "level"=0 "msg"="finished processing work item" "key"="cloud-engagement-sandbox/ucb-sandbox-ingress" 
I0114 04:34:18.127064       1 controller.go:129] cert-manager/controller/ingress-shim "level"=0 "msg"="syncing item" "key"="cloud-engagement-sandbox/ucf-sandbox-ingress" 
E0114 04:34:18.127294       1 sync.go:57] cert-manager/controller/ingress-shim "msg"="failed to determine issuer to be used for ingress resource" "error"="failed to determine issuer name to be used for ingress resource" "resource_kind"="Ingress" "resource_name"="ucf-sandbox-ingress" "resource_namespace"="cloud-engagement-sandbox" 
I0114 04:34:18.127534       1 controller.go:135] cert-manager/controller/ingress-shim "level"=0 "msg"="finished processing work item" "key"="cloud-engagement-sandbox/ucf-sandbox-ingress" 

我的ClusterIssuer yaml:

apiVersion: certmanager.k8s.io/v1alpha2
kind: ClusterIssuer
metadata:
  name: letsencrypt-prod
spec:
  acme:
    server: https://acme-v02.api.letsencrypt.org/directory
    email: [removed]
    privateKeySecretRef:

      name: letsencrypt-prod
    http01: {}

并描述ClusterIssuer letsencrypt-prod

ClusterIssuer letsencrypt-prod
Name:         letsencrypt-prod
Namespace:
Labels:       <none>
Annotations:  kubectl.kubernetes.io/last-applied-configuration:
                {"apiVersion":"certmanager.k8s.io/v1alpha1","kind":"ClusterIssuer","metadata":{"annotations":{},"creationTimestamp":"2019-02-17T22:42:55Z"...
API Version:  certmanager.k8s.io/v1alpha1
Kind:         ClusterIssuer
Metadata:
  Creation Timestamp:  2019-02-17T22:42:55Z
  Generation:          1
  Resource Version:    53383155
  Self Link:           /apis/certmanager.k8s.io/v1alpha1/clusterissuers/letsencrypt-prod
  UID:                 5e0c332f-3305-11e9-93cb-069443f5754c
Spec:
  Acme:
    Email:  [removed]
    Http 01:
    Private Key Secret Ref:
      Key:
      Name:  letsencrypt-prod
    Server:  https://acme-v02.api.letsencrypt.org/directory
Status:
  Acme:
    Uri:  https://acme-v02.api.letsencrypt.org/acme/acct/51694394
  Conditions:
    Last Transition Time:  2019-02-17T22:42:57Z
    Message:               The ACME account was registered with the ACME server
    Reason:                ACMEAccountRegistered
    Status:                True
    Type:                  Ready
Events:                    <none>

3 个答案:

答案 0 :(得分:4)

apiVersion已从certmanager.k8s.io/v1alpha1更改为cert-manager.io/v1alpha2。但是您仍然具有带有旧apiVersion的CRD,需要将其删除。

请按照以下步骤升级证书管理器,注意 步骤3和4。

1。按照backup and restore guide备份现有的证书管理器资源。

2。Uninstall cert-manager

3。确保旧的证书管理器CRD资源也已删除:kubectl get crd | grep certmanager.k8s.io

4。将所有备份资源上的apiVersion更新从certmanager.k8s.io/v1alpha1升级到cert-manager.io/v1alpha2。

5。根据installation guide

重新安装cert-manager。

这是官方的upgrade guide

答案 1 :(得分:1)

已排序。罪魁祸首是1)证书管理器安装不完整。 2)我还修改了备份,并用cert-manager.io替换了所有certmanager.k8s.io,并用v1alpha2替换了v1alpha1。 3)手动删除与certmanager.k8s.io CRD相关的其他

答案 2 :(得分:0)

感谢您的回复。 掌舵清除证书管理器后,我删除了旧的CRD,并使用清单安装了新的0.12版本。 我当前的CRD如下:

kubectl get crd 
NAME                                    CREATED AT
certificaterequests.cert-manager.io     2019-11-01T01:37:03Z
certificates.cert-manager.io            2019-11-01T01:37:03Z
challenges.acme.cert-manager.io         2019-11-01T01:37:03Z
challenges.certmanager.k8s.io           2020-01-15T05:31:48Z
clusterissuers.cert-manager.io          2019-11-01T01:37:03Z
healthstates.azmon.container.insights   2019-08-29T10:13:59Z
issuers.cert-manager.io                 2019-11-01T01:37:03Z
orders.acme.cert-manager.io             2019-11-01T01:37:03Z
orders.certmanager.k8s.io               2020-01-15T05:31:49Z

和更新的ClusterIssuer描述

kubectl describe ClusterIssuer letsencrypt-prod
Name:         letsencrypt-prod
Namespace:
Labels:       <none>
Annotations:  <none>
API Version:  cert-manager.io/v1alpha2
Kind:         ClusterIssuer
Metadata:
  Creation Timestamp:  2020-01-15T05:38:32Z
  Generation:          1
  Resource Version:    71299934
  Self Link:           /apis/cert-manager.io/v1alpha2/clusterissuers/letsencrypt-prod
  UID:                 4465c9ce-3759-11ea-be9c-0a7022c023e8
Spec:
  Acme:
    Email:  
    Private Key Secret Ref:
      Name:  letsencrypt-prod
    Server:  https://acme-v02.api.letsencrypt.org/directory
    Solvers:
      Http 01:
        Ingress:
          Class:  nginx
      Selector:
Events:  <none>

我在cert-manager命名空间下没有入口。另外,我的备份包括旧证书,CRD,颁发者,证书和证书请求等,但是我不知道如何还原所需的内容。