Search code examples
akkaakka-httpakka-cluster

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


Solution

  • Yes, there is: to enable HTTPS, you have to instantiate your server by providing an HttpsConnectionContext object to it.

    You should probably do something like:

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

    The previous example is taken from the official documentation, which also shows how the createHttpsContext(system) method works.