0

我打算在 kubernetes 中使用 traefik 作为我的入口控制器。我看到单独运行时,您可以自己定义入口点。我想知道我是否可以在 Kubernetes 中做同样的事情。基本上我想在 kubernetes 中定义一种这样的配置以及它会是谁。

[entryPoints]
   [entryPoints.http]
   address = ":80"
     [entryPoints.http.redirect]
       entryPoint = "https"
   [entryPoints.https]
   address = ":443"
     [entryPoints.https.tls]
       [[entryPoints.https.tls.certificates]]
       CertFile = "integration/fixtures/https/first.com.cert"
       KeyFile = "integration/fixtures/https/first.com.key"
   [entryPoints.https]
   address = ":444"
     [entryPoints.https.tls]
       [[entryPoints.https.tls.certificates]]
       CertFile = "integration/fixtures/https/second.com.cert"
       KeyFile = "integration/fixtures/https/second.com.key"       

然后将不同的后端关联到我的不同入口点。

4

1 回答 1

-1

Every Traefik configuration consists of two parts: A static and a dynamic one. The former can be provided through multiple means, such as command-line arguments or a configuration file. The latter is updated dynamically, with the concrete implementation being dependent to the specific provider involved.

Since the entry points are part of the static configuration, all you need to do is pass them in a format suitable to your needs. For instance, if you wanted to use a configuration file, just store the TOML configuration you have given in your question into a file and pass it to Traefik via the --configfile switch. (On Kubernetes, chances are you want to do that through a ConfigMap object.)

The complete documentation for the TOML file is given here. Supposedly, you'd be mostly interested in the parts that may apply to all providers (i.e., everything above the Configuration backends heading) and the Kubernetes backend section.

于 2017-06-05T19:15:54.263 回答