Running Visual Studio Code Server on Kubernetes
I would like to be able to code from anywhere, or at least have a development environment that doesn't depend on my PC. Visual Studio Code Server seems like one of the best and/or most popular options out there, so I decided it to try.
Since I've already got my Kubernetes cluster running, the best option seems to be the lscr.io/linuxserver/code-server docker image. I took the deployment from Deploying VSCode on a Kubernetes Cluster and added an Nginx ingress.
First, create a dedicated directory in the partition with plenty of space available:
A persistent volume is necessary because otherwise
everything (settings and uncommitted changes) is lost
when the container is restarted, including when the node
is restarted. Tried claiming a persistent volume from
the default storage class local-path
but never managed to get the pod to see the claim, until
the claim was changed to the manual storage class to get
a hostPath volume, which worked immediately (only,
after granting coder all rights on the hostPath
directory).
Then create code-server.yaml with the deployment and apply it:
Kubernetes deployment: code-server.yaml
| code-server.yaml | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
Add an A record for code.ssl.uu.am pointing to the external IP and go to
https://code.ssl.uu.am
to get the certificate creation started,
forward port 80
to the NodePort of the cm-acme-http-solver: