---
title: "Network and TLS"
description: "Reach endpoints from outside through your Gateway or Ingress, turn on in-cluster TLS per endpoint, and close the network with NetworkPolicies and leader isolation."
url: "https://opod.io/docs/control-plane-security/network-tls/"
markdown_url: "https://opod.io/docs/control-plane-security/network-tls.md"
section: "Security"
last_updated: "2026-10-30"
---

# Network and TLS

> Reach endpoints from outside through your Gateway or Ingress, turn on in-cluster TLS per endpoint, and close the network with NetworkPolicies and leader isolation.

## In short

Inside the cluster, endpoints serve plain HTTP by default, and your Gateway or Ingress terminates TLS at the edge with your certificate. Give the chart a host pattern and the control plane renders one route per endpoint. If the pod network is not a trust boundary, turn on TLS per endpoint. To close the network, turn on the chart's NetworkPolicies, and leader isolation for endpoints with front doors.

## When you need it

- Clients outside the cluster must reach an endpoint: set `endpoints.expose` and a host pattern.
- Policy requires encryption inside the cluster: `endpoints.tls.embedded=true`.
- Your CNI denies traffic by default (Cilium, for example): `networkPolicy.enabled=true`.
- Only an endpoint's own pods may reach its leader's join port: `networkPolicy.leaderIsolation.enabled=true`.

## Do it

1. **Publish every endpoint on a host name**

   ```bash
   helm upgrade opodcp oci://ghcr.io/opod-io/charts/opodcp -n opodcp --reset-then-reuse-values \
     --set endpoints.expose=ingress \
     --set endpoints.ingress.host='{endpoint}.{cell}.example.com' \
     --set endpoints.ingress.className=nginx \
     --set-string endpoints.ingress.annotations.cert-manager\\.io/cluster-issuer=letsencrypt
   ```

   The endpoint `chat` in cell `prod-east` is then `https://chat.prod-east.example.com`. `endpoints.expose` is new in 0.3.0; on 0.2.1 leave that line out: a class and a host render the Ingress.

2. **Turn on TLS inside the cluster, if you need it**

   ```bash
   helm upgrade opodcp oci://ghcr.io/opod-io/charts/opodcp -n opodcp --reset-then-reuse-values --set endpoints.tls.embedded=true
   ```

   Then roll out each endpoint, so the leader and workers restart onto the certificate.

3. **Check that your cluster enforces NetworkPolicies**

   ```bash
   opodcp preflight --kubeconfig ~/.kube/config     # read the network.policy row
   ```

   `not enforced` means a policy changes nothing on this cluster. Stop here, or install a CNI that enforces them.

4. **Turn on the policies**

   ```bash
   helm upgrade opodcp oci://ghcr.io/opod-io/charts/opodcp -n opodcp --reset-then-reuse-values \
     --set networkPolicy.enabled=true --set networkPolicy.leaderIsolation.enabled=true
   ```

   On a managed Kubernetes, also name the API server's addresses in `networkPolicy.leaderIsolation.from` (example below).

## Check it worked

```bash
curl -s -H "$H" https://cp.example.com/api/v1/endpoints | jq -r '.[] | [.name, .publicUrl, .tlsFingerprint] | @tsv'
kubectl -n opodcp get networkpolicy -l opod.io/role=leader-policy \
  -o custom-columns=NAME:.metadata.name,STATE:.metadata.annotations.opod\\.io/leader-isolation
```

A good answer: each endpoint has a `publicUrl`, and a `tlsFingerprint` when embedded TLS is on. Each fronted endpoint's policy reads `isolated`; one without doors reads `open`. From a pod without the endpoint's labels, `curl -m 5 http://opodcp-ep-<name>:8080/healthz` times out. Doctor's `north-tls` and `leader-isolation` rows say the same.

## If it fails

| Symptom or code                                     | Cause                                                                                          | Fix                                                                                           |
| --------------------------------------------------- | ---------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| No `publicUrl`                                      | no host pattern is set, or `expose` is `none`, or `auto` found no Gateway and no Ingress class | set `endpoints.ingress.host` and a class, or a Gateway                                        |
| `E-GATEWAY-NOT-READY`                               | `expose: gateway` and no Gateway is Programmed                                                 | fix the Gateway, or `expose: auto`                                                            |
| Every leader policy reads `open`                    | no front doors on the endpoints, or nothing names the API server's source                      | turn on `plan.gateways`; name the source in `from`                                            |
| Rollouts fail at `probe` after isolation            | the API server's source is wrong, so the control plane's calls are cut                         | name the right `ipBlock` in `from`; on Cilium set `policy-cidr-match-mode` to include `nodes` |
| Prometheus stops scraping leaders                   | the scraper is not in `from`                                                                   | add its namespace and pod labels to `from`                                                    |
| `from` seems ignored                                | it does not parse, so nothing is closed                                                        | fix the YAML; doctor's `leader-isolation` row shows the error                                 |
| Requests through nginx fail once embedded TLS is on | nginx speaks HTTP to an HTTPS leader                                                           | add `nginx.ingress.kubernetes.io/backend-protocol: HTTPS`                                     |

## TLS: yours at the edge, off inside

An endpoint's leader serves **plain HTTP inside the cluster** by default. The pods, the workers and the control plane are all on your network; the hop that leaves it is yours to terminate, at your gateway, with your certificate. Commands from a leader to its workers are HMAC-signed whatever the transport.

### Reach endpoints from outside

Give a host pattern; the control plane then renders **one route per endpoint**:

```yaml
endpoints:
  expose: auto                                  # auto · gateway · ingress · none
  gateway: { name: public, namespace: gateways } # "" = the one Programmed Gateway in the cluster
  ingress:
    host: "{endpoint}.{cell}.example.com"
    className: nginx
    tlsSecret: ""                               # or cert-manager through annotations
    annotations: { cert-manager.io/cluster-issuer: letsencrypt }
```

`endpoints.expose` and `endpoints.gateway` are new in 0.3.0. In 0.2.1 the control plane renders an `Ingress` per endpoint when `endpoints.ingress.className` and `.host` are set, and nothing otherwise.

| `endpoints.expose` | Renders                                                                                                                          |
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
| `auto` (default)   | an `HTTPRoute` on your Programmed Gateway when one exists, else an `Ingress` through `endpoints.ingress.className`, else nothing |
| `gateway`          | an `HTTPRoute`; every endpoint apply is refused `E-GATEWAY-NOT-READY` while no Gateway is Programmed, and so is the install      |
| `ingress`          | an `Ingress`                                                                                                                     |
| `none`             | no route                                                                                                                         |

No host, no route, whatever `expose` says. The control plane never creates your Gateway. The endpoint then carries `publicUrl`: `https://` when a TLS Secret or a cert-manager issuer is set, `http://` when the class terminates nothing. Preflight's `endpoints.expose` row and the doctor's `north-tls` row say which route was chosen and why.

**A route to a leader that serves TLS** (`endpoints.tls.embedded: true`; from 0.3.2). The leader then answers https on 8080, so the route must speak TLS to it and check its certificate. The control plane renders that beside the route:

| Route                          | What it adds                                                                                                                                                                                                                | When the cluster cannot                                  |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
| `HTTPRoute`                    | a `BackendTLSPolicy` (Gateway API v1.4 `v1`, or `v1alpha3` on v1.2–v1.3) that trusts the endpoint's certificate, from ConfigMap `opodcp-ep-<name>-<id6>-backend-ca`, and checks the name `opodcp-ep-<name>.<namespace>.svc` | no `BackendTLSPolicy` served: no route for that endpoint |
| `Ingress`, ingress-nginx class | `backend-protocol: HTTPS`, `proxy-ssl-verify: on`, `proxy-ssl-name` and `proxy-ssl-secret` (a Secret with the certificate only, never the leader's key); a value you set in `endpoints.ingress.annotations` stays           | —                                                        |
| `Ingress`, any other class     | nothing: set your controller's backend-protocol annotation in `endpoints.ingress.annotations` (a key ending `/backend-protocol`)                                                                                            | no such annotation: no route for that endpoint           |

With `expose: gateway` or `expose: ingress` an endpoint that cannot be routed is refused `E-NORTH-BACKEND-TLS`, and so is the install. With `auto` it gets no route and no `publicUrl`, and the doctor's `north-tls` row says why. On 0.3.0 the route sends plain HTTP to the TLS port and the endpoint does not answer through it.

The console's own route is separate: `ingress.enabled`, `ingress.className`, `ingress.host`, `ingress.tls`, or `ingress.gateway.*` for an `HTTPRoute`.

### Turn on TLS inside the cluster

Where the pod network is **not** a trust boundary (a cluster shared between tenants), or where policy asks for encryption inside the perimeter:

```bash
helm upgrade opodcp … --reset-then-reuse-values --set endpoints.tls.embedded=true
```

The control plane then mints a self-signed certificate per endpoint into its auth Secret (`tls.crt`, `tls.key`). The leader serves HTTPS on 8080, workers trust exactly that certificate, and the control plane proxies as `https`. The endpoint carries `tlsFingerprint` (SHA-256) and `tlsNotAfter`; a client pins the fingerprint or trusts `tls.crt`.

| Value                     | Default | Meaning                                                                                                       |
| ------------------------- | ------- | ------------------------------------------------------------------------------------------------------------- |
| `endpoints.tls.embedded`  | `false` | mint a certificate per endpoint                                                                               |
| `endpoints.tls.certDays`  | `3650`  | validity of a minted certificate                                                                              |
| `endpoints.tls.renewDays` | `30`    | a rollout re-mints a certificate within this many days of expiry, and restarts the leader and workers onto it |

Nothing re-mints without a rollout, and the fingerprint changes when one does. The alert-rule metric `endpoint.cert_expiry_days` says when a rollout is due. An endpoint pinned to an older leader image keeps plain HTTP until a rollout re-pins it; the advisory `leader-tls` says so. Behind nginx with embedded TLS on, add `nginx.ingress.kubernetes.io/backend-protocol: HTTPS` to the annotations.

## NetworkPolicies

On a default-deny CNI, nothing in the namespace can talk until a policy says so, and worker-to-leader join breaks first.

`networkPolicy.enabled=true` renders the policies that keep the install working: ingress on 8080 and 8081 into our pods, egress open for DNS, registries and model hubs. With the cell door on, the door gets its own. With the KV store on, only this release's workers and control plane may reach it.

**First check that anything enforces them.** Every cluster accepts a NetworkPolicy, whether or not any rule follows from it. Preflight's `network.policy` row and the doctor's `network-policy` row say *enforced* (naming the CNI), *not enforced* (flannel alone, the AWS VPC CNI without its policy agent, k3s with `--disable-network-policy`) or *unknown*. Prove it per node: run a pod, confirm it reaches a ClusterIP, apply a policy with `policyTypes: [Egress]` and `egress: []`, and check that it is cut off.

## Leader isolation

The join token between a leader and its workers is a shared secret. What keeps a pod that is not part of an endpoint away from the leader's port is the network.

```bash
helm upgrade opodcp … --reset-then-reuse-values --set networkPolicy.leaderIsolation.enabled=true
```

The control plane then renders one NetworkPolicy per endpoint (`<endpoint>-leader`, owned and removed with it). The leader accepts its own endpoint's pods, the API server (every control-plane call to a leader rides the API server's Service proxy), the autoscaler when the adapter is `keda`, and the peers you name. Nothing else.

| Value                                    | Default                                                    | Meaning                                                                                            |
| ---------------------------------------- | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
| `networkPolicy.leaderIsolation.enabled`  | `false`                                                    | render the per-endpoint policies                                                                   |
| `.detectAPIServer`                       | `true`                                                     | read where the API server's connections come from off the control-plane Node objects               |
| `.from`                                  | `[]`                                                       | more peers, spelled as a NetworkPolicy spells them: a Prometheus, a managed API server's addresses |
| `.scaler.namespace`, `.scaler.podLabels` | release namespace, `app.kubernetes.io/name: keda-operator` | where the external autoscaler runs                                                                 |

```yaml
networkPolicy:
  leaderIsolation:
    enabled: true
    from:
      - ipBlock: { cidr: 198.51.100.0/28 }                            # a managed API server
      - namespaceSelector: { matchLabels: { kubernetes.io/metadata.name: monitoring } }
        podSelector: { matchLabels: { app.kubernetes.io/name: prometheus } }
```

Three things to know:

1. **It closes a port, not a path.** A leader serves `/v1` and its join route on one port. Only an endpoint **with front doors** can be isolated: clients call the doors, and the leader leaves the front Service. An endpoint without doors gets a policy that says `open` and why, in its `opod.io/leader-isolation-reason` annotation.
2. **A managed control plane shows no node.** With nothing detected and nothing named, every policy stays open rather than cut the control plane off from its leaders. Name the API server's source in `from`. On Cilium, an `ipBlock` matches no node unless `policy-cidr-match-mode` includes `nodes`.
3. **`from` is read strictly.** An unknown field is refused, because a misspelt selector would otherwise be an empty one, which means every pod. Nothing is closed until the list parses.

The doctor's `leader-isolation` row reports every endpoint's state. To verify one: from a pod without the endpoint's labels, `curl -m 5 http://opodcp-ep-<name>:8080/healthz` must time out, and the same call from one of its workers must answer.

## Ports a leader listens on

| Port | Scheme                                      | Carries                                                 |
| ---- | ------------------------------------------- | ------------------------------------------------------- |
| 8080 | HTTP, or HTTPS with embedded TLS            | the OpenAI API and the workers' join route              |
| 8081 | always plain HTTP                           | `/healthz`, `/readyz`, `/loadz`, `/metrics` (read-only) |
| 8082 | plain HTTP, only on an InferencePool member | the whole API, admitted only to your Gateway's proxies  |
