3

我从头到尾都关注了https://docs.cert-manager.io/en/venafi/tutorials/quick-start/index.html一切似乎都在工作,只是我没有为我的入口获取外部 IP .

NAME                     HOSTS                                  ADDRESS   PORTS     AGE
staging-site-ingress   staging.site.io,staging.admin.site.io,             80, 443   1h

尽管我能够使用 nginx 入口控制器外部 ip 并使用 dns 访问站点。当我访问 url 时,我被重定向到 https,所以我认为它工作正常。

它重定向到 https,但仍然显示“不安全”,因此他没有获得颁发的证书。

当我调试时,我得到以下信息:

入口

Events:
  Type    Reason             Age                From                      Message
  ----    ------             ----               ----                      -------
  Normal  CreateCertificate  54m                cert-manager              Successfully created Certificate "tls-secret-staging"
  Normal  UPDATE             35m (x3 over 1h)   nginx-ingress-controller  Ingress staging/staging-site-ingress
  Normal  CreateCertificate  23m (x2 over 35m)  cert-manager              Successfully created Certificate "letsencrypt-staging-tls"

证书:

Status:
  Conditions:
    Last Transition Time:  2019-02-27T14:02:29Z
    Message:               Certificate does not exist
    Reason:                NotFound
    Status:                False
    Type:                  Ready
Events:
  Type    Reason        Age               From          Message
  ----    ------        ----              ----          -------
  Normal  OrderCreated  3m (x2 over 14m)  cert-manager  Created Order resource "letsencrypt-staging-tls-593754378"

秘密:

Name:         letsencrypt-staging-tls
Namespace:    staging
Labels:       certmanager.k8s.io/certificate-name=staging-site-io
Annotations:  <none>

Type:  kubernetes.io/tls

Data
====
ca.crt:   0 bytes
tls.crt:  0 bytes
tls.key:  1679 bytes

命令:

Status:
  Certificate:   <nil>
  Finalize URL:  
  Reason:        
  State:         
  URL:           
Events:          <none>

因此,似乎顺序出现了问题,并且没有产生任何挑战。

这是我的 ingress.yaml 和 issuer.yaml:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: staging-site-ingress
  annotations:
    kubernetes.io/ingress.class: "nginx"    
    certmanager.k8s.io/issuer: "letsencrypt-staging"
    certmanager.k8s.io/acme-challenge-type: http01
spec:
  tls:
  - hosts:
    - staging.site.io
    - staging.admin.site.io
    - staging.api.site.io
    secretName: letsencrypt-staging-tls
  rules:
    - host: staging.site.io
      http:
        paths:
          - backend:
              serviceName: frontend-service
              servicePort: 80
            path: /
    - host: staging.admin.site.io
      http:
        paths:
          - backend:
              serviceName: frontend-service
              servicePort: 80
            path: /
    - host: staging.api.site.io
      http:
        paths:
          - backend:
              serviceName: gateway-service
              servicePort: 9000
            path: /
apiVersion: certmanager.k8s.io/v1alpha1
kind: Issuer
metadata:
  name: letsencrypt-staging
  namespace: staging
spec:
  acme:
    server: https://acme-staging-v02.api.letsencrypt.org/directory
    email: hello@site.io
    privateKeySecretRef:
      name: letsencrypt-staging-tls
    http01: {}

任何人都知道我可以做些什么来解决这个问题或出了什么问题?Certmanager 100% 正确安装,我只是不确定入口以及顺序出了什么问题。

提前致谢!

编辑:我在 nginx-ingress-controller 中找到了这个:

W0227 14:51:02.740081       8 controller.go:1078] Error getting SSL certificate "staging/letsencrypt-staging-tls": local SSL certificate staging/letsencrypt-staging-tls was not found. Using default certificate

它越来越多,CPU 负载始终为 0.003,cpu 图已满(其他服务几乎没有)

4

1 回答 1

4

按照完全相同的官方教程,我偶然发现了同样的问题。正如@mikebridge 提到的,问题在于Issuer/Secret 的命名空间不匹配。

对我来说,最好的办法是从 Issuer 切换到ClusterIssuer,它不限于单个命名空间。

于 2019-03-11T11:57:28.667 回答