Skip to main content

Network

The platform keeps workspaces from reaching each other, so that a workspace someone breaks into is no way into the others. The platform, each worker and each workspace add rules on top, on the Network page.

Rules become a NetworkPolicy for each workspace, which the cluster's network enforces. Calico, Cilium and Antrea enforce NetworkPolicy, Flannel alone does not, and the platform installs none. Each worker checks whether its cluster enforces them.

What a workspace exchanges​

With no rules:

  • a workspace is reached by its worker alone: the gateway that serves it, and the agent that serves its files and tasks;
  • it reaches anything, and always its worker and DNS.

Rules come in three levels, read in this order:

  1. the platform's, for every workspace;
  2. its worker's, for the workspaces of one worker;
  3. the workspace's own.

Within and across levels, the first rule that decides about some traffic wins: a worker cannot undo what the platform denies, nor a workspace what its worker denies. What no rule decides keeps the default: nothing else reaches a workspace, and the workspace reaches anything else.

The platform's and the workers' rules​

Both are ordered lists of rules, kept on the Network page: Platform, then one entry per worker. Administrators with settings:write set the platform's, which are also the network settings section; those with worker:manage set a worker's. A worker's rules suit what is particular to its cluster, such as the addresses of its internal services.

settings:
network:
rules:
# Cloud metadata holds the node's credentials.
- {direction: egress, action: deny, protocol: any, peer: 169.254.169.254}
# No SSH between workspaces, whatever else they allow.
- {direction: ingress, action: deny, protocol: tcp, ports: "22", peer: workspaces}
# Workspaces of a team reach each other.
- {direction: ingress, action: allow, protocol: any, peer: team}

A worker whose cluster keeps its object store at 10.42.7.0/24, and nothing else internal workspaces should reach, could have these rules:

- {direction: egress, action: allow, protocol: tcp, ports: "8333", peer: 10.42.7.0/24}
- {direction: egress, action: deny, protocol: any, peer: 10.0.0.0/8}
FieldValues
directioningress: who reaches the workspace; egress: what it reaches.
actionallow or deny.
protocolany, tcp or udp.
portsA port, a range such as 8000-8100, or empty for every port.
peerFor ingress, workspaces (every workspace of the worker) or team (those of the workspace's team). For egress, an address or an address block.
noteFree text.

Running workspaces take changed rules within a minute, without a restart. A worker's rules go with the worker. Changes to a worker's rules are audited as network.worker, those to the platform's as settings changes.

The API is PATCH /v1/settings/network for the platform's rules, and GET /v1/network/workers and PUT /v1/network/workers/{worker_id} for the workers'.

A workspace's rules​

In a workspace's drawer, under Network, whoever may change the workspace lets in the whole team, or one workspace of the team, on a protocol and ports. A rule about a workspace goes when that workspace is deleted. Changes are audited as network.update.

The drawer also lists the platform's and the worker's rules that concern the workspace, and warns when its worker does not enforce network policies.

Enforcement​

An agent checks whether its cluster enforces NetworkPolicy when it starts and every hour, or five minutes after a check that could not tell. It does this in the workspaces' namespace:

  1. it runs a pod of the sidecar's image, which that namespace pulls for every workspace anyway, and connects to it;
  2. it gives the pod a policy that admits nothing;
  3. if its connections stop within half a minute, the cluster enforces policies; if they go on, it does not.

The pod and the policy are then removed. The Workers page and the Network page show the result:

ResultMeaning
EnforcedThe rules apply.
Not enforcedThe cluster's network ignores NetworkPolicy: the rules change nothing until the cluster runs a network that enforces it.
UnknownThe check could not tell, for the reason shown, e.g. its pod could not pull the image, or the agent runs outside the cluster and reaches no pod.

Restarting the agent checks again at once.

Limits​

  • Protocols. NetworkPolicy names TCP and UDP ports. Other protocols, ICMP among them, pass where a rule allows all traffic, unless an earlier rule has taken some of it.
  • Addresses. Egress rules match destinations by address, pods of the cluster included. A service is matched by the addresses of its pods, not by its cluster IP.
  • Ingress. Ingress rules name workspaces, not addresses. Nothing outside the worker reaches a workspace but through its gateway.

Without isolation​

Keep workspaces apart, on the Network page, is the isolation field of the network settings section, on unless turned off. Off, workspaces drop their egress and cross-workspace restrictions within a minute and exchange all other traffic freely, while the default sidecar NetworkPolicy remains in place to restrict sidecar ports 7070 and 7071 exclusively to the worker's agent pods; all configured rules are kept for when isolation is turned on again.

An installation upgraded from a release where this was the network plugin keeps what it had: isolation stays off where the plugin was off and workspaces existed. Where the plugin was turned on in the deployment's settings file rather than on the Plugins page, the upgrade cannot tell: clear the override on the Network page.

Where a worker's cluster does not enforce NetworkPolicy, its workspaces run all the same and nothing keeps them apart: the Network page names such workers, and their own pages and their workspaces' panels say so.