A cloud-native IDE for the homelab
code-server is a port of VS Code that runs server-side and exposes itself through a web interface. The goal in this homelab: having a development environment reachable from any device — tablet, workstation, laptop on the move — with no local installation.
Paired with the Cloudflare Tunnel, code-server is reachable at code.olig-homelab-2025.win from anywhere, with the workspace persisted on a Longhorn volume.
Deployment specifics
Password authentication
code-server exposes a web interface protected by a password. That password is injected through an environment variable sourced from a SealedSecret:
env:
- name: PASSWORD
valueFrom:
secretKeyRef:
name: code-server-credentials
key: password
WebSockets and Cloudflare
VS Code uses WebSockets for real-time editor synchronisation. The Cloudflare Tunnel configuration needs generous WebSocket timeouts to avoid spurious disconnections.
Persistent workspace
The workspace (files, VS Code configuration, extensions) is stored in a critical PVC:
volumeMounts:
- name: workspace
mountPath: /home/coder
The installed VS Code extensions persist across pod restarts.
Lessons learned
strategy: Recreate was set from the start, as a proactive precaution rather than a lesson learned the hard way: two code-server instances on the same workspace PVC cause file conflicts. Recreate guarantees that only one instance accesses the workspace at a time. That same single-PVC + Recreate pattern was later reused for other stateful apps, such as Silex.
Resources: code-server plus its extensions easily consume 512 Mi - 1 Gi of RAM. Plan for a 2 Gi limit for intensive work sessions with many active extensions.
Terminal proxy: code-server’s built-in terminal runs inside the pod — it is not the Kubernetes node. To interact with the cluster, install kubectl and kubeseal in the code-server image, and mount the kubeconfig through a secret.