Skip to content

Expose the control-plane API

What you will end up with

A reachable control-plane address on your workstation, verified against the health endpoints, ready for a CLI profile to point at.

Prerequisites

  • A deployed control plane whose rollout completed. See Deploy the control plane.
  • kubectl pointing at that cluster, and curl.
export CP_NS=xratu-cp
export CP_SERVICE=xratu-control-plane
export CP_PORT=8080

1. Confirm the Service exists

kubectl -n ${CP_NS} get svc ${CP_SERVICE}

The Service listens on port 8080 and is cluster-internal, so this confirms it exists rather than that you can reach it.

2. Forward a local port

kubectl -n ${CP_NS} port-forward svc/${CP_SERVICE} 18080:${CP_PORT} &
export CP_CLI_ENDPOINT="http://127.0.0.1:18080"

Running it in the background keeps your shell usable. The forward lives as long as that process does, so it ends when you close the terminal.

3. Record the in-cluster address separately

Your nodes need the address that works from inside the cluster, which is not the forwarded port. Set it now so that preparing an installation later does not silently inherit your local one:

export CP_ENDPOINT="http://${CP_SERVICE}.${CP_NS}.svc.cluster.local:${CP_PORT}"

Both variables now exist and mean different things: CP_CLI_ENDPOINT is for you, CP_ENDPOINT is for nodes. See Endpoint resolution.

Expected output

port-forward reports that it is forwarding from 127.0.0.1:18080 to the service port, and prints a line per connection it handles.

4. Verify it worked

All three health endpoints should answer through the forwarded port:

curl -fsS "${CP_CLI_ENDPOINT}/v1/system/health/startup"   >/dev/null && echo "startup ok"
curl -fsS "${CP_CLI_ENDPOINT}/v1/system/health/readiness" >/dev/null && echo "readiness ok"
curl -fsS "${CP_CLI_ENDPOINT}/v1/system/health/liveness"  >/dev/null && echo "liveness ok"

Read the readiness body, which reports the store the deployment is running and its finalization state:

curl -fsS "${CP_CLI_ENDPOINT}/v1/system/health/readiness" \
  | jq '{db_backend, store_profile, finalization}'

When it fails

connection refused on the forwarded port. The forward is not running. Check whether the background process is still alive and re-run it.

The forward starts, then drops repeatedly. The pod is restarting. Look at why:

kubectl -n ${CP_NS} get pods -l app=xratu-control-plane
kubectl -n ${CP_NS} logs deploy/xratu-control-plane -c api --tail=200

liveness answers but readiness returns 503. The process is running and failing a finalization invariant. The response names which one, and restarting will not change it. See Finalization invariants and fail-closed startup.

kubectl reports the Service was not found. Check the namespace, and that the apply in the previous step created all three objects.

Port 18080 is already in use. Forward a different local port and set CP_CLI_ENDPOINT to match. Nothing depends on that specific number.

What changed

Nothing in the cluster. A local port now forwards to the control-plane Service, and two environment variables record the two addresses you will use from here.

Next, point the CLI at it in Configure a CLI profile.