cert-manager本身支持的dns解析商数量有限
由于cert-manager官方支持的dns解析商数量有限,其余的dns解析商,就需要使用acme-dns的方式来实现证书签发了(例如腾讯云、dnspod、alidns等)
接下来我记录下该方式的折腾记录。
前提依赖
- cert-manager已安装,这里就不说cert-manager的安装方式了,安装方式挺多的。
- 具有一个或者多个域名权限。要求一级域名的权限。
开始步骤
- 去
https://auth.acme-dns.io
生成一套秘钥信息,用于对你的域名进行绑定。
curl -X POST https://auth.acme-dns.io/register
得到如下的数据:
{
"username": "eabcdb41-d89f-4580-826f-3e62e9755ef2",
"password": "pbAXVjlIOE01xbut7YnAbkhMQIkcwoHO0ek2j4Q0",
"fulldomain": "d420c923-bbd7-4056-ab64-c3ca54c9b3cf.auth.acme-dns.io",
"subdomain": "d420c923-bbd7-4056-ab64-c3ca54c9b3cf",
"allowfrom": []
}
- 根据信息处理你的域名(example.com和example.org为例)
> 你所有要签发证书的域名都创建对应的_acme-challenge
子域名的cname记录。cname从上面的fulldomain
中提取。
_acme-challenge.example.com CNAME d420c923-bbd7-4056-ab64-c3ca54c9b3cf.auth.acme-dns.io
_acme-challenge.example.org CNAME d420c923-bbd7-4056-ab64-c3ca54c9b3cf.auth.acme-dns.io
- 配置secret到cert-manager中去
kind: Secret
metadata:
name: auth-example-com
namespace: cert-manager # 和你的cert-manager安装的namespace保持一致
stringData:
acmedns.json: |
{
"example.com": {
"username": "eabcdb41-d89f-4580-826f-3e62e9755ef2",
"password": "pbAXVjlIOE01xbut7YnAbkhMQIkcwoHO0ek2j4Q0",
"fulldomain": "d420c923-bbd7-4056-ab64-c3ca54c9b3cf.auth.acme-dns.io",
"subdomain": "d420c923-bbd7-4056-ab64-c3ca54c9b3cf",
"allowfrom": []
},
"foo.example.com": {
"username": "eabcdb41-d89f-4580-826f-3e62e9755ef2",
"password": "pbAXVjlIOE01xbut7YnAbkhMQIkcwoHO0ek2j4Q0",
"fulldomain": "d420c923-bbd7-4056-ab64-c3ca54c9b3cf.auth.acme-dns.io",
"subdomain": "d420c923-bbd7-4056-ab64-c3ca54c9b3cf",
"allowfrom": []
},
"example.org": {
"username": "eabcdb41-d89f-4580-826f-3e62e9755ef2",
"password": "pbAXVjlIOE01xbut7YnAbkhMQIkcwoHO0ek2j4Q0",
"fulldomain": "d420c923-bbd7-4056-ab64-c3ca54c9b3cf.auth.acme-dns.io",
"subdomain": "d420c923-bbd7-4056-ab64-c3ca54c9b3cf",
"allowfrom": []
},
}
---
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: my-dnspod-issuer
namespace: cert-manager # 和你的cert-manager安装的namespace保持一致
spec:
acme:
solvers:
- dns01:
acmeDNS:
accountSecretRef:
name: auth-example-com
key: acmedns.json
host: auth.acme-dns.io
- 申请证书
kind: Certificate
spec:
issuerRef:
name: my-dnspod-issuer
dnsNames:
- "example.com"
- "example.org"
- "foo.example.com"
#参考文档
https://cert-manager.io/docs/configuration/acme/dns01/acme-dns/