栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

kubernetes中cert-manager使用DNS-01方式生成https证书(阿里云)

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

kubernetes中cert-manager使用DNS-01方式生成https证书(阿里云)

说明(腾讯云域名请看另一篇文章)
  • 使用官方阿里云dns插件:https://github.com/pragkent/alidns-webhook(安装比较慢请耐心等待)
  • 也可以使用其他开发者使用的:https://gitee.com/StephenEvenson/cert-manager-alidns-webhook?_from=gitee_search(安装比较慢请耐心等待)
  • dns-01方式支持泛域名解析https证书
  • 查看cert-manager支持的DNS厂商:https://cert-manager.io/docs/configuration/acme/dns01/
获取阿里云授权信息
  • 登录阿里云点击头像accessKey管理
  • 复制access-key和secret-key后续用的到
安装alidns-webhook
  • 尽量安装在和cert-manager一个namespace
  • 基本什么都不需要改,下一步直接安装
创建配置文件(Secret)
  1. 在namespace创建配置文件将阿里云得access-key和secret-key填入
创建集群签发机构(clusterIssuer.yaml)
apiVersion: cert-manager.io/v1alpha2
kind: ClusterIssuer
metadata:
  name: letsencrypt-staging
spec:
  acme:
    # 改为自己得邮箱
    email: certmaster@example.com
    server: https://acme-v02.api.letsencrypt.org/directory
    privateKeySecretRef:
      name: letsencrypt-staging-account-key
    solvers:
    - dns01:
        webhook:
          #和上面安装时保持一致
          groupName: acme.yourcompany.com
          solverName: alidns
          config:
            # 这个参数标识服务器所在地,经过测试不填写,或者随便填写没有影响
            region: "beijing"
            accessKeySecretRef:
              # 引用刚才创建得配置文件,注意文件名称和key名称是否对应
              name: alidns-secret
              key: access-key
            secretKeySecretRef:
              name: alidns-secret
              key: secret-key
# 开始生成
kubectl apply -f clusterIssuer.yaml

#查看状态(需要等一会)
kubectl get ClusterIssuer--all-namespaces
生成证书(certificate.yaml)
apiVersion: cert-manager.io/v1alpha2
kind: Certificate
metadata:
  name: example-tls
  # 指定证书生成到哪个工作空间,不指定也可以
  namespace: docs
spec:
  #生成后证书的配置文件名称
  secretName: example-com-tls
  dnsNames:
  - example.com
  - "*.example.com"
  issuerRef:
    name: letsencrypt-staging
    kind: ClusterIssuer
# 开始生成
kubectl apply -f certificate.yaml

#查看状态(需要等一会)
kubectl get certificate--all-namespaces
使用证书


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/851839.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号