Traefik Ingress(Kubernetes)未收到letencrypt证书

时间:2018-09-17 18:31:50

标签: kubernetes traefik traefik-ingress

我已使用Let'sencrypt ACME配置了Traefik(舵图),但没有收到任何证书。 Traefik Ingress在端口80和443上公开了互联网。

traefik.toml

logLevel = "INFO"
InsecureSkipVerify = true
defaultEntryPoints = ["http","https"]
[entryPoints]
  [entryPoints.http]
  address = ":80"
  compress = true
  [entryPoints.https]
  address = ":443"
  compress = true
    [entryPoints.https.tls]
      [[entryPoints.https.tls.certificates]]
      CertFile = "/ssl/tls.crt"
      KeyFile = "/ssl/tls.key"
[kubernetes]
[acme]
email = "email@email.com"
storage = "/acme/acme.json"
entryPoint = "https"
onHostRule = true
caServer = "https://acme-staging-v02.api.letsencrypt.org/directory"
acmeLogging = true
  [acme.httpChallenge]
  entryPoint = "http"
[web]
address = ":8080"

以Traefik作为IngressClass的Ingress

{
  "kind": "Ingress",
  "apiVersion": "extensions/v1beta1",
  "metadata": {
    "name": "domain",
    "namespace": "reverse-proxy",
    "selfLink": "/apis/extensions/v1beta1/namespaces/reverse-proxy/ingresses/domain",
    "uid": "550cdedc-ba77-11e8-8657-00155d00021a",
    "resourceVersion": "6393921",
    "generation": 5,
    "creationTimestamp": "2018-09-17T12:43:52Z",
    "annotations": {
      "ingress.kubernetes.io/ssl-redirect": "true",
      "kubernetes.io/ingress.class": "traefik"
    }
  },
  "spec": {
    "tls": [
      {
        "hosts": [
          "domain.com"
        ],
        "secretName": "cert" // without is also not working
      }
    ],
    "rules": [
      {
        "host": "domain.com",
        "http": {
          "paths": [
            {
              "backend": {
                "serviceName": "domain",
                "servicePort": 443
              }
            }
          ]
        }
      },
      {
        "host": "www.domain.com",
        "http": {
          "paths": [
            {
              "backend": {
                "serviceName": "www-domain",
                "servicePort": 443
              }
            }
          ]
        }
      }
    ]
  },
  "status": {
    "loadBalancer": {}
  }
}

我尝试同时使用http-01和tls-sni-01挑战。 dns-01是没有选择的,因为我的DNS提供程序没有API。

2 个答案:

答案 0 :(得分:2)

如何将letsencrypt配置注入traefik Ingress服务/守护程序集?

Traefik在Kubernetes Ingress文档上没有正式的letencrypt。但这是good guide。查找“外部Traefik入口控制器”,您需要一个kv后端来存储您的证书。

您也可以尝试与Traefik一起使用的cert-manager

答案 1 :(得分:0)

当前不建议在Kubernetes上使用对Traefik的内置ACME支持,因为设置故障转移/冗余变得很困难。正如Rico提到的那样,证书管理器是一种更好的解决方案,并且是Traefik团队目前推荐的解决方案:)