4

几个月前我配置了自动 SSL 证书管理,如下所述:http: //docs.cert-manager.io/en/latest/tutorials/acme/dns-validation.html for domain: <myhost>.comand dev.<myhost>.com. 所以我有两个命名空间:prodfor<myhost>.comdevfor dev.<myhost>.com。在每个命名空间中,我都有入口控制器和Certificate资源来将证书存储为机密。它工作正常并ClusterIssuer自动更新证书。

但是几天前我尝试添加新域:test.<myhost>.com在名称空间中,入口和证书的配置与或名称空间test中完全相同(期望主机名和名称空间):proddev

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/proxy-read-timeout: "600"
    nginx.ingress.kubernetes.io/proxy-send-timeout: "600"
    kubernetes.io/tls-acme: 'true'
  name: app-ingress
  namespace: test
spec:
  tls:
  - hosts:
    - test.<myhost>.com
    secretName: letsencrypt-tls
  rules:
    - host: test.<myhost>.com
      http:
        paths:
        - backend:
            serviceName: web
            servicePort: 80
          path: /
---
apiVersion: certmanager.k8s.io/v1alpha1
kind: Certificate
metadata:
  name: cert-letsencrypt
  namespace: test
spec:
  secretName: letsencrypt-tls
  issuerRef:
    name: letsencrypt-prod-dns
    kind: ClusterIssuer
  commonName: 'test.<myhost>.com'
  dnsNames:
  - test.<myhost>.com
  acme:
    config:
    - dns01:
        provider: dns
      domains:
      - test.<myhost>.com

并且此配置不起作用:无法秘密找到证书,入口正在使用“app-ingress-fake-certificate”。

cert-managerpod 显示很多类似的错误:

pkg/client/informers/externalversions/factory.go:72: Failed to list *v1alpha1.Challenge: challenges.certmanager.k8s.io is forbidden: User "system:serviceaccount:kube-system:cert-manager" cannot list challenges.certmanager.k8s.io at the cluster scope
pkg/client/informers/externalversions/factory.go:72: Failed to list *v1alpha1.Order: orders.certmanager.k8s.io is forbidden: User "system:serviceaccount:kube-system:cert-manager" cannot list orders.certmanager.k8s.io at the cluster scope

并且certificate没有尝试获得证书(kubectl describe -ntest cert-letsencrypt):

API Version:  certmanager.k8s.io/v1alpha1
Kind:         Certificate
Metadata: ...
Spec:
  Acme:
    Config:
      Dns 01:
        Provider:  dns
      Domains:
        test.<myhost>.com
  Common Name:  test.<myhost>.com
  Dns Names:
    test.<myhost>.com
  Issuer Ref:
    Kind:       ClusterIssuer
    Name:       letsencrypt-prod-dns
  Secret Name:  letsencrypt-tls
Events:         <none>

它应该具有作为其他命名空间上的证书的任何状态。

我不明白为什么这个配置以前可以工作,但现在不能工作。

我不确定它是否相关,但我在几周前使用 kops 更新了 kubernetes,当前版本是:

Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.0", GitCommit:"0ed33881dc4355495f623c6f22e7dd0b7632b7c0", GitTreeState:"archive", BuildDate:"2018-10-12T16:56:06Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.6", GitCommit:"a21fdbd78dde8f5447f5f6c331f7eb6f80bd684e", GitTreeState:"clean", BuildDate:"2018-07-26T10:04:08Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
4

1 回答 1

1

此问题的原因是 Kubernetes 从升级1.91.10. 要修复它,您需要将 cert-manager 升级到0.5.x版本。

由于错误https://github.com/jetstack/cert-manager/issues/1134可能无法从升级0.4.x0.5.x使用, 在这种情况下,您需要存储所有颁发者和证书配置,然后删除 cert-manager并安装,然后从第一步应用所有颁发者和证书配置。helm0.4.x0.5.x

于 2018-12-23T21:15:08.647 回答