Skip to content

Readiness, handshake, and endpoint re-resolution

A kernel pod can be running before its kernel is ready, and it can be replaced by another pod at a new address at any time. The node therefore trusts a kernel only after a handshake it has validated, and it finds the kernel by resolving its Service again rather than remembering an address. This page covers what a handshake must prove, which answers mean wait and which mean stop, and how the node re-resolves an endpoint after a break.

From Service to trusted kernel

flowchart TB
  SVC["Service service_ref<br/>EndpointSlices, then Endpoints"]
  SEL{{"Ready endpoints, sorted;<br/>pick sha256(runtime_instance_id) mod n"}}
  TLS{{"mTLS: trust bundle chain,<br/>SPIFFE ID equals provisioned"}}
  HS{{"Handshake response valid?"}}
  OK["Runtime session recorded,<br/>return lane resumed"]
  W["Wait and retry<br/>startup_not_ready"]
  X["Stop<br/>terminal refusal"]
  SVC --> SEL --> TLS --> HS
  HS -->|"accepted"| OK
  HS -.->|"not yet ready"| W
  HS -.->|"identity, fence, trust"| X
  W --> SEL

Each step can fail on its own and says why: no ready endpoint, a certificate for the wrong runtime, a kernel still starting, or a kernel that refuses the node. A terminal refusal stops the node; every other failure brings it back to the Service on a later attempt.

What an accepted handshake must carry

The node validates an accepted handshake before it records the runtime:

  1. startup: the kernel's startup evidence, valid against kernel.startup_evidence.v1.
  2. protocol_version: kernel.grpc_control.v1.
  3. kernel_version, kernel_profile and runtime_image_digest, all present.
  4. supported_operations: exactly the ten operator commands, in order.
  5. identity_proof: the dp_node_id and mtls_peer_identity the kernel authenticated.
  6. trust_evidence: the trust_bundle_digest and revision, the same authenticated identity as identity_proof, and the same protocol version, kernel version, profile and image digest as the response.

A handshake that is accepted but misses any of these is treated as refused:

kernel handshake accepted response requires startup evidence
kernel handshake accepted response requires canonical supported_operations
trust_evidence.runtime_image_digest must match handshake runtime_image_digest

The startup evidence lists verified_runtime_closures: for each closure the kernel opened and admitted, its runtime_closure_digest, verified_view_digest and the view. See Verified closure view.

Wait or stop

Answer Meaning The node
accepted The kernel accepted the node and is ready Records the runtime
startup_not_ready, or a reason startup declared The kernel is still starting Waits and handshakes again
startup_evidence_incomplete Startup reported an incomplete record Waits and handshakes again
protocol_mismatch The kernel speaks another protocol version Retries with backoff; persisting means the kernel image and the node disagree
malformed_request The request failed the kernel's validation Retries with backoff; persisting means the node's request is invalid
ownership_rejected The ownership does not match the runtime's Retries with backoff; the kernel's stale_fence or non-owner answer ends it
peer_identity_rejected The certificate does not match dp_node_id Stops
trust_bundle_digest mismatch Node and kernel hold different trust bundles Stops
kernel_transport_* The call did not complete Retries with backoff

The retry rules are on Detecting a kernel link break.

Re-resolving the endpoint

After any transport failure the node forgets the address and resolves the Service again:

  1. Read the Service's EndpointSlices by the label kubernetes.io/service-name=<service_ref>, or its Endpoints when it has none.
  2. Keep only ready endpoints, using the port named kernel-grpc-control, 7777 by default.
  3. Sort by pod name, address and port, and pick the endpoint at sha256(runtime_instance_id) mod count.
  4. Handshake again with the same identity and fence, then resume the return lane from the last acknowledged sequence.

The same runtime picks the same pod while the set of ready pods is unchanged, and moves to another pod when its pod goes away. The endpoint record names source (endpointslice or endpoints), selected_pod, selected_node, endpoint_count and ready_endpoint_count; endpoint_count above 0 with ready_endpoint_count 0 means the pods exist and none is ready.

To see what the node sees:

NAMESPACE=acme-projects
SERVICE=support-agent-v3
kubectl -n "$NAMESPACE" get endpointslices -l kubernetes.io/service-name="$SERVICE" -o wide

Set NAMESPACE and SERVICE to the runtime deploy contract's namespace and service_ref.