我在用cert-manager-v0.10.0
从其安装舵图
我在用kong就像入口控制器来管理入口操作。
所以我创建了一个ClusterIssuer
资源,以便可以通过 kong-ingress 控制器从 Ingress 资源联系它。
The ClusterIssuer
这是:
apiVersion: certmanager.k8s.io/v1alpha1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
spec:
acme:
# The ACME server URL
server: https://acme-v02.api.letsencrypt.org/directory
# Email address used for ACME registration
email: [email protected]
# Name of a secret used to store the ACME account private key
privateKeySecretRef:
name: letsencrypt-prod
# Enable the HTTP-01 challenge provider
solvers:
- http01:
ingress:
class: kong
我正在使用的入口资源是这样的。
您可以在这里看到,我将其指向之前创建的 ClusterIssuer,并且
另外,我将其指向 kong 作为入口控制器,根据kubernetes.io/ingress.class: "kong"
其中包含注释:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
# add an annotation indicating the issuer to use.
certmanager.k8s.io/cluster-issuer: letsencrypt-prod # letsencrypt-staging
kubernetes.io/ingress.class: "kong"
plugins.konghq.com: swaggerapi-customer-production-basic-auth, swaggerapi-customer-production-acl
name: production-customer-ingress-app
# namespace: default
spec:
rules:
- host: appprod.mydomain.org
http:
paths:
- backend:
serviceName: customer-production-app
servicePort: 80
path: /comcustomerpr
tls: # < placing a host in the TLS config will indicate a cert should be created
- hosts:
- appprod.mydomain.org
secretName: letsencrypt-prod # < cert-manager will store the created certificate in this secret.
因此,当我创建上面的 Ingress 资源时,secretName
上面在我的入口中引用的内容已创建,并且还有一个同名的证书资源......即letsencrypt-prod
.
它将是接收 LetsEncrypt 验证成功过程的证书资源...
我得到了 TLS 加密,这里一切正常。
但现在,我想知道续订过程如何。因为我目前非常确定更新证书过程不会自动发生......
我正在这里读一些东西https://docs.cert-manager.io/en/latest/reference/certificates.html?highlight=renewal#certificate-duration-and-renewal-window该文档说有必要附加到创建的证书资源(kind:Certificate
) the spec.duration
and spec.renewBefore
这种方式的属性
spec:
secretName: example-tls
duration: 24h
renewBefore: 12h
如果 LetsEncrypt 颁发的证书默认期限为 90 天,我该如何指定这些spec.duration
and spec.renewBefore
属性?
我想讨论这个问题,因为我的主要问题是我没有创建证书,它是在执行 Ingress 资源(上面引用的)时创建的。
我怎样才能用我正在做的这种方法解决这里的更新过程?
UPDATE
我需要创建一个特定的kind:Certificate
资源,引用我从 LetsEncrypt 获得的秘密?
我的意思是,像这样的东西?
apiVersion: certmanager.k8s.io/v1alpha1
kind: Certificate
metadata:
name: letsencrypt-prod
spec:
secretName: letsencrypt-prod
dnsNames:
- mydomain.com
acme:
config:
- http01:
ingressClass: kong
domains:
- mydomain.com
issuerRef:
name: letsencrypt-prod
kind: ClusterIssuer
我在这里有疑问,因为目前我没有收到证书续订操作