Skip to content

Commit 365a640

Browse files
committed
docs: document exposing a workload on multiple host ports
The workload service proxy now accepts a comma-separated list of host port entries, optionally pairing each host port with a specific service port by number or name. Each entry produces its own exposed service with its own URL in Omni. The label, prefix, and icon annotations gain per-host-port suffixed variants that override the unsuffixed one for a given host port. Shipping in Omni 1.8. See siderolabs/omni#2771 and siderolabs/kube-service-exposer#18. Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
1 parent 0d2f2fe commit 365a640

1 file changed

Lines changed: 38 additions & 8 deletions

File tree

public/omni/cluster-management/expose-a-workload-via-service-proxy.mdx

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,26 +136,56 @@ EOF
136136

137137
The following annotations control how a service is exposed through the workload proxy:
138138

139-
| Annotation | Required | Description |
140-
|---|---|---|
141-
| `omni-kube-service-exposer.sidero.dev/port` | Yes | The port to expose the service on. Must be unused on all nodes. |
142-
| `omni-kube-service-exposer.sidero.dev/label` | No | A human-readable name shown in the Omni left navigation. Defaults to `<service-name>.<service-namespace>`. |
143-
| `omni-kube-service-exposer.sidero.dev/prefix` | No | A fixed URL prefix. If not set, a random alphanumeric string is used. |
144-
| `omni-kube-service-exposer.sidero.dev/icon` | No | An icon displayed next to the service in the Omni left navigation. Accepts a base64-encoded SVG or a base64-encoded GZIP of an SVG. |
139+
| Annotation | Description |
140+
|---|---|
141+
| `omni-kube-service-exposer.sidero.dev/port` | **Required.** A comma-separated list of host port entries.<br/>Each entry is either a bare host port (e.g. `30080`) or a `host-port:service-port` pair<br/>where the service port is a port number or a port name (e.g. `30443:8080` or `30444:https`).<br/>Each host port must be unused on all nodes.<br/>The selected Kubernetes Service port must use the TCP protocol. |
142+
| `omni-kube-service-exposer.sidero.dev/label` | A human-readable name shown in the Omni left navigation.<br/>Defaults to `<service-name>.<service-namespace>`. |
143+
| `omni-kube-service-exposer.sidero.dev/prefix` | A fixed URL prefix.<br/>If not set, a random alphanumeric string is used. |
144+
| `omni-kube-service-exposer.sidero.dev/icon` | An icon displayed next to the service in the Omni left navigation.<br/>Accepts a base64-encoded SVG or a base64-encoded GZIP of an SVG. |
145+
146+
When the bare host port form is used, the entry maps to the first port defined on the Service. To select a specific service port on a Service that defines several, use the `host-port:service-port` form.
145147

146148
To encode an SVG icon for use with the annotation:
147149

148150
```bash
149151
gzip -c icon.svg | base64
150152
```
151153

154+
### Exposing multiple host ports
155+
156+
A single Service can be exposed on multiple host ports by listing several entries in the `port` annotation. Each entry produces its own exposed service with its own URL in Omni.
157+
158+
A common case is a workload that serves a user-facing UI on one port and a Prometheus metrics endpoint on another. For example, given a Service that defines port `8080` (named `http`) and port `9090` (named `metrics`):
159+
160+
```yaml
161+
metadata:
162+
annotations:
163+
omni-kube-service-exposer.sidero.dev/port: "30080:http,30090:metrics"
164+
```
165+
166+
The `label`, `prefix`, and `icon` annotations accept per-host-port suffixed variants in the form `<base>-<host-port>`. The suffixed variant wins for that host port, and the unsuffixed annotation is used as a fallback for any host port that does not have a suffixed variant set.
167+
168+
```yaml
169+
metadata:
170+
annotations:
171+
omni-kube-service-exposer.sidero.dev/port: "30080:http,30090:metrics"
172+
omni-kube-service-exposer.sidero.dev/label: My App
173+
omni-kube-service-exposer.sidero.dev/label-30090: My App (metrics)
174+
omni-kube-service-exposer.sidero.dev/prefix-30080: my-app
175+
omni-kube-service-exposer.sidero.dev/prefix-30090: my-app-metrics
176+
```
177+
178+
When the unsuffixed `prefix` annotation is set on a service exposed on multiple host ports, it is claimed by the lowest host port. Other host ports get an automatically generated alias derived from it, so there is no duplicate-prefix conflict.
179+
180+
Bad or duplicate entries in the `port` annotation are skipped individually rather than failing the whole annotation. Check `omnictl get exposedservices` for any per-entry errors.
181+
152182
## Access an exposed service
153183

154-
Once annotated, the service will appear under **Exposed Services** in the left navigation when the cluster is selected. Click the service name to open it in Omni.
184+
Once annotated, the service will appear under **Exposed Services** in the left navigation when the cluster is selected. A Service exposed on multiple host ports shows up as one entry per host port. Click the service name to open it in Omni.
155185

156186
<img src="./images/expose-an-http-service-accessing-exposed-service.png" alt="Exposed services in the Omni left navigation" width="500" />
157187

158-
The service URL will use either the randomly generated prefix or the value of the `omni-kube-service-exposer.sidero.dev/prefix` annotation if set.
188+
The service URL uses the suffixed `prefix-<host-port>` annotation if set, otherwise the unsuffixed `prefix` annotation, otherwise a randomly generated prefix. For a service exposed on multiple host ports, the unsuffixed `prefix` only applies to the lowest host port, and the other host ports get an automatically generated alias derived from it.
159189

160190
## Examples: exposing cluster tools with the workload proxy
161191

0 commit comments

Comments
 (0)