A container image packages an application JAR for deployment as a Docker container. For an Akka service, the image also records the runtime base image and the ports that Kubernetes must reach. Building it locally places a versioned image in the local Docker repository; Kubernetes can then create pods from an image available to the cluster. section 13.2.1 section 15.4
Create the image after configuring Kubernetes-based cluster discovery and Akka Management. The management endpoint binds to port 8558 on 0.0.0.0 so readiness and liveness probes can reach it; 0.0.0.0 makes the service listen on every available host interface. section 13.2.1
version := "0.1.0-SNAPSHOT" #1 enablePlugins(JavaAppPackaging, DockerPlugin) #2 dockerExposedPorts := Seq(8558, 2552) #3 dockerBaseImage := "adoptopenjdk:11-jre-hotspot" #4
A minimal build enables Java application packaging and Docker support, assigns a version, exposes management and remote ports, and selects a Java 11 JRE base image. section 13.2.1
Build and publish an image in this order:
- Enable JavaAppPackaging and DockerPlugin, set dockerExposedPorts and dockerBaseImage, and give the project a version. section 13.2.1 section 15.3.2
- Run sbt docker:publishLocal to create a locally tagged image, or run the project publish task when preparing the betting-house deployment. section 13.2.1 section 15.3.2
- For an external registry, log in, tag the local image with the registry repository name, and push it so Kubernetes can obtain it. section 13.2.1
- Reference the image name in the Kubernetes deployment, alongside the service account, role binding, namespace, database, and other required cluster resources. section 13.2.1 section 15.4
Betting-house image
The betting-house service uses a Java 11 JRE base image and exposes ports for Akka Management, Akka Remote, entity services, and the bet-projection query. Its deployment.yml identifies the Docker image wrapping the application JAR; once the dependent database and cluster resources are ready, the deployment starts multiple pods from that image. section 15.3.2 section 15.4
The same application can run locally or in Kubernetes with nearly identical configuration. The notable cluster difference is local seed nodes versus Akka Cluster Bootstrap and Akka Management in Kubernetes; the image remains the deployment package for the JAR. section 15.4
























