2017-06-05 46 views
0

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

[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"  

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

回答

0

每个Traefik配置由two parts组成:一个静态和动态的配置。前者可以通过多种方式提供,例如命令行参数或配置文件。后者是动态更新的,具体实现依赖于特定的提供者。

由于入口点是静态配置的一部分,因此您所需要做的就是以适合您需求的格式传递它们。例如,如果您想使用配置文件,只需将您在问题中提供的TOML配置存储到文件中,然后通过--configfile开关将其传递给Traefik。 (在Kubernetes,机会是你想要做的是通过ConfigMap对象。)

为TOML文件的完整文档中给出here。假设您主要对可能适用于所有提供商的部分感兴趣(即标题后面的所有内容标题)和Kubernetes后端部分。