Networking
How traffic moves in NebulaCtrl. Internal service hostnames, environment isolation, domains and certificates, Tailscale exposure, edge clusters and the WireGuard mesh.
Traffic reaches a service from three directions: other services in the same environment, people on the internet or your tailnet, and services in other environments or clusters. NebulaCtrl gives each its own mechanism, and denies everything you haven't allowed.
Internet ──► Ingress (Traefik) ──► svc-web ──► active release of web
▲
Same environment ── svc-api:8080 ─────┘
Other environment ── only with a mesh grant
Tailnet ──► Tailscale ingress ──► svc-web
Cluster A ◄══ WireGuard mesh ══► Cluster BInternal hostnames
Each service has a stable in-cluster hostname, svc-SLUG, where SLUG is the service's slug. It points at whichever release is active, so a deployment switches traffic without changing the address. Another service in the same environment reaches it at svc-SLUG:PORT. A name too long for Kubernetes is shortened with a hash suffix.
You rarely write the hostname yourself. The variable function ${{ host(SLUG) }} expands to it, and a database's connection variables, such as DATABASE_URL, already contain it. A Postgres database with readers also has svc-SLUG-read for read-only traffic. See Variables.
An http process is reachable internally on its port and publicly through a domain. A worker process that declares a TCP port is reachable internally only. It's never routable from the internet.
A pod has no service-link variables such as <SERVICE>_PORT_* for the other services in its environment. NebulaCtrl turns Kubernetes service links off for every process pod. To reach another service, use svc-SLUG:PORT, or a variable that expands to it.
Environment isolation
Every environment runs in its own namespace, with a default-deny network policy. Pods of one environment reach each other. Services in different environments can't talk to each other, even in the same project. What a pod can reach outside its environment, and what can reach it, is listed in What a pod can reach.
A mesh grant opens one path. An admin allows every workload of one environment to reach one process of a service in another environment, on any cluster of the organization. You set it on the target service in Network access with Allow access from environment…. Nothing else crosses an environment boundary.
What a pod can reach
A pod in an environment namespace reaches only what the table lists. Everything else is denied.
| Destination | Reachable |
|---|---|
| Other pods of the same environment | Yes |
| Public internet addresses | Yes |
| The cluster's DNS pods | Yes, for DNS queries only |
| The node's own addresses | No. Only the node's public ports 80 and 443 stay reachable. |
Tailscale and CGNAT space, 100.64.0.0/10 | No |
| Loopback, IETF protocol and benchmark ranges, multicast | No |
| IPv6 unique local and link-local addresses | No |
The private ranges 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 and 169.254.0.0/16 | No |
Only the cluster's Traefik pod and the agent pod reach the http and worker pods of an environment from outside it, and only on the ports that the processes declare. A mesh grant is the one other path in.
A service that calls a tailnet device published through the node's Tailscale keeps working. When a proxy process connects directly through the node's Tailscale, the environment gets one rule per process. It opens only that process's tailnet address and port.
These rules are not settings. An administrator changes none of them from the console.
Proxy upstreams
A proxy process publishes an upstream you name as HOST:PORT on the service's address and domains. What the agent publishes depends on the destination.
| Upstream | Result |
|---|---|
| A public address, or a name that resolves only to public addresses | Published. |
| A private LAN, CGNAT or tailnet address, or a name that resolves to one | Published only if the cluster's upstream allowlist names it. |
A host inside the cluster: *.svc, *.cluster.local, localhost, or a name with no dot | Always refused. |
| Loopback, link-local, metadata or other reserved addresses | Always refused. |
| One of the cluster's own nodes, or an address in its pod or service ranges | Always refused. |
The agent resolves a name itself, checks every address it got, and publishes the addresses, never the name. It checks again every minute. A name that resolves to a forbidden address is refused, whatever the name looks like.
An entry of the upstream allowlist is a CIDR such as 192.168.1.0/24, an address, a host name such as nas.example.lan, or a *.suffix wildcard such as *.tail1234.ts.net. An address or CIDR entry admits a destination whose address lies in it. A name or wildcard entry admits that host name. A tailnet name that the Tailscale operator resolves has no address to compare, so only a name or wildcard entry admits it. An administrator edits the list under Clusters > the cluster > Settings > Tenant policy. See Set a cluster's tenant policy.
When an upstream is refused
- A new release. The release fails with the blocker
policy, and its message names the upstream and the rule it broke. The previous release keeps serving. - A release already serving. The agent withdraws the upstream at its next check. The service's domains answer
503until the upstream is allowed, or until a release with an allowed upstream goes live. The release shows thepolicyblocker.
After you add the entry to the allowlist, a withdrawn upstream is published again at the next check. A failed release needs a new deployment. See Deployments troubleshooting. Existing clusters started with an allowlist of the hosts their proxy services already used.
Domains and certificates
A domain is a hostname routed to one service and process through the cluster's ingress, which is Traefik. You add one with Add domain and choose:
| Choice | Options |
|---|---|
| Exposure | Public, reachable on the internet at the hostname. Tailnet, reachable only from your tailnet. |
| Serve through | This environment's cluster, or a public edge cluster. Public domains only. |
| DNS | Public domains only. Manual: you create the records at your DNS provider. Cloudflare: NebulaCtrl creates and maintains the records in your connected Cloudflare zone, optionally with Proxy through Cloudflare. |
| Certificate | Public domains only. HTTP-01: Traefik in the cluster answers Let's Encrypt on port 80. DNS-01: NebulaCtrl answers Let's Encrypt through Cloudflare DNS, which works when the cluster isn't reachable on port 80. HTTP-01 is the default, except that a Cloudflare-managed domain defaults to DNS-01 when the cluster supports it. |
A certificate always lives on the cluster that runs the service. See Domains for the steps.
A cluster is reachable from the internet when one of its nodes has a public IPv4 address. A cluster behind NAT still runs and serves services internally. To give it public domains, add a public gateway to it: a small node with a public IPv4 address that alone serves ports 80 and 443 for the cluster, forwards over the mesh, and runs no workloads. Or serve its domains through an edge cluster.
Edge clusters
An edge cluster is a publicly reachable cluster of your organization that serves a domain whose service runs on another cluster. You choose it as Serve through when you add the domain. TLS passes through the edge untouched, so the certificate stays on the service's own cluster, and the domain must use DNS-01. The edge relays over the mesh to a mesh-only port on the home cluster's ingress. See Edge clusters.
Tailscale
A domain with Tailnet exposure is reachable only from devices on your tailnet. Tailscale supplies the hostname, under your tailnet's ts.net name, and the certificate. The cluster must be connected to your tailnet first, from its settings in Clusters. The Tailscale operator puts one device on your tailnet for each tailnet domain and removes it when the domain is deleted. If the device is still there 10 minutes after no domain reports it, NebulaCtrl removes it, but only a device it recorded for one of your tailnet domains that still carries the operator's tag:k8s. A proxy process can also forward to a device on your tailnet. See Expose a service through Tailscale.
The WireGuard mesh
The mesh is your organization's own WireGuard network. Every node of every cluster in the organization joins it before K3s starts, and all node-to-node traffic runs inside it: K3s, kubelet, etcd and pod traffic. That is why a cluster behind NAT can grow across sites, and why one organization's clusters can reach each other privately.
- Addresses. Each machine gets one address in
10.254.0.0/16. Each cluster gets a fixed slot in one address plan: a/16for its pods in10.192.0.0/12and one for its services in10.208.0.0/12. Ranges never overlap between clusters, so traffic needs no address translation. An organization has at most 16 clusters. - Port. The mesh listens on UDP port 51821. K3s's own WireGuard backend keeps 51820 inside it.
- Paths. Nodes that can reach each other connect directly. The oldest live public node, the hub, relays for the rest. If the hub stops fetching its configuration for 90 seconds, the next public node takes over.
- Peers. A mesh peer is one machine admitted by exactly one install grant, with an address and a public key that are never reused. To replace a machine, remove it from the mesh first: Clusters > Nodes > Remove from mesh.
- Older clusters. A cluster installed before the mesh existed can't take new machines. Create a new cluster, move its environments there and remove the old one.
Related
- Requirements: the ports each host must allow.
- Connect a cluster: the install step that joins the mesh.
- Security: what the agent can reach in a cluster.
Builds
How NebulaCtrl turns a Git commit into an image inside your cluster, how it chooses between a Dockerfile and Railpack, and how a build becomes a release.
Database accounts
The two accounts every database has, which one your services sign in with, what the application account cannot do, and how a database made before the application account moves to it.