# Edge

> For the complete documentation index, see [llms.txt](https://docs-stg.ringleader.dev/llms.txt).


> An Edge is a small VM, in your cloud account or on your computer, that enforces hostname egress rules and adds injected credentials for your workstations.


An **Edge** resource declares one **edge instance**: a VM that Ringleader builds in your cloud
account, in one cloud and region, or, for hcs, vz and qemu workstations, on each member's own
computer. For when a workstation needs one, and how to declare it and delete it, see
[Edge management](https://docs-stg.ringleader.dev/security/outbound/edge-management/). This page lists its fields and what it reports.
[Workstations an Edge serves](https://docs-stg.ringleader.dev/security/outbound/edge-management/#workstations-an-edge-serves) says which workstations it serves.
[Access to a workstation behind an Edge](https://docs-stg.ringleader.dev/security/outbound/edge-management/#access-to-a-workstation-behind-an-edge) says how they stay reachable, and
[Edges for local workstations](https://docs-stg.ringleader.dev/security/outbound/edge-management/#edges-for-local-workstations) covers an Edge for hcs, vz and qemu.

```text
apiVersion: core.ringleader.dev/v1
kind: Edge
```

## Authors
Namespace administrators may create, read, update and delete Edges. An ordinary namespace
member cannot write one, because an edge instance is shared by every workstation in its
region, and it is a VM your organization pays for. In your own personal namespace, you are
the namespace administrator.

## The LLM setting

An Edge's `llm` setting counts the tokens your workstations spend on LLM providers such as
Anthropic, OpenAI and Google, including on calls a workstation makes with its own key or sign-in.
Only a cloud Edge counts calls. A namespace administrator sets it on the Edge:

```yaml
spec:
  llm:
    usage: true
    inspect: true
```

The Edge can count a call only when it decrypts it, and only to a host in the
[provider map](#the-provider-map), which is Ringleader's built-in list unless you change it.
`usage` and `inspect` are both off by default. Together they decide which calls the Edge counts:

| Setting | Calls the Edge counts |
|---|---|
| Neither | Calls to a built-in host, or to a host you list under `providers`, when the Edge adds an Integration's key to them. |
| `usage: true` | Those calls, and calls to a host in the provider map that an Integration rule with `inspect: true` has the Edge decrypt. |
| `usage: true` and `inspect: true` | Every call to a host in the provider map that a workstation behind the Edge makes, unless the host is [kept from being decrypted](#effects-of-inspection-on-a-workstation) for that workstation. |

With `inspect` on, the Edge decrypts the provider map's hosts for every workstation it serves, which
has [costs for each workstation](#effects-of-inspection-on-a-workstation).
`rl workstation describe` shows a `Decrypted` row for each of those hosts. From each response the
Edge keeps the token counts and the model's name, and no prompt or answer.

### Counted calls

The Edge counts a request that generates tokens, once the provider answers it successfully. On a
built-in host, that is a `POST` to one of these paths:

| Provider | Counted paths |
|---|---|
| `anthropic` | `/v1/messages` |
| `google` | A path that ends in `:generateContent` or `:streamGenerateContent`, `/v1beta/openai/chat/completions` and `/v1alpha/openai/chat/completions` |
| `openai` | `/v1/chat/completions`, `/v1/responses`, and `/backend-api/codex/responses`, which Codex calls when it is signed in with a ChatGPT account |
| `openrouter` | `/api/v1/chat/completions`, `/api/v1/messages` and `/api/v1/responses` |

A request to any other path on a built-in host, such as listing models, counting tokens or creating
embeddings, is not counted.

On a host you add, the Edge also counts a path that ends in one of its API's paths, such as
`/gateway/v1/messages` on a host with `api: anthropic`. It counts any other `POST` whose response
reports the tokens it used, too. Both hold whether you list the host under a built-in provider's name or
a name of your own.

The Edge also counts calls that a client makes over a WebSocket to the OpenAI Responses API, as
Codex does. It can read a WebSocket that is uncompressed or compressed with `permessage-deflate`. If
the client and the provider agree on another extension, the Edge counts one call with no tokens for
the whole connection. To prevent that, set `readableWebSockets: true` beside `inspect: true`. The
Edge then removes the other extensions from the client's request, so the provider cannot choose one.

Two kinds of call have no token counts:

- **A response the Edge cannot read counts from.** The Edge counts the request and no tokens.
- **A batch.** The provider runs a batch later, so its answer reports no tokens. The Edge does not
  count a batch that a workstation creates with its own key. Where the Edge adds the key, it refuses
  to create the batch and answers `403`. On a host you add, it refuses any `POST` to a path that ends in
  `/batches` or `:batchGenerateContent`, such as `/gateway/v1/messages/batches`.

### Counts in usage reports

`rl usage` adds the calls the Edge counts to the workstation's requests and tokens, beside the calls
that Ringleader's own model endpoint counts. [Usage report](https://docs-stg.ringleader.dev/reference/cli/commands/usage/)
describes the columns.

The counted tokens also use up the namespace's daily token limit,
[`maxIntegrationTokensPerDay`](https://docs-stg.ringleader.dev/reference/resources/namespace/#namespace-spec), if
the namespace has one. The Edge refuses no call over the limit, but Ringleader's model endpoint does.
A team that uses its own subscriptions heavily can therefore reach the limit and be refused on an
Integration with `source: ringleader` until the next UTC day.

Where the Edge adds the key, it can also count a call for the agent session that made it.
Agent sessions on one workstation can read each other's environment, so the split between them is a
best effort. [Cost of agent sessions](https://docs-stg.ringleader.dev/reference/cli/commands/usage/#cost-of-agent-sessions)
shows how to read it.

### Effects of inspection on a workstation

Ringleader gives each workstation a new certificate that also covers the provider map's hosts,
and delivers it to the workstation. A client that cannot trust the certificate, speaks only HTTP/2
or receives a response compressed with anything other than gzip fails on those hosts, as
[Requests to a named host](https://docs-stg.ringleader.dev/security/credentials/injection-effects/#requests-to-a-named-host)
describes.

To keep one host from being decrypted for a workstation, list it under `exclude` on an Integration
that reaches that workstation, as
[Exclude a host from decryption](https://docs-stg.ringleader.dev/security/credentials/host-inspection-exclusion/#exclude-a-host-from-decryption)
shows. To stop decrypting the built-in hosts for every workstation, turn the built-in list off with
`defaultProviders: false`. To keep decrypting some of them, also list those hosts under their own
provider, as [The provider map](#the-provider-map) shows.

`inspect` applies only to the workstations the Edge already serves, and it puts no workstation
behind the Edge. It also gives no workstation a new destination. A workstation whose egress policy
does not allow one of these hosts still cannot reach it, and the Edge does not decrypt that host
for it. Decrypting a host adds no request or response content to the Edge's
[records](https://docs-stg.ringleader.dev/security/outbound/connection-records/).

The edge instance applies `inspect` once it runs an edge build that reads the setting, and ignores
the setting until then. `proxy.version` in the Edge's status shows the build it runs.

The certificates of every workstation an Edge serves are published in one document of limited
size. When the certificates `inspect` adds would not fit, the Edge decrypts the setting's hosts for
no workstation, and the Edge's `status.message` says that the LLM inspection setting is held.
Credential injection and inspection rules from Integrations keep working.

### The provider map

The provider map lists the LLM hosts the setting covers, each under a provider name. This is
Ringleader's built-in list:

| Provider | Hosts |
|---|---|
| `anthropic` | `api.anthropic.com` |
| `google` | `generativelanguage.googleapis.com` |
| `openai` | `api.openai.com`, and `chatgpt.com`, which Codex calls when it is signed in with a ChatGPT account |
| `openrouter` | `openrouter.ai` |

To add hosts, list them under `providers`. A built-in provider name adds hosts to that provider.
Any other name declares a provider of your own, and its `api` says which API its hosts speak:
`openai`, the default, `anthropic` or `gemini`.

```yaml
spec:
  llm:
    usage: true
    inspect: true
    providers:
      team-gateway:
        hosts: [llm.example.com]
        api: anthropic
```

`defaultProviders: false` leaves the built-in hosts out of the map, so only the hosts you list are
covered. To cover some of the built-in hosts, list them under their own provider. This map covers
`api.openai.com` and no other host:

```yaml
spec:
  llm:
    usage: true
    inspect: true
    defaultProviders: false
    providers:
      openai:
        hosts: [api.openai.com]
```

A list you write does not grow. If Ringleader adds a host to a built-in provider in a later release,
add the host to your list yourself. While the built-in list is on, listing a built-in host under its
own provider changes nothing. The Edge still counts a call to a built-in host you leave out when it
adds an Integration's key to that call.

### Refused LLM settings

When you apply an Edge, its `llm` setting is refused if it:

- Sets `usage` or `inspect` on an Edge for hcs, vz or qemu workstations. Only a cloud Edge
  counts LLM calls. A `providers` list alone is accepted there.
- Sets `inspect` without `usage`, or `readableWebSockets` without `inspect`.
- Sets `usage` over an empty map, which is `defaultProviders: false` with no `providers`.
- Lists a provider with no hosts.
- Lists a host twice, or lists a built-in host under a provider other than its own.
- Brings the map past 32 hosts, counting the built-in hosts in it.
- Lists a host that is not a DNS name, such as a URL, a wildcard or an IP address.
- Names a provider with anything other than lowercase letters, digits and hyphens, or with more
  than 32 characters. A name starts with a letter and ends with a letter or a digit.
- Sets `api` on a built-in provider, or sets an `api` other than `openai`, `anthropic` or `gemini`.

## Spec fields
| Field | Notes |
|---|---|
| `provider` | **Required.** `gcp`, `aws` or `azure` for an edge instance in your cloud account, which is what most of this page describes. The local providers are covered in [Edges for local workstations](https://docs-stg.ringleader.dev/security/outbound/edge-management/#edges-for-local-workstations). |
| `region` | **Required** on a cloud. The region the VM runs in. Refused for a local provider. |
| `additionalRegions` | Other regions whose workstations this Edge serves. The VM still runs only in `region`. See [Additional regions](#additional-regions). |
| `zones` | GCP only. The zone the VM goes in. Ringleader uses the first entry, which must be in `region`. Empty places the VM in the first zone, by name, that the region's workstations run in. AWS and Azure ignore it and place the VM by `subnet`. |
| `machineType` | The VM's size. See [Machine type](#machine-type). |
| `subnet` | Where the VM goes, on AWS and Azure. No VM is built without it there. Refused on GCP. See [The subnet on AWS and Azure](#the-subnet-on-aws-and-azure). |
| `publicAddress` | Whether the VM takes a public address, on GCP and Azure. Refused on AWS. See [Public address and management ports](#public-address-and-management-ports). |
| `inboundManagement` | `false` turns off the management ports for the workstations it serves. See [Public address and management ports](#public-address-and-management-ports). |
| `cloudCheckInterval` | How often a settled edge instance re-reads its cloud objects. Default `10m`, from `1m` to `1h`. See [Cloud checks](#cloud-checks). |
| `maintenance` | When updates that interrupt the edge instance may run. See [Maintenance windows](#maintenance-windows). |
| `records` | What the Edge records beyond refused connections, credential use and daily totals, and for how long. `records.allowed: true` records every connection it lets through for every workstation it serves, and each of them then lists `allowed` in `status.egress.recorded`. `records.retention` keeps the Edge's records for 7 to 400 days instead of 90. Accepted on a cloud Edge and on an hcs, vz or qemu Edge. See [Connection records and traffic totals](https://docs-stg.ringleader.dev/security/outbound/connection-records/) and [Record retention](https://docs-stg.ringleader.dev/security/outbound/connection-records/#record-retention). |
| `llm` | Counting tokens on calls to LLM providers: `usage`, `inspect`, `readableWebSockets`, `defaultProviders` and `providers`. `usage`, `inspect` and `readableWebSockets` are accepted on a cloud Edge only. See [The LLM setting](#the-llm-setting). |

### Machine type

With no `machineType`, the VM takes the provider's default:

| Provider | Default | Arm (arm64) sizes |
|---|---|---|
| GCP | `e2-standard-2` | the `t2a`, `c4a`, `n4a` and `a4x` families |
| AWS | `m7i.large` | Graviton types, with a `g` after the generation digit (`m7g`, `c7g`, `t4g`, `m6gd`), and `a1` |
| Azure | `Standard_D2as_v5` | sizes with a `p` after the vCPU count, such as `Standard_D2ps_v5` |

The VM's architecture follows the size you name, and the VM runs Debian 13 either way. The
size is fixed when the VM is built, so changing `machineType` on a running Edge has no effect.
To change it, delete the Edge and declare it again.

On Azure, vCPU quota is granted per VM family, and the default size's family often has none.
The build then fails with Azure's own quota message on the Edge. Name a `machineType` in a
family your subscription already runs, or raise the quota.

### Additional regions

`additionalRegions` is never filled in for you. An administrator lists each region to accept
the [cost of extra regions](https://docs-stg.ringleader.dev/security/outbound/edge-management/#cost-of-an-edge), and each
cloud sets its own limits:

- GCP carries it within one VPC network, so the workstations in other regions must be in the
  same network.
- Azure carries it only over a global virtual network peering that you create, within one
  subscription. The Edge checks for the peering and records what it reaches in
  `status.reaches`.
- AWS refuses `additionalRegions`. Declare one Edge per region.

The VM is built only once a workstation in `region` itself needs it. With workstations only in
the additional regions, the Edge's message says to put one in `region`, or to declare the Edge
where the workstations are.

### The subnet on AWS and Azure

AWS and Azure route traffic through the edge instance by subnet, as
[Subnet ownership](https://docs-stg.ringleader.dev/security/outbound/edge-management/#subnet-ownership) explains. Name the
subnet your cloud onboarding reserved for the VM, not the subnet your workstations are in. A build
in the workstations' subnet is refused, and so is one in a different VPC or virtual network from
the workstations.

The VM cannot move once it is built. To put it in another subnet, delete the Edge and declare
it again.

GCP routes by network tag instead, so the VM needs no subnet of its own, and `subnet` is
refused there.

### Public address and management ports

The management ports described in
[Access to a workstation behind an Edge](https://docs-stg.ringleader.dev/security/outbound/edge-management/#access-to-a-workstation-behind-an-edge) are on by
default. Two fields change that:

| | GCP | Azure | AWS |
|---|---|---|---|
| **Neither field set** | Takes a public address when it first needs a management port, and keeps it until the Edge is deleted or rebuilt. | The same. | Always has a public address, because its subnet is public. |
| **`publicAddress: true`** | Always takes a public address, which also carries the VM's own outbound traffic instead of Cloud NAT. | No effect, and the Edge's message says it can be removed. | Refused. |
| **`publicAddress: false` or `inboundManagement: false`** | No public address and no management ports. | The same. | `inboundManagement: false` turns the ports off. `publicAddress` is refused. |

`inboundManagement: true` has no effect, and the Edge's message says it can be removed.
`inboundManagement: true` together with `publicAddress: false` is refused.

Setting either field to `false` on a running Edge turns the ports off, and the VM keeps any
address it already took until it is rebuilt. To drop the address, delete the Edge and declare
it again.

If your cloud refuses the address, for example because GCP's
`constraints/compute.vmExternalIpAccess` organization policy is enforced, the edge instance is
still built and still filters traffic. It records the refusal in
`status.externalAddressRefused` and tries again after 10 minutes. On GCP, a workstation with a
public address of its own stays held closed meanwhile, reporting `SteeringHeld`. Set
`inboundManagement: false` to route it with no management port.

### Cloud checks

Once an edge instance has settled, it re-reads its VM, firewall rules and routes every
`cloudCheckInterval`. A change made outside Ringleader, such as a deleted route, is noticed
within one interval. Each check spends calls against your cloud account's API rate limits. A
change Ringleader has to make is made immediately, whatever the interval.

`status.cloudCheck` records the last check. When a check fails partway, Ringleader tries it again
when `nextAt` passes, or sooner if something the edge instance is built from changes, such as its
spec or the workstations it serves. A change to a workstation that leaves those as they were does
not retry it. So a cloud that keeps refusing is called once per retry, not on every workstation
change.

### Maintenance windows

`maintenance` limits when two updates that interrupt the edge instance may run: a new edge
build, which restarts its filtering and drops open connections, and an update to Ringleader's
agent on the VM. Policy changes and repairs run whenever they are needed.

```yaml
spec:
  maintenance:
    timezone: Europe/Warsaw
    windows:
      - days: [Sat, Sun]
        start: "02:00"
        duration: 4h
    maxDeferral: 7d
```

| Field | Notes |
|---|---|
| `timezone` | An IANA time zone name. Default `UTC`. An offset such as `+02:00` is refused. |
| `windows[]` | **Required**, at least one. Leave out the whole `maintenance` block instead of giving an empty list. |
| `windows[].days` | Day names, short (`Sat`) or full. Empty means every day. |
| `windows[].start` | `"HH:MM"`, 24-hour. |
| `windows[].duration` | From `1h` to `7d`. |
| `maxDeferral` | The longest an update may wait for a window, at most `14d`. Without it, the limit your deployment sets applies, 14 days unless your operator changed it. |

An update that is waiting shows in `status.maintenance`, with the next window.

## Status fields
You never write `status`. These are the fields you are most likely to read:

| Field | Meaning |
|---|---|
| `message` | What is stopping the Edge from converging, or what it is doing. |
| `machine`, `zone`, `address` | The VM's name, zone and address inside your network. |
| `externalAddress` | The VM's public address, when it has one. |
| `builtArch` | The architecture the VM was built for. |
| `boxes[]` | The workstations it serves, each with its management port and anything holding it back. On a cloud Edge, it lists the first 250 by name, each with a SHA-256 digest of its certificate. |
| `boxCounts` | On a cloud Edge, counts of all its workstations, including the ones `boxes` leaves out. `total` counts them all, and `refused` counts those with a refused certificate or trust anchor. `cut` is `true` when `boxes` leaves some out. |
| `steeredSubnets` | The subnets it routes, on AWS and Azure. |
| `subnetHolds[]` | On AWS and Azure, subnets it does not route, each with what stops it: a VM it does not serve, or another Edge that routes the subnet. See [Subnet ownership](https://docs-stg.ringleader.dev/security/outbound/edge-management/#subnet-ownership). |
| `neighbours[]` | VMs in those subnets that it does not serve. |
| `health`, `proxy` | Whether the VM is filtering traffic, and which edge build it runs. |
| `recreate` | The times Ringleader replaced the VM. See below. |
| `drain` | The wait for the VM's last records before Ringleader deletes or replaces it. See [Final records before deletion](https://docs-stg.ringleader.dev/security/outbound/edge-management/#final-records-before-deletion). |
| `maintenance` | An update waiting for a window. |
| `cloudCalls` | Requests to your cloud and errors, hour by hour over the last day. |
| `cloudCheck` | The last time the edge instance called your cloud (`at`) and when it is next due to (`nextAt`). `attempt` is `true` when those calls stopped before they finished, for example on an error from your cloud. |

`proxy.desired` is the build this deployment ships, and `proxy.version` is what the running VM
reports. An empty `version` means **unknown**, not broken: an edge instance whose agent has
not reported yet shows it.

If the VM stops working in a way that a new VM can fix, such as when it stops forwarding
traffic or its agent goes silent, Ringleader replaces it. It does this up to three times in 24
hours, then stops and says so in the Edge's message.

`rl edge describe <name>` prints the message and the single-value fields. It then prints a
**Cloud calls** section, and a **Credential injection** section listing what the edge instance
is injecting for each Integration. When `boxes` leaves workstations out, a **Boxes** section gives
the total and how many have a refused certificate or trust anchor. `rl edge get <name> -o yaml`
shows every field, including `boxes`, `health` and `neighbours`.

### The `Ready` condition

`Ready` says whether the edge instance is working, and its reason names which part is missing.
Two reasons are `True`:

| Reason | Meaning |
|---|---|
| `Serving` | The VM is up, has confirmed the policy it was sent, and nothing wrong has been observed. |
| `ServingNoBoxes` | The same, and it serves no workstation at the moment. The VM keeps running, and billing, at the same address for the next workstation that needs it. Delete the Edge to stop paying for it. |

The rest are `False`:

| Reason | Meaning |
|---|---|
| `LocalVMPlacement` | An hcs, vz or qemu Edge. Read each workstation's `EgressEnforced` condition instead. |
| `NoMachine` | No VM has been built. The `message` says why: waiting for a workstation, a missing `subnet`, or a build refused by the cloud. |
| `NoAddress` | A VM exists and has no address in the network yet, so no traffic can be routed to it. |
| `AgentSilent` | The VM's agent has stopped reporting while other edge instances go on reporting. Until it reports again, the rest of the Edge's status shows what the VM said before it went silent. |
| `NotForwarding` | The VM reports it is not forwarding traffic, so every connection behind it is dropped. |
| `NotConfirmed` | The VM has confirmed no policy at all: its filter never loaded one, or refused the one it was given. |
| `ServingStale` | The VM has confirmed a **different** policy from the one it was sent, so it is enforcing an older one. |

### The `CloudCalls` condition

`CloudCalls` reports whether your cloud is answering the edge instance's requests. It is
`True` with `CallsAnswered`, or with `NoCloudCalls` for an Edge that has made none. It is
`False` with `CallsFailing`, and the message names the failing request. A failing request
does not by itself make `Ready` `False`.

### Missing build or settings

A cloud edge instance also needs two things from whoever runs Ringleader for your organization: an edge build
for the VM's architecture, and the settings the VM connects back with. Where one is missing, the
Edge is admitted and then waits with a message naming what is missing, and no VM is created.
When the missing piece is a build for the VM's architecture, a `machineType` of the other
architecture fixes it. Anything else is for whoever runs Ringleader for your organization.

## Cloud identity of an Edge

An edge instance is built with one of the `CloudIdentity` objects in its own namespace, and the
Edge has no field naming one. Ringleader picks it this way:

1. Among the identities for the Edge's `provider` that carry no `selector`, it picks the one
   with the highest `priority`. Equal priorities are broken by name, in ascending order.
2. If the namespace has no identity without a selector for that provider, it applies the same
   ordering to every identity the namespace holds for the provider, whatever their selectors.

A workstation resolves its identity differently: its own labels are matched against each
identity's `selector`. So an Edge and a workstation in one namespace can use different
identities.

Once an Edge has recorded an identity, it keeps it. Declaring another identity later does not
move a running edge instance onto it, because moving it would rebuild the VM and change the
address every workstation it serves points at. To move one, delete the identity it recorded.

`status.cloudIdentity` names the identity in use. `status.cloudIdentityReason` says which rule
chose it: `LabelFree` for the first rule, `SelectorFallback` for the second, and `Kept` for an
Edge holding the identity it started with.

An Edge never uses an identity that sets
[Restricted cloud identities](https://docs-stg.ringleader.dev/cloud-accounts/cloud-identities/restricted-identities/), because an Edge
has no owner to hold the `use` right. Both rules above skip such identities. If that leaves the
namespace no identity for the Edge's provider, the Edge is not built or updated until you add one
or remove `requireUse`. Deleting the Edge still deletes its VM with the identity that built it.

## Existing resources

Files of kind `EgressGateway` are still accepted. They address the same Edge resource, so
changing them to `kind: Edge` does not recreate the VM or discard its status. `rl edge get`
lists them.

## Next steps
- [Set up one Edge for two teams](https://docs-stg.ringleader.dev/guides/set-up-edge/): a step-by-step example in which one Edge adds a token for one team and gives each team its own allowlist.
- [Delete an Edge](https://docs-stg.ringleader.dev/security/outbound/edge-management/#delete-an-edge) and [Remove an Edge that stays in Terminating](https://docs-stg.ringleader.dev/security/outbound/edge-management/#remove-an-edge-that-stays-in-terminating): `rl edge force-delete` and `rl edge release-finalizer`.
- [Outbound restrictions](https://docs-stg.ringleader.dev/security/outbound/outbound-restrictions/): the `egress` policy an Edge enforces the hostname half of.
- [Injected credentials](https://docs-stg.ringleader.dev/security/credentials/injected-credentials/): adding a key to a workstation's requests at the Edge.
- [Workstation](https://docs-stg.ringleader.dev/reference/resources/workstation/#egressenforced-reasons): the `EgressEnforced` condition and every reason it reports.
- [CloudAccount](https://docs-stg.ringleader.dev/reference/resources/cloudaccount/): `sshSourceRanges`, which limits who can reach the management ports.
- [Cloud accounts](https://docs-stg.ringleader.dev/cloud-accounts/): the subnets each onboarding reserves for an Edge and the workstations it serves.
- [Roles and RoleBindings](https://docs-stg.ringleader.dev/reference/resources/roles/): the namespace administrator role.

