Shared knowledge · Beginner → Advanced · Language-neutral

Choose a CoAkka Runtime deployment shape

CoAkka Runtime lives inside the app host. The platform and application supply identity, network policy and a route snapshot at startup; the language connector maps them into Core's shared contract. App hosts can connect directly. CoAkka Runtime is infrastructure-independent; Kubernetes is an optional deployment projection, not a platform that owns or locks the product contract.

Run the device, Docker or Kubernetes exercise.

01 · Shared contract

Build one image; assign identity at runtime

These five lines apply to containers, VMs, bare metal and edge. They are not a language-specific configuration schema.

systemName        planned by people for the service or system
nodeId            assigned by the platform to each running process
network mode      startup policy: EMBEDDED, OUTBOUND_ONLY, NETWORK_NODE
bind / advertise  needed only when peers must reach this process
route endpoints   supplied by deployment config, discovery or a control plane

CoAkka Runtime Core does not read environment variables, Kubernetes metadata, DNS or ConfigMaps by itself. The app host reads a config source, the connector validates and maps it into a start spec and route snapshot, and Core accepts or rejects the submitted contract.

02 · Direct distributed

Two app hosts can connect without Kubernetes

In this example, checkout only calls outward, so it uses OUTBOUND_ONLY. Each billing process accepts peer requests, so it uses NETWORK_NODE, binds a local listener and advertises an address checkout can actually reach.

checkout
  mode       OUTBOUND_ONLY
  target     billing.charge
  endpoint   billing-a.internal
  port       19301
  endpoint   billing-b.internal
  port       19301

billing-a
  mode       NETWORK_NODE
  advertise  10.20.0.11
  port       19301

billing-b
  mode       NETWORK_NODE
  advertise  10.20.0.12
  port       19301

CoAkka Runtime owns

Listeners, peer transport, route selection, correlation, bounded failover, TLS/mTLS context and structured outcomes.

The app host / topology owner supplies

Identity, bind/advertise values and route snapshots from static config, files/environment, private DNS, a registry or a control plane.

This is not a self-organizing cluster. CoAkka Runtime does not discover peers, manage membership, elect a leader or run consensus. An OS, container or device supervisor manages processes; the topology owner publishes generation-based snapshots.

See the complete two-peer billing, failover and rollout example.

03 · Edge / bare metal

Choose the smallest network mode that fits

Embedded

No listener and local handlers only. Use it for one process, desktop/mobile, tests and on-device work.

Outbound only

No listener, but remote routes are allowed. Use it when an edge device or client should not accept inbound traffic.

Network node

Uses an explicit bind endpoint and advertises the address peers call. Choose it only when the service or device must be directly reachable.

04 · Optional Kubernetes

Project the same contract into Kubernetes when needed

Kubernetes supplies scheduling, process lifecycle, identity and an address source. It is not on the required contract path between CoAkka Runtime peers and does not change target, route or outcome semantics.

Every replica uses the same image. A pod name is usually a practical nodeId; use the pod UID when identity must not be reused after restart or rescheduling. These environment names are an app-host convention, not variables that Core reads automatically.

Pod env fragment
env:
  - name: COAKKA_SYSTEM_NAME
    value: billing
  - name: COAKKA_NODE_ID
    valueFrom:
      fieldRef:
        fieldPath: metadata.name
  - name: COAKKA_BIND_HOST
    value: "0.0.0.0"
  - name: COAKKA_BIND_PORT
    value: "19301"
  - name: COAKKA_ADVERTISE_HOST
    valueFrom:
      fieldRef:
        fieldPath: status.podIP
  - name: COAKKA_ADVERTISE_PORT
    value: "19301"

The app host reads these values once at process startup. The connector selects NETWORK_NODE when the pod accepts inbound traffic, then maps discovery or control-plane data into remote route endpoints. A live route change is a full snapshot with a newer generation, not a series of partial mutations.

See the service configuration in the Kubernetes lab.

05 · Address ownership

Bind, advertise and route answer different questions

Network bind
The local interface and port, such as 0.0.0.0:19301. An invalid bind fails startup instead of silently widening exposure.
Network advertise
The concrete address peers use to reach this process. It must not be a wildcard.
Remote route endpoint
The destination's advertised address: private DNS/IP, Service DNS, a pod endpoint or registry/control-plane data.
Local route endpoint
A handler in this process. It uses port 0 and owns no listener.
Direct peer DNS:     billing-a.internal:19301
Direct private IP:  10.20.0.11:19301
Kubernetes Service: billing.default.svc.cluster.local:19301
Per-pod endpoint:    billing-0.billing.default.svc.cluster.local:19301
Local handler:       port 0 + LOCAL

Direct DNS/IP lets CoAkka Runtime see a specific peer. With Service DNS, Kubernetes selects a replica. With per-pod endpoints, the route snapshot sees each replica. This is a platform topology decision, not a default inferred by CoAkka Runtime.

06 · Owners and lifecycle

Configuration goes down; effective state comes back up

Platform + app host

Own topology, discovery, identity, config sources, authorization, credential policy, ingress and business retry.

Connector

Map platform config into CoAkka Runtime types, keep boundary lifetimes safe and project Core state into language-native values.

CoAkka Runtime Core

Own accepted route apply, delivery, correlation, bounded queues, deadletters, lane state, health and lifecycle.

  1. Read platform configuration and identity.
  2. Build one start spec, one network policy and one complete route snapshot.
  3. Start CoAkka Runtime; fail closed when bind or contract validation fails.
  4. Read effective configuration, health and generation back from Core.
  5. On shutdown: stop new ingress, finish allowed work, close File/Stream Lane owners, then close the host from its creator.

A sidecar is not a published deployment mode. CoAkka Runtime is currently embedded in the app host. Kubernetes is supported but not required, and it does not move service discovery into Core.