首页 > 解决方案 > Enable HTTPS for Akka-Discovery Endpoints while forming akka-cluster in kubernetes environment

问题描述

I need to setup up an Akka-Cluster (using Akka Classic) in Kubernetes using DNS-resolver. I've created a headless-service which is able to resolve address for various pods of my Akka application. After DNS resolving, I'm able to get addresses for various pods. Now my Akka-Management runs over Https,

So while one pod tries connecting to management endpoints of various other pods, It needs to use "HTTPS" instead of "HTTP" but Akka by default uses "http". Is there a way to modify this behavior in Java

标签: akkaakka-httpakka-cluster

解决方案


是的,有:要启用 HTTPS,您必须通过向其提供HttpsConnectionContext对象来实例化您的服务器。

您可能应该执行以下操作:

Http.get(system).newServerAt("localhost", 8080)
    .enableHttps(createHttpsContext(system))
    .bind(app.createRoute());

前面的示例取自官方文档,其中也展示了该createHttpsContext(system)方法的工作原理。


推荐阅读