Cordium documentation · Latest
How Cordium Works
Cordium is a free and open source, self-hosted, horizontally scalable, identity-based sandbox platform built on Kubernetes and Octelium. A single Cordium system is called a Cluster and it is defined and addressed by its Octelium Cluster domain (e.g. example.com, octelium.example.com, etc...). In other words, Cordium is installed as a package on top of an existing Octelium Cluster and it reuses all of its infrastructure.
Kubernetes provides the container orchestration layer. Every Workspace runs inside a hardened rootless container inside a Kubernetes pod and every Workspace's storage, Volume and snapshot is backed by Kubernetes persistent volumes and CSI volume snapshots. The Cluster can run on a single-node Kubernetes cluster installed on top of a single cheap VM (see the quick installation guide here) as well as on scalable on-prem or managed Kubernetes clusters. You don't need prior Kubernetes experience to operate Cordium.
Octelium provides the identity and access control infrastructure. Every Cordium User is an Octelium User, every Workspace run is an Octelium Session, and every Cordium component that is reachable from outside the Cluster (i.e. the API, the web portal and the SSH endpoint) is an Octelium Service protected by Octelium's identity-aware proxies and Policies. Secretless access, tunneling, authentication, authorization and auditing are all provided by Octelium. Cordium does not implement its own identity system.
Components
A Cordium installation consists of the following components deployed in every Region of the Cluster:
API Server exposes the full Cordium API over gRPC as the Octelium
GRPCServicedefault-cordium.octelium-api(i.e. viaoctelium-api.<DOMAIN>, the same endpoint as the Octelium API). It implements three gRPC services:MainServicefor resource management (Spaces, Templates, Workspaces, Volumes, snapshots, Secrets, etc...),WorkspaceServicefor the operations inside a running Workspace (i.e. command execution, terminals and initialization logs), andManagementServicefor the Cluster-wideClusterConfig. Every call is authenticated and authorized by Octelium before it reaches the API server and it is stateless and horizontally scalable.Portal is the web console that is served as the Octelium
WEBServicedefault.cordiumathttps://cordium.<DOMAIN>. Besides serving the web application, it multiplexes the browser terminals over a single WebSocket connection, reverse-proxies the Workspace applications athttps://<WORKSPACE>.cordium.<DOMAIN>and handles the OAuth2 authorization flows of GitProviders (read more here).SSH Proxy is an Octelium
SSHService nameddefault-ssh.cordiumthat is implemented by a Cordium-specific identity-aware proxy. It authorizes every SSH connection against the requesting Session's User, the target Workspace's owner and its Space configuration, and then proxies the connection to the embedded SSH server running inside the Workspace. This is what thecordium sshandcordium cpcommands use (read more here).Nocturne is the Workspace controller. It watches Workspace state changes and drives the Kubernetes-level operations: creating and deleting pods and persistent volume claims, taking and restoring volume snapshots, provisioning Volumes, enforcing the inactivity timeouts, and cleaning up after stopped, failed or deleted Workspaces.
Workspace Supervisor runs as a Kubernetes pod container and it bootstraps and manages the actual _Works sandbox rootless container, pulls or builds the Workspace image, enforces the network policy, launches the sandbox container, runs the Octelium authentication proxy and the SSH agent for the sandbox, and reports the state of the Workspace back to the Cluster.
Workspace Agent runs inside the sandbox container itself. It sets up the Workspace user, clones the repositories, installs the devcontainer features and dotfiles, configures the git credential helper, runs the lifecycle tasks, manages the terminals and the command executions, and runs the
octelium connectprocess that gives the Workspace its secretless access to Octelium Services.
Workspace Isolation Model
Each Workspace pod uses a layered isolation model:
The supervisor container is the only container of the pod. It owns the pod's network namespace, the Workspace's persistent volume and the Kubernetes-level resources limits. It runs the sandbox via rootless Podman (i.e. without any container daemon) under a dedicated, unprivileged user.
The sandbox container is launched by the supervisor with the
crunruntime, a custom seccomp profile and its own user, PID, mount, IPC, cgroup and network namespaces. The root user inside the sandbox is mapped to an unprivileged user outside of it. The sandbox, or "inner", rootless container cannot see the processes, mounts or cgroups of the parent, or "outer", supervisor, and its CPU, memory and process counts are enforced by its own nested cgroup. The Octelium and Cordium binaries (i.e.octelium,octeliumctlandcordium) are mounted into it read-only.The network policy is enforced by the supervisor outside of the sandbox using nftables. The supervisor (including its loopback interface), the pod's own addresses, its default gateway and link-local addresses such as the cloud metadata endpoint (i.e.
169.254.169.254) are always unreachable from the sandbox regardless of any configuration. Private networks (e.g.10.0.0.0/8and192.168.0.0/16, which typically include the Kubernetes cluster's pod and service networks and the Kubernetes API) are denied by default while the public internet is allowed by default, and every Workspace can tighten that further with its own egress rules (read more here).
From the User's perspective, however, the sandbox behaves like a full Linux machine: the Workspace user can escalate to root via sudo, packages can be installed, nested containers can be run via rootless Podman, NET_ADMIN operations inside the sandbox's own network namespace are permitted and services can be run as daemons. Root inside the sandbox cannot, however, change any host-wide kernel settings.
Identity and Secretless Access
Every Workspace run is an Octelium Session that belongs to the Workspace's owner. That Session carries the identity of the Workspace, its Space and its Template, which is what lets Octelium Policies distinguish a User's Workspace from the same User's laptop, a CI Workspace from a development one, or one Space from another (read more here).
Storage
Every Workspace has its own persistent volume claim that stores its home directory, /workspace and its container layer, which means that packages installed via apt or npm -g persist across the runs of a persistent Workspace. Storage is provisioned by the Kubernetes StorageClass selected by the ClusterConfig rules and it can be restored from CSI volume snapshots, which is what powers both Template pre-builds and WorkspaceSnapshots. Volumes are separate persistent volume claims that are mounted into the sandbox at the requested paths (read more here).