You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Remote Development on Kubernetes Pods (with Devcontainers)
11
11
12
-
Provision Kubernetes Pods as [Coder workspaces](https://coder.com/docs/v2/latest/workspaces) with this example template.
13
-
14
-
<!-- TODO: Add screenshot -->
12
+
Provision Devcontainers as [Coder workspaces](https://coder.com/docs/v2/latest/workspaces) on Kubernetes with this example template.
15
13
16
14
## Prerequisites
17
15
18
16
### Infrastructure
19
17
20
-
**Cluster**: This template requires an existing Kubernetes cluster
18
+
**Cluster**: This template requires an existing Kubernetes cluster.
21
19
22
-
**Container Image**: This template uses the [codercom/enterprise-base:ubuntu image](https://github.com/coder/enterprise-images/tree/main/images/base) with some dev tools preinstalled. To add additional tools, extend this image or build it yourself.
20
+
**Container Image**: This template uses the [envbuilder image](https://github.com/coder/envbuilder) to build a Devcontainer from a `devcontainer.json`.
23
21
24
22
### Authentication
25
23
@@ -31,10 +29,24 @@ Coder supports devcontainers with [envbuilder](https://github.com/coder/envbuild
31
29
32
30
This template provisions the following resources:
33
31
34
-
- Kubernetes pod (ephemeral)
35
-
- Kubernetes persistent volume claim (persistent on `/home/coder`)
32
+
- Kubernetes deployment (ephemeral)
33
+
- Kubernetes persistent volume claim (persistent on `/workspaces`)
36
34
37
-
This means, when the workspace restarts, any tools or files outside of the home directory are not persisted. To pre-bake tools into the workspace (e.g. `python3`), modify the container image. Alternatively, individual developers can [personalize](https://coder.com/docs/v2/latest/dotfiles) their workspaces with dotfiles.
35
+
This template will fetch a Git repo containing a `devcontainer.json` specified by the `repo` parameter, and builds it
36
+
with [`envbuilder`](https://github.com/coder/envbuilder).
37
+
The Git repository is cloned inside the `/workspaces` volume if not present.
38
+
Any local changes to the Devcontainer files inside the volume will be applied when you restart the workspace.
39
+
As you might suspect, any tools or files outside of `/workspaces` or not added as part of the Devcontainer specification are not persisted.
40
+
Edit the `devcontainer.json` instead!
38
41
39
42
> **Note**
40
43
> This template is designed to be a starting point! Edit the Terraform to extend the template to support your use case.
44
+
45
+
## Caching
46
+
47
+
To speed up your builds, you can use a container registry as a cache.
48
+
When creating the template, set the parameter `cache_repo`.
49
+
50
+
> [!NOTE] We recommend using a registry cache with authentication enabled.
51
+
> To allow Envbuilder to authenticate with the registry cache, specify the variable `cache_repo_dockerconfig_secret`
52
+
> with the name of a Kubernetes secret in the same namespace as Coder. The secret must contain the key `.dockerconfigjson`.
0 commit comments