如何设置kubernetes持久环境变量

时间:2019-07-02 08:02:18

标签: kubernetes

我想将所有Pod(App)的版本保留在命名空间内的env中。所以我可以在yaml文件中使用它们来创建部署。甚至使用ci / cd也可以使开发更容易。

现在,开发人员必须在yaml文件中设置版本。

2 个答案:

答案 0 :(得分:1)

如果要在清单文件或yaml文件中使用环境变量,则只需使用kubernetes public static void main(String[] args) throws Exception { var sampleService = new SampleService(); var producer = Mono.fromSupplier(sampleService::call).cache( __ -> Duration.ofHours(24), //don't cache errors e -> null, //meh () -> null); try { producer.block(); } catch (RuntimeException e) { System.out.println("Caught exception : " + e); } sampleService.serverAvailable = true; var result = producer.block(); System.out.println(result); } secrets

可以在哪里存储环境并在部署期间使用它们。

答案 1 :(得分:0)

这与设计原则有关,这是适用于您的管道的理想方法。

您不必将所有Pod的exact版本保存在清单文件中,只需使用latest或类似环境的标记(例如staging或{{1 }})

在您的管道中,您可以根据您的构建使用相应的标记来修补部署。

此方法的一个示例:

production