【发布时间】:2018-07-02 12:07:04
【问题描述】:
我正在玩 Spring Cloud Data Flow。我已经使用相关的documentation 在 Kubernetes 上成功部署了 SCDF。注册1.5.x based starter apps 时,一切都按预期工作,在部署流定义期间不需要进一步配置启动应用程序。
使用2.x based starter apps 时,切换到 Spring Boot 2.0 引入了一些需要适应的变化,例如执行器端点发生了变化。作为参考,以下是我在部署流期间提供的属性:
app.*.management.endpoints.web.exposure.include=health,info,binders
deployer.*.cpu=2
deployer.*.memory=4096
deployer.http.count=2
deployer.*.kubernetes.livenessProbePath=/actuator/health
deployer.*.kubernetes.readinessProbePath=/actuator/info
但是,就绪探测失败,因为health 和info 端点现在似乎默认受到保护。因此,pod 最终会陷入崩溃循环,因为从 Kubernetes 的角度来看,它们永远不会准备好。
我按照我的流定义所依赖的patching the starter apps 上的指南(例如throughput sink)解决了这种情况,如下所示:
@SpringBootApplication
@Import({org.springframework.cloud.stream.app.throughput.sink.ThroughputSinkConfiguration.class})
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@Configuration
protected static class ThroughputSinkSecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.requestMatchers(EndpointRequest.to("health", "info")).permitAll();
}
}
}
有没有办法通过标志或属性来指定这种安全配置?默认情况下不应该有这样的WebSecurityConfigurerAdapter 以使health 和info 端点可供Kubernetes 访问吗?
【问题讨论】:
标签: java spring-boot kubernetes spring-cloud-stream spring-cloud-dataflow